Skip to content

Commit 7d3493f

Browse files
committed
feat: update checker
1 parent da5f929 commit 7d3493f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

index.js

+10
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ console.log(
2626
` \n \n${package.description}\n `
2727
);
2828

29+
axios.get("https://raw.githubusercontent.com/HirziDevs/PteroStats/refs/heads/main/package.json").then(response => {
30+
if (response.data && response.data.version !== package.version) console.log(
31+
cliColor.yellowBright(`+============================================================+\n`) +
32+
` Update available: ${package.version}${cliColor.green(response.data.version)}\n` +
33+
` Download at ${cliColor.blueBright("https://ps.znproject.my.id/download")} to update.\n` +
34+
cliColor.redBright(` Make sure to backup ${cliColor.blueBright("config.yml")} and ${cliColor.blueBright(".env")} before updating.\n`) +
35+
cliColor.yellowBright(`+============================================================+`)
36+
)
37+
}).catch(error => console.log(`${cliColor.cyanBright("[PteroStats]")} ${cliColor.redBright("Failed to check for updates.")}`));
38+
2939
if (!fs.existsSync(".env") || !fs.existsSync(".setup-complete")) return require("./handlers/setup.js")();
3040

3141
process.on('uncaughtException', (error) => errorLogging(error))

0 commit comments

Comments
 (0)