diff options
author | 冯诚 | 2024-04-17 21:38:24 +0800 |
---|---|---|
committer | 冯诚 | 2024-04-17 21:38:24 +0800 |
commit | e9ebcf3c97c868c05e9d98384373045762296bf2 (patch) | |
tree | e2e810f88d01f157ad5a35418ebdc42ce23ff3e7 /get_latest | |
parent | e79fad18a803fc5e721dbfeba6168be9819a037e (diff) | |
download | aur-e9ebcf3c97c868c05e9d98384373045762296bf2.tar.gz |
更新 get_latest 腾讯修改了接口
Diffstat (limited to 'get_latest')
-rwxr-xr-x | get_latest | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/get_latest b/get_latest index 2d8e6850047b..45370713c84c 100755 --- a/get_latest +++ b/get_latest @@ -1,20 +1,21 @@ #!/bin/node +require('console'); + +const args = process.argv.slice(2) +const archs = args.length < 1 ? [`x86_64`] : args; + const fs = require('fs'); const path = require('path'); const syncRequest = require('sync-request'); const os = require('os'); + require('seajs'); const file = "linuxQQDownload" const url = `https://cdn-go.cn/qq-web/im.qq.com_new/latest/rainbow/${file}.js` const res = syncRequest('GET', url); -const arch = process.argv.slice(2)[0]; -if (arch == undefined) { - process.exit(1); -} - fs.mkdtemp(path.join(os.tmpdir(), "/"), (err, directory) => { if (err) throw err; @@ -25,11 +26,29 @@ fs.mkdtemp(path.join(os.tmpdir(), "/"), (err, directory) => { fs.writeFileSync(path.join(directory, `${file}.js`), res.body); seajs.use(`${file}`, function (config) { - let urls = config[arch + 'DownloadUrl']; - if (urls == undefined || urls.appimage == undefined) { - process.exit(1); + console.log(`version=${config.version}`); + console.log(`updateDate=${config.updateDate}`); + + for (const key in archs) { + const arch = archs[key]; + + let config_index; + switch (arch) { + case `x86_64`: + config_index = `x64DownloadUrl`; + break; + case `aarch64`: + config_index = `armDownloadUrl`; + break; + case `loong64`: + config_index = `loongarchDownloadUrl`; + break; + default: + throw new Error(`This arch is currently not supported`); + } + + console.log(`url_${arch}=${config[config_index].appimage}`); } - console.log(urls.appimage); }); fs.rm(directory, { recursive: true }, (err) => { |