Skip to content

Commit

Permalink
feat: update checker
Browse files Browse the repository at this point in the history
  • Loading branch information
HirziDevs committed Nov 1, 2024
1 parent da5f929 commit 7d3493f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ console.log(
` \n \n${package.description}\n `
);

axios.get("https://raw.githubusercontent.com/HirziDevs/PteroStats/refs/heads/main/package.json").then(response => {
if (response.data && response.data.version !== package.version) console.log(
cliColor.yellowBright(`+============================================================+\n`) +
` Update available: ${package.version}${cliColor.green(response.data.version)}\n` +
` Download at ${cliColor.blueBright("https://ps.znproject.my.id/download")} to update.\n` +
cliColor.redBright(` Make sure to backup ${cliColor.blueBright("config.yml")} and ${cliColor.blueBright(".env")} before updating.\n`) +
cliColor.yellowBright(`+============================================================+`)
)
}).catch(error => console.log(`${cliColor.cyanBright("[PteroStats]")} ${cliColor.redBright("Failed to check for updates.")}`));

if (!fs.existsSync(".env") || !fs.existsSync(".setup-complete")) return require("./handlers/setup.js")();

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

0 comments on commit 7d3493f

Please sign in to comment.