From b15773b0f49c0ce517bf772131929411caa962a2 Mon Sep 17 00:00:00 2001 From: lzt404 <2596933790@qq.com> Date: Sat, 22 Aug 2026 16:24:34 +0800 Subject: [PATCH] Dev (#158) * fix(macos): restore main window on application reopen (#148) Handle macOS RunEvent::Reopen when no window is visible. Fixes #147. * fix(version): update core version to 7.2.138 * fix(macos): persist OAuth credentials across DMG upgrades Migrate app-bundle auth directories to Application Support before updating configuration and prevent future bundle-local OAuth storage. Fixes #153 * fix(kernel): stop the core before updating * fix(i18n): use consistent stop terminology for core controls * fix(opencode): support macOS JSONC configuration detection Closes #156 * fix(update): preserve legacy macOS manifest compatibility --------- Co-authored-by: Fake Trader <9635792+faketrader@users.noreply.github.com> --- scripts/manifest.mjs | 38 ++++++++++++++++++---------- tests/portableUpdateManifest.test.ts | 8 +++++- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/scripts/manifest.mjs b/scripts/manifest.mjs index 1306c27..69e6a20 100644 --- a/scripts/manifest.mjs +++ b/scripts/manifest.mjs @@ -9,12 +9,20 @@ export function portableUpdateManifestName(platform) { if (!['windows', 'linux', 'darwin'].includes(normalizedPlatform)) { throw new Error(`Unsupported update platform: ${platform}`); } - // Keep the broken legacy macOS updater on a manifest URL that is no longer published. + // New macOS builds use a separate channel because the signed-bundle updater + // requires the newer update flow. return normalizedPlatform === 'darwin' ? 'portable-update-darwin-v2.json' : `portable-update-${normalizedPlatform}.json`; } +export function portableUpdateManifestNames(platform) { + const primaryName = portableUpdateManifestName(platform); + return primaryName === 'portable-update-darwin-v2.json' + ? [primaryName, 'portable-update-darwin.json'] + : [primaryName]; +} + export async function generatePortableUpdateManifest({ directory, output, @@ -113,18 +121,22 @@ async function main() { } const directory = resolve(args.get('--directory') ?? 'artifacts'); const platform = args.get('--platform') ?? 'windows'; - const output = resolve( - args.get('--output') ?? join(directory, portableUpdateManifestName(platform)), - ); - const manifest = await generatePortableUpdateManifest({ - directory, - output, - platform, - repository: args.get('--repository'), - gitcodeRepository: args.get('--gitcode-repository'), - tag: args.get('--tag'), - }); - console.log(`Generated ${basename(output)} for v${manifest.version}`); + const requestedOutput = args.get('--output'); + const outputs = requestedOutput + ? [resolve(requestedOutput)] + : portableUpdateManifestNames(platform).map((name) => join(directory, name)); + let manifest; + for (const output of outputs) { + manifest = await generatePortableUpdateManifest({ + directory, + output, + platform, + repository: args.get('--repository'), + gitcodeRepository: args.get('--gitcode-repository'), + tag: args.get('--tag'), + }); + } + console.log(`Generated ${outputs.map(basename).join(', ')} for v${manifest.version}`); } const entryPoint = process.argv[1] ? pathToFileURL(resolve(process.argv[1])).href : ''; diff --git a/tests/portableUpdateManifest.test.ts b/tests/portableUpdateManifest.test.ts index e92e527..17ef07e 100644 --- a/tests/portableUpdateManifest.test.ts +++ b/tests/portableUpdateManifest.test.ts @@ -6,12 +6,18 @@ import { describe, expect, test } from 'bun:test'; import { generatePortableUpdateManifest, portableUpdateManifestName, + portableUpdateManifestNames, } from '../scripts/manifest.mjs'; -test('macOS uses a new update manifest channel', () => { +test('macOS uses a new primary channel and keeps the legacy manifest alias', () => { expect(portableUpdateManifestName('windows')).toBe('portable-update-windows.json'); expect(portableUpdateManifestName('linux')).toBe('portable-update-linux.json'); expect(portableUpdateManifestName('darwin')).toBe('portable-update-darwin-v2.json'); + expect(portableUpdateManifestNames('darwin')).toEqual([ + 'portable-update-darwin-v2.json', + 'portable-update-darwin.json', + ]); + expect(portableUpdateManifestNames('linux')).toEqual(['portable-update-linux.json']); }); describe('Windows 便携更新清单', () => {