EZPPLauncher/appInfo.js

20 lines
719 B
JavaScript
Raw Normal View History

2023-05-31 17:03:11 +00:00
const { default: axios } = require("axios");
const { compareVersions } = require("compare-versions");
2022-10-16 21:16:05 +00:00
const appName = "EZPPLauncher"
2023-11-24 06:28:20 +00:00
const appVersion = "1.2.0";
2023-05-31 17:03:11 +00:00
const hasUpdate = async () => {
const releaseInfo = await axios.get(`https://git.ez-pp.farm/api/v1/repos/EZPPFarm/${appName}/releases/latest`);
if (releaseInfo.status !== 200) return false;
const latestReleaseVersion = releaseInfo.data.tag_name;
const updateAvailable = compareVersions(latestReleaseVersion, appVersion);
if(updateAvailable > 0)
return {
version: latestReleaseVersion,
url: releaseInfo.data.html_url,
}
return undefined;
}
2022-10-16 21:16:05 +00:00
2023-05-31 17:03:11 +00:00
module.exports = { appName, appVersion, hasUpdate };