[AsarUpdate] Make generic (support various channels of updates)

This commit is contained in:
Ducko 2022-03-23 22:49:07 +00:00
parent 7c11adddc4
commit af9bec3783

View file

@ -7,14 +7,14 @@ const { join } = require('path');
const asarPath = join(require.main.filename, '..');
const downloadPath = join(asarPath, '..', 'app.asar.download');
const asarUrl = 'https://github.com/GooseMod/OpenAsar/releases/download/nightly/app.asar';
const asarUrl = `https://github.com/GooseMod/OpenAsar/releases/download/${oaVersion.split('-')[0]}/app.asar`;
const getAsarHash = () => crypto.createHash('sha512').update(fs.readFileSync(asarPath)).digest('hex');
module.exports = async () => { // (Try) update asar
log('AsarUpdate', 'Updating...');
if (!oaVersion.startsWith('nightly-')) return log('AsarUpdate', 'Non-standard version');
if (!oaVersion.includes('-')) return log('AsarUpdate', 'Non-standard version');
const originalHash = getAsarHash();