mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-04-13 05:20:28 +08:00
- Refactor updater.mjs: extract shared utilities, remove dead alpha channel, add `autobuild` channel via CLI arg - Add override-updater-endpoints.mjs to switch tauri.conf.json endpoints to updater-autobuild at build time - Add release-update-autobuild job to autobuild workflow - Change allowDowngrades to true so custom compareVersions handles build-metadata versions (+autobuild.MMDD.hash) correctly - Fix original bug: linux-x86/i686 wrote .url instead of .signature in the .sig handler
33 lines
1.0 KiB
JavaScript
33 lines
1.0 KiB
JavaScript
/**
|
|
* Override updater endpoints in tauri.conf.json for a specific channel.
|
|
*
|
|
* Usage:
|
|
* node scripts/override-updater-endpoints.mjs <channel>
|
|
*
|
|
* Example:
|
|
* node scripts/override-updater-endpoints.mjs autobuild
|
|
* # Changes: .../releases/download/updater/update.json
|
|
* # → : .../releases/download/updater-autobuild/update.json
|
|
*/
|
|
import fs from 'fs'
|
|
import path from 'path'
|
|
|
|
const channel = process.argv[2]
|
|
if (!channel) {
|
|
console.error('Usage: node scripts/override-updater-endpoints.mjs <channel>')
|
|
process.exit(1)
|
|
}
|
|
|
|
const configPath = path.join(process.cwd(), 'src-tauri', 'tauri.conf.json')
|
|
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'))
|
|
|
|
config.plugins.updater.endpoints = config.plugins.updater.endpoints.map(
|
|
(endpoint) =>
|
|
endpoint.replace('/download/updater/', `/download/updater-${channel}/`),
|
|
)
|
|
|
|
fs.writeFileSync(configPath, JSON.stringify(config, null, 2))
|
|
|
|
console.log(`[INFO]: Updater endpoints switched to "${channel}" channel:`)
|
|
config.plugins.updater.endpoints.forEach((e) => console.log(` ${e}`))
|