mirror of
https://git.fuwafuwa.moe/SMLoadrDev/SMLoadr
synced 2024-11-18 13:34:32 +01:00
Removed update checker
This commit is contained in:
parent
c29f614e9c
commit
d2d54793bf
72
SMLoadr.js
72
SMLoadr.js
@ -194,7 +194,6 @@ function initRequest() {
|
|||||||
console.log(chalk.cyan('║') + ' MANUAL: https://git.fuwafuwa.moe/SMLoadrDev/SMLoadr ' + chalk.cyan('║'));
|
console.log(chalk.cyan('║') + ' MANUAL: https://git.fuwafuwa.moe/SMLoadrDev/SMLoadr ' + chalk.cyan('║'));
|
||||||
console.log(chalk.cyan('║') + ' NEWS: https://t.me/SMLoadrNews ' + chalk.cyan('║'));
|
console.log(chalk.cyan('║') + ' NEWS: https://t.me/SMLoadrNews ' + chalk.cyan('║'));
|
||||||
console.log(chalk.cyan('╚══════════════════════════════════════════════════════════════════╝'));
|
console.log(chalk.cyan('╚══════════════════════════════════════════════════════════════════╝'));
|
||||||
console.log(chalk.yellow('Please read the manual thoroughly before asking for help!\n'));
|
|
||||||
|
|
||||||
|
|
||||||
if (!fs.existsSync(DOWNLOAD_LINKS_FILE)) {
|
if (!fs.existsSync(DOWNLOAD_LINKS_FILE)) {
|
||||||
@ -222,43 +221,17 @@ function initRequest() {
|
|||||||
function startApp() {
|
function startApp() {
|
||||||
initRequest();
|
initRequest();
|
||||||
|
|
||||||
downloadSpinner.text = 'Checking for update...';
|
|
||||||
downloadSpinner.start();
|
|
||||||
|
|
||||||
isUpdateAvailable().then((response) => {
|
|
||||||
if (response) {
|
|
||||||
downloadSpinner.warn('New update available!\n Please update to the latest version!');
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
openUrl.open('https://git.fuwafuwa.moe/SMLoadrDev/SMLoadr/releases');
|
|
||||||
|
|
||||||
if (isCli) {
|
|
||||||
setTimeout(() => {
|
|
||||||
process.exit(1);
|
|
||||||
}, 100);
|
|
||||||
} else {
|
|
||||||
setTimeout(() => {
|
|
||||||
// Nothing, only to keep the app running
|
|
||||||
}, 999999999);
|
|
||||||
}
|
|
||||||
}, 1000);
|
|
||||||
} else {
|
|
||||||
downloadSpinner.succeed('You have the latest version :)');
|
|
||||||
|
|
||||||
initDeezerCredentials().then(() => {
|
initDeezerCredentials().then(() => {
|
||||||
downloadSpinner.text = 'Initiating Deezer API...';
|
downloadSpinner.text = 'Initiating Deezer API...';
|
||||||
downloadSpinner.start();
|
downloadSpinner.start();
|
||||||
|
|
||||||
initDeezerApi().then(() => {
|
initDeezerApi().then(() => {
|
||||||
downloadSpinner.succeed('Connected to Deezer API');
|
downloadSpinner.succeed('Connected to Deezer API');
|
||||||
|
|
||||||
selectMusicQuality();
|
selectMusicQuality();
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
if ('Wrong Deezer credentials!' === err) {
|
if ('Wrong Deezer credentials!' === err) {
|
||||||
downloadSpinner.fail('Wrong Deezer credentials!\n');
|
downloadSpinner.fail('Wrong Deezer credentials!\n');
|
||||||
|
|
||||||
configService.set('arl', null);
|
configService.set('arl', null);
|
||||||
|
|
||||||
configService.saveConfig();
|
configService.saveConfig();
|
||||||
|
|
||||||
startApp();
|
startApp();
|
||||||
@ -268,51 +241,6 @@ function startApp() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).catch((err) => {
|
|
||||||
downloadSpinner.fail(err);
|
|
||||||
|
|
||||||
if (isCli) {
|
|
||||||
setTimeout(() => {
|
|
||||||
process.exit(1);
|
|
||||||
}, 100);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if a new update of the app is available.
|
|
||||||
*
|
|
||||||
* @returns {Boolean}
|
|
||||||
*/
|
|
||||||
function isUpdateAvailable() {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
log.debug('Checking for update');
|
|
||||||
|
|
||||||
requestWithoutCacheAndRetry('https://pastebin.com/raw/nqzfDRrU').then((response) => {
|
|
||||||
log.debug('Checked for update on Pastebin. Response: "' + response + '"');
|
|
||||||
|
|
||||||
if (response !== packageJson.version) {
|
|
||||||
resolve(true);
|
|
||||||
} else {
|
|
||||||
resolve(false);
|
|
||||||
}
|
|
||||||
}).catch(() => {
|
|
||||||
log.debug('Failed checking on pastebin for update. Trying git repo.');
|
|
||||||
|
|
||||||
requestWithoutCache('https://git.fuwafuwa.moe/SMLoadrDev/SMLoadr/raw/branch/master/VERSION.md?' + Date.now()).then((response) => {
|
|
||||||
log.debug('Checked for update on the git repo. Response: "' + response + '"');
|
|
||||||
|
|
||||||
if (response !== packageJson.version) {
|
|
||||||
resolve(true);
|
|
||||||
} else {
|
|
||||||
resolve(false);
|
|
||||||
}
|
|
||||||
}).catch(() => {
|
|
||||||
reject('Could not check for update!');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create directories of the given path if they don't exist.
|
* Create directories of the given path if they don't exist.
|
||||||
|
Loading…
Reference in New Issue
Block a user