feat: add masked token placeholders and desktop icons

This commit is contained in:
cita
2026-03-16 21:36:23 +08:00
parent 2409d9f184
commit 0a06f15e13
37 changed files with 2954 additions and 136 deletions
+24
View File
@@ -0,0 +1,24 @@
import { readFile } from 'node:fs/promises';
import { join } from 'node:path';
import { describe, expect, it } from 'vitest';
describe('desktop icon assets', () => {
it('keeps runtime icon paths aligned to the generated desktop icon', async () => {
const {
DESKTOP_BUILD_ICON_RELATIVE_PATH,
DESKTOP_RUNTIME_ICON_RELATIVE_PATH,
getDesktopRuntimeIconPath,
} = await import('./iconAssets.js');
expect(DESKTOP_RUNTIME_ICON_RELATIVE_PATH).toBe(join('dist', 'web', 'desktop-icon.png'));
expect(DESKTOP_BUILD_ICON_RELATIVE_PATH).toBe(join('build', 'desktop-icon.png'));
expect(getDesktopRuntimeIconPath('/app')).toBe(join('/app', 'dist', 'web', 'desktop-icon.png'));
});
it('points electron-builder at the generated desktop package icon', async () => {
const configPath = join(process.cwd(), 'electron-builder.yml');
const config = await readFile(configPath, 'utf8');
expect(config).toContain('icon: build/desktop-icon.png');
});
});
+9
View File
@@ -0,0 +1,9 @@
import { join } from 'node:path';
export const DESKTOP_RUNTIME_ICON_RELATIVE_PATH = join('dist', 'web', 'desktop-icon.png');
export const DESKTOP_BUILD_ICON_RELATIVE_PATH = join('build', 'desktop-icon.png');
export const DESKTOP_ICON_PUBLIC_PATH = '/desktop-icon.png';
export function getDesktopRuntimeIconPath(appPath: string) {
return join(appPath, DESKTOP_RUNTIME_ICON_RELATIVE_PATH);
}
+2 -1
View File
@@ -21,6 +21,7 @@ import {
resolveDesktopServerWorkingDir,
waitForServerReady,
} from './runtime.js';
import { getDesktopRuntimeIconPath } from './iconAssets.js';
const { autoUpdater } = electronUpdater;
@@ -51,7 +52,7 @@ function getServerEntryPath() {
}
function getTrayIconPath() {
return join(app.getAppPath(), 'dist', 'web', 'logo.png');
return getDesktopRuntimeIconPath(app.getAppPath());
}
function getWindowIconPath() {