Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

perf(wallpaper): 静态壁纸原图改为 CDN 按需下载

david975cce512b1b
diff --git a/apps/desktop/src/main/__tests__/customWallpaper.test.ts b/apps/desktop/src/main/__tests__/customWallpaper.test.ts
index beeb1e1c81..91ddc332f9 100644
--- a/apps/desktop/src/main/__tests__/customWallpaper.test.ts
+++ b/apps/desktop/src/main/__tests__/customWallpaper.test.ts
@@ -16,6 +16,10 @@ vi.mock('../../shared/wallpaper-video-manifest.json', () => ({
sha256: 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad',
image: { sha256: 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad' },
},
+ still: {
+ delivery: 'cdn',
+ image: { sha256: '88d4266fd4e6338d13b845fcf289579d209c897823b9217da3e161936f031589' },
+ },
},
}));
vi.mock('../localDb/client/current.js', () => ({
@@ -154,21 +158,25 @@ describe('client-owned custom wallpaper lifecycle', () => {
await removeCustomWallpaper();
expect((await listBlobFiles('client-wallpaper')).entries).toHaveLength(0);
});
- it.each(['video/mp4', 'image/webp'])(
- 'retains official CDN %s across custom import and removal',
- async (mimeType) => {
- const official = await writeBlob({
- buffer: Buffer.from('abc'),
- mimeType,
- scope: 'client-wallpaper',
- });
- await selectImage();
- await importCustomWallpaper(parent);
- await removeCustomWallpaper();
- expect((await readClientWallpaperFile(official.url)).buffer).toEqual(Buffer.from('abc'));
- expect((await listBlobFiles('client-wallpaper')).entries).toHaveLength(1);
- },
- );
+ // User request 2026-10-17: static CDN entries have no video hash. Exercise
+ // custom import/removal with one such cached image to prevent data loss;
+ // previous fixtures only covered two-kind scenes. Unit tier.
+ it.each([
+ ['video/mp4', 'abc'],
+ ['image/webp', 'abc'],
+ ['image/webp', 'abcd'],
+ ])('retains official CDN %s across custom import and removal', async (mimeType, content) => {
+ const official = await writeBlob({
+ buffer: Buffer.from(content),
+ mimeType,
+ scope: 'client-wallpaper',
+ });
+ await selectImage();
+ await importCustomWallpaper(parent);
+ await removeCustomWallpaper();
+ expect((await readClientWallpaperFile(official.url)).buffer).toEqual(Buffer.from(content));
+ expect((await listBlobFiles('client-wallpaper')).entries).toHaveLength(1);
+ });
it('rejects oversized or fake MP4 files without replacing the current image', async () => {
await selectImage();
diff --git a/apps/desktop/src/main/__tests__/wallpaperVideo.test.ts b/apps/desktop/src/main/__tests__/wallpaperVideo.test.ts
index 2e69b756d0..65df3668b8 100644
--- a/apps/desktop/src/main/__tests__/wallpaperVideo.test.ts
+++ b/apps/desktop/src/main/__tests__/wallpaperVideo.test.ts
@@ -27,6 +27,10 @@ vi.mock('../../shared/wallpaper-video-manifest.json', () => ({
sha256: m.hash,
image: { bytes: 3, sha256: m.hash },
},
+ 'cindy-whisper': {
+ delivery: 'cdn',
+ image: { bytes: 3, sha256: m.hash },
+ },
},
}));
vi.mock('../downloader/index.js', () => ({ createDownloader: () => m.download }));
@@ -66,6 +70,9 @@ function url(ext: string) {
}
describe('official wallpaper downloads', () => {
+ // User request 2026-10-17: still-only entries must use the existing verified
+ // downloader/cache, without inventing MP4 downloads. Unit tier; previous
+ // fixtures only represented scenes that always had both media kinds.
it('rejects arbitrary paths, URLs, prototype keys and unknown scenes before any IO', async () => {
for (const id of ['https://example/a.mp4', '../secret', 'constructor', 'none', null]) {
await expect(ensureWallpaperVideo(id)).rejects.toThrow('INVALID_PARAMS');
@@ -79,13 +86,11 @@ describe('official wallpaper downloads', () => {
expect(m.download).not.toHaveBeenCalled();
});
it.each([
- [ensureWallpaperVideo, '.mp4'],
- [ensureWallpaperImage, '.webp'],
- ] as const)('deduplicates windows and publishes verified %s media', async (ensure, ext) => {
- expect(await Promise.all([ensure('cindy-window'), ensure('cindy-window')])).toEqual([
- url(ext),
- url(ext),
- ]);
+ [ensureWallpaperVideo, '.mp4', 'cindy-window'],
+ [ensureWallpaperImage, '.webp', 'cindy-window'],
+ [ensureWallpaperImage, '.webp', 'cindy-whisper'],
+ ] as const)('deduplicates windows and publishes verified %s media', async (ensure, ext, id) => {
+ expect(await Promise.all([ensure(id), ensure(id)])).toEqual([url(ext), url(ext)]);
expect(m.download).toHaveBeenCalledOnce();
const options = m.download.mock.calls[0][0];
expect(options).toMatchObject({
@@ -103,6 +108,18 @@ describe('official wallpaper downloads', () => {
expect(fs.existsSync(path.dirname(options.targetPath))).toBe(false);
expect(m.recycle).toHaveBeenCalledWith([url('.mp4'), url('.webp')], ext);
});
+ it('reuses a still-only image offline and never requests a video for it', async () => {
+ expect(await ensureWallpaperVideo('cindy-whisper')).toBeNull();
+ expect(m.download).not.toHaveBeenCalled();
+ expect(m.endpoint).not.toHaveBeenCalled();
+ expect(await ensureWallpaperImage('cindy-whisper')).toBe(url('.webp'));
+ m.download.mockClear().mockRejectedValue(new Error('offline'));
+ m.endpoint.mockClear().mockReturnValue(null);
+ expect(await ensureWallpaperImage('cindy-whisper')).toBe(url('.webp'));
+ expect(m.download).not.toHaveBeenCalled();
+ expect(m.endpoint).not.toHaveBeenCalled();
+ expect((await readClientWallpaperFile(url('.webp'))).buffer.toString()).toBe('abc');
+ });
it('reuses both files after an app upgrade, module restart and loss of network configuration', async () => {
await ensureWallpaperVideo('cindy-window');
await ensureWallpaperImage('cindy-window');
@@ -110,6 +127,7 @@ describe('official wallpaper downloads', () => {
const oldPaths = ['.mp4', '.webp'].map(
(ext) => resolveHashRef(m.hash, ext, 'client-wallpaper').absPath,
);
+ // reset-modules: prove durable media reuse after a new app runtime loads.
vi.resetModules();
m.version = '2.0.0';
m.download.mockClear().mockRejectedValue(new Error('offline'));
diff --git a/apps/desktop/src/main/custom-wallpaper-settings.ts b/apps/desktop/src/main/custom-wallpaper-settings.ts
index 73edca72c0..c219b4b3e0 100644
--- a/apps/desktop/src/main/custom-wallpaper-settings.ts
+++ b/apps/desktop/src/main/custom-wallpaper-settings.ts
@@ -58,7 +58,7 @@ export function readReferencedClientWallpaperUrls(): string[] {
...Object.values(manifest)
.filter((item) => item.delivery === 'cdn')
.flatMap((item) => [
- blobUrl(item.sha256, '.mp4', 'client-wallpaper'),
+ ...('sha256' in item ? [blobUrl(item.sha256, '.mp4', 'client-wallpaper')] : []),
...(item.image ? [blobUrl(item.image.sha256, '.webp', 'client-wallpaper')] : []),
]),
].filter(Boolean);
diff --git a/apps/desktop/src/main/wallpaper-video.ts b/apps/desktop/src/main/wallpaper-video.ts
index 13d31add70..b230dc9764 100644
--- a/apps/desktop/src/main/wallpaper-video.ts
+++ b/apps/desktop/src/main/wallpaper-video.ts
@@ -16,7 +16,7 @@ import { readReferencedClientWallpaperUrls } from './custom-wallpaper-settings.j
import { createDownloader } from './downloader/index.js';
import { createLogger } from './logger.js';
-type Scene = keyof typeof manifest;
+type OfficialWallpaper = keyof typeof manifest;
type Asset = { sha256: string; bytes: number };
type ProgressBytes = Pick<WallpaperDownloadProgress, 'loaded' | 'total'>;
type Transfer = {
@@ -29,7 +29,7 @@ const pending = new Map<string, Transfer>();
const download = createDownloader();
const log = createLogger('wallpaper-assets');
-export function isWallpaperVideoScene(id: unknown): id is Scene {
+function isOfficialWallpaper(id: unknown): id is OfficialWallpaper {
return typeof id === 'string' && Object.hasOwn(manifest, id);
}
@@ -46,10 +46,11 @@ async function ensureWallpaperAsset(
kind: 'image' | 'video',
onProgress?: ProgressListener,
): Promise<string | null> {
- if (!isWallpaperVideoScene(id)) throwIpcError('INVALID_PARAMS', 'Unsupported wallpaper');
+ if (!isOfficialWallpaper(id)) throwIpcError('INVALID_PARAMS', 'Unsupported wallpaper');
const entry = manifest[id];
if (entry.delivery !== 'cdn') return null;
- const asset = kind === 'image' ? entry.image : entry;
+ const asset = kind === 'image' ? entry.image : 'sha256' in entry ? entry : null;
+ if (!asset) return null;
const ext = kind === 'image' ? '.webp' : '.mp4';
const key = asset.sha256 + ext;
let transfer = pending.get(key);
diff --git a/apps/desktop/src/renderer/components/settings/WallpaperSection.tsx b/apps/desktop/src/renderer/components/settings/WallpaperSection.tsx
index 9d133142d8..9e378dc1fa 100644
--- a/apps/desktop/src/renderer/components/settings/WallpaperSection.tsx
+++ b/apps/desktop/src/renderer/components/settings/WallpaperSection.tsx
@@ -10,7 +10,7 @@ import { Slider } from '@/components/ui/slider';
import { Tip } from '@/components/ui/tooltip';
import { cn } from '@/lib/utils';
import { useWallpaperSettings } from '@/hooks/useWallpaperSettings';
-import { getBuiltinWallpaperPreview, isSceneWallpaper } from '@/lib/wallpaper';
+import { getBuiltinWallpaperPreview, isCdnWallpaper, isSceneWallpaper } from '@/lib/wallpaper';
import {
APPEARANCE_LIMITS,
DEFAULT_APPEARANCE_SETTINGS,
@@ -62,8 +62,8 @@ export function WallpaperSection() {
};
}, [cancelBlurPreview, previewBlur]);
const customVideo = isCustomWallpaperVideo(customWallpaperUrl);
- const downloading = isSceneWallpaper(wallpaperId) && downloadPending;
- const retryable = isSceneWallpaper(wallpaperId) && downloadFailed && !downloadPending;
+ const downloading = isCdnWallpaper(wallpaperId) && downloadPending;
+ const retryable = isCdnWallpaper(wallpaperId) && downloadFailed && !downloadPending;
const chooseWallpaper = async () => {
setBusy(true);
setError('');
@@ -250,7 +250,7 @@ export function WallpaperSection() {
})}
</div>
- {/* Only the selected CDN scene downloads; the grid stays available while it loads. */}
+ {/* Only the selected wallpaper downloads; the grid stays available while it loads. */}
{downloading && (
<DownloadMeter
progress={{
diff --git a/apps/desktop/src/renderer/components/settings/__tests__/WallpaperSection.download.test.tsx b/apps/desktop/src/renderer/components/settings/__tests__/WallpaperSection.download.test.tsx
index 148f6a10bf..08ab6c9cbc 100644
--- a/apps/desktop/src/renderer/components/settings/__tests__/WallpaperSection.download.test.tsx
+++ b/apps/desktop/src/renderer/components/settings/__tests__/WallpaperSection.download.test.tsx
@@ -53,70 +53,83 @@ afterEach(() => {
});
describe('wallpaper download feedback', () => {
- it('shows progress for the selected CDN wallpaper while keeping its tile visible', () => {
- state.pending = true;
- const { rerender } = render(<WallpaperSection />);
- const status = screen.getByRole('progressbar', {
- name: 'settings.appearance.wallpaper.downloading',
- });
- expect(
- screen
- .getByRole('radio', {
- name: 'settings.appearance.wallpaper.options.cindy-window',
- })
- .getAttribute('aria-checked'),
- ).toBe('true');
- expect(screen.getAllByRole('progressbar')).toEqual([status]);
- expect(status.getAttribute('aria-valuenow')).toBe('0');
- for (const progress of [0.25, 0.75, 1]) {
- state.progress = progress;
- rerender(<WallpaperSection />);
- expect(status.getAttribute('aria-valuenow')).toBe(String(progress * 100));
+ // User request 2026-10-17: still-only originals share download progress/retry
+ // with scenes, but have no motion switch. Existing cases only exercised
+ // cindy-window; minimum additional input is cindy-whisper; unit tier.
+ it.each(['cindy-window', 'cindy-whisper'] as const)(
+ 'shows progress for %s while keeping its tile visible',
+ (id) => {
+ state.id = id;
+ state.pending = true;
+ const { rerender } = render(<WallpaperSection />);
+ const status = screen.getByRole('progressbar', {
+ name: 'settings.appearance.wallpaper.downloading',
+ });
expect(
- within(screen.getByRole('status')).getByText(String(progress * 100) + '%'),
- ).toBeTruthy();
- }
- state.pending = false;
- rerender(<WallpaperSection />);
- expect(screen.queryByRole('status')).toBeNull();
- expect(screen.queryByRole('progressbar')).toBeNull();
- });
+ screen
+ .getByRole('radio', {
+ name: 'settings.appearance.wallpaper.options.' + id,
+ })
+ .getAttribute('aria-checked'),
+ ).toBe('true');
+ expect(screen.getAllByRole('progressbar')).toEqual([status]);
+ if (id === 'cindy-whisper')
+ expect(screen.queryByText('settings.appearance.wallpaper.motionLabel')).toBeNull();
+ expect(status.getAttribute('aria-valuenow')).toBe('0');
+ for (const progress of [0.25, 0.75, 1]) {
+ state.progress = progress;
+ rerender(<WallpaperSection />);
+ expect(status.getAttribute('aria-valuenow')).toBe(String(progress * 100));
+ expect(
+ within(screen.getByRole('status')).getByText(String(progress * 100) + '%'),
+ ).toBeTruthy();
+ }
+ state.pending = false;
+ rerender(<WallpaperSection />);
+ expect(screen.queryByRole('status')).toBeNull();
+ expect(screen.queryByRole('progressbar')).toBeNull();
+ },
+ );
- it('keeps manual retry reachable for the selected scene and lets new tiles change selection', () => {
- state.failed = true;
- const { rerender } = render(<WallpaperSection />);
- expect(screen.getByRole('status').textContent).toContain('wallpaper.downloadFailed');
- fireEvent.click(
- screen.getByRole('button', {
- name: 'settings.appearance.wallpaper.retryDownload',
- }),
- );
- expect(state.retry).toHaveBeenCalledOnce();
- expect(state.select).not.toHaveBeenCalled();
- fireEvent.click(
- screen.getByRole('radio', {
- name: 'settings.appearance.wallpaper.options.cindy-whisper',
- }),
- );
- expect(state.select).toHaveBeenCalledWith('cindy-whisper');
- expect(state.retry).toHaveBeenCalledOnce();
+ it.each(['cindy-window', 'cindy-whisper'] as const)(
+ 'keeps manual retry reachable for %s and lets new tiles change selection',
+ (id) => {
+ state.id = id;
+ state.failed = true;
+ const { rerender } = render(<WallpaperSection />);
+ expect(screen.getByRole('status').textContent).toContain('wallpaper.downloadFailed');
+ fireEvent.click(
+ screen.getByRole('button', {
+ name: 'settings.appearance.wallpaper.retryDownload',
+ }),
+ );
+ expect(state.retry).toHaveBeenCalledOnce();
+ expect(state.select).not.toHaveBeenCalled();
+ fireEvent.click(
+ screen.getByRole('radio', {
+ name: 'settings.appearance.wallpaper.options.cindy-whisper',
+ }),
+ );
+ expect(state.select).toHaveBeenCalledWith('cindy-whisper');
+ expect(state.retry).toHaveBeenCalledOnce();
- state.pending = true;
- rerender(<WallpaperSection />);
- expect(
- screen.queryByRole('button', {
- name: 'settings.appearance.wallpaper.retryDownload',
- }),
- ).toBeNull();
- expect(screen.getByRole('progressbar')).toBeTruthy();
- state.pending = false;
- state.failed = false;
- rerender(<WallpaperSection />);
- expect(screen.queryByRole('status')).toBeNull();
- });
+ state.pending = true;
+ rerender(<WallpaperSection />);
+ expect(
+ screen.queryByRole('button', {
+ name: 'settings.appearance.wallpaper.retryDownload',
+ }),
+ ).toBeNull();
+ expect(screen.getByRole('progressbar')).toBeTruthy();
+ state.pending = false;
+ state.failed = false;
+ rerender(<WallpaperSection />);
+ expect(screen.queryByRole('status')).toBeNull();
+ },
+ );
- it('does not show stale CDN feedback over an offline still', () => {
- state.id = 'cindy-whisper';
+ it('does not show stale CDN feedback when no wallpaper is selected', () => {
+ state.id = 'none';
state.pending = true;
state.failed = true;
render(<WallpaperSection />);
@@ -130,7 +143,7 @@ describe('wallpaper download feedback', () => {
expect(
screen
.getByRole('radio', {
- name: 'settings.appearance.wallpaper.options.cindy-whisper',
+ name: 'settings.appearance.wallpaper.options.none',
})
.getAttribute('aria-checked'),
).toBe('true');
diff --git a/apps/desktop/src/renderer/hooks/__tests__/useWallpaperAsset.test.tsx b/apps/desktop/src/renderer/hooks/__tests__/useWallpaperAsset.test.tsx
index a26a110e55..3454f7b9f4 100644
--- a/apps/desktop/src/renderer/hooks/__tests__/useWallpaperAsset.test.tsx
+++ b/apps/desktop/src/renderer/hooks/__tests__/useWallpaperAsset.test.tsx
@@ -2,11 +2,7 @@
import { act, cleanup, renderHook, waitFor } from '@testing-library/react';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { useWallpaperAsset } from '../useWallpaperAsset';
-import {
- SELECTABLE_WALLPAPER_IDS,
- type WallpaperId,
- type WallpaperDownloadProgress,
-} from '@/../shared/appearanceSettings';
+import { type WallpaperId, type WallpaperDownloadProgress } from '@/../shared/appearanceSettings';
import manifest from '@/../shared/wallpaper-video-manifest.json';
const image = vi.fn();
@@ -85,22 +81,24 @@ describe('on-demand wallpaper assets', () => {
unmount();
expect(progressListeners.size).toBe(0);
});
- it('keeps the current still catalog offline and downloads only selected manifest-backed media', async () => {
+ // User request 2026-10-17: selecting a still now downloads its image, while
+ // inactive images and still-only videos stay idle. Existing scene-only tests
+ // missed that distinction. Minimal input: one selected static ID; unit tier.
+ it('downloads only selected and visible media and never requests a still-only video', async () => {
const { rerender } = renderHook(
({ id, enabled }: { id: WallpaperId; enabled: boolean }) => {
- useWallpaperAsset(id, 'image', true);
+ useWallpaperAsset(id, 'image', enabled);
return useWallpaperAsset(id, 'video', enabled);
},
{ initialProps: { id: 'none' as WallpaperId, enabled: false } },
);
- for (const id of SELECTABLE_WALLPAPER_IDS) {
- if (!Object.hasOwn(manifest, id)) rerender({ id, enabled: true });
- }
+ rerender({ id: 'custom', enabled: true });
+ rerender({ id: 'wheatfield-watch', enabled: false });
expect(image).not.toHaveBeenCalled();
expect(video).not.toHaveBeenCalled();
- rerender({ id: 'cindy-window', enabled: false });
+ rerender({ id: 'wheatfield-watch', enabled: true });
await waitFor(() => expect(decode).toHaveBeenCalledOnce());
- expect(image).toHaveBeenCalledWith('cindy-window');
+ expect(image).toHaveBeenCalledWith('wheatfield-watch');
expect(video).not.toHaveBeenCalled();
rerender({ id: 'cindy-window', enabled: true });
await waitFor(() => expect(video).toHaveBeenCalledOnce());
diff --git a/apps/desktop/src/renderer/hooks/__tests__/useWallpaperSettings.test.tsx b/apps/desktop/src/renderer/hooks/__tests__/useWallpaperSettings.test.tsx
index 6240afc935..89ae4f6c4c 100644
--- a/apps/desktop/src/renderer/hooks/__tests__/useWallpaperSettings.test.tsx
+++ b/apps/desktop/src/renderer/hooks/__tests__/useWallpaperSettings.test.tsx
@@ -41,12 +41,16 @@ afterEach(() => {
});
describe('application wallpaper lifecycle', () => {
- it('switches from a pending CDN scene to an offline still without using the late download', async () => {
- let finish!: (url: string) => void;
+ // User request 2026-10-17: static originals now load asynchronously too.
+ // Preserve the selected preview when the previous scene completes late, then
+ // show the selected CDN still. This extends the former offline-only case;
+ // minimum input: scene -> still with out-of-order completion; unit tier.
+ it('switches from a pending scene to a CDN still without using the late scene download', async () => {
+ const finishes = new Map<string, (url: string) => void>();
const ensureImage = vi.fn(
- () =>
+ (id: string) =>
new Promise<string>((resolve) => {
- finish = resolve;
+ finishes.set(id, resolve);
}),
);
const ensureVideo = vi.fn();
@@ -80,9 +84,14 @@ describe('application wallpaper lifecycle', () => {
const background = () =>
document.documentElement.style.getPropertyValue('--app-wallpaper-image');
expect(background()).toContain('cindy-whisper.webp');
- await act(async () => finish(`cindy-media://client-wallpaper/${'a'.repeat(64)}.webp`));
+ await act(async () =>
+ finishes.get('cindy-window')!(`cindy-media://client-wallpaper/${'a'.repeat(64)}.webp`),
+ );
expect(background()).toContain('cindy-whisper.webp');
- expect(ensureImage).toHaveBeenCalledTimes(1);
+ const stillUrl = `cindy-media://client-wallpaper/${'b'.repeat(64)}.webp`;
+ await act(async () => finishes.get('cindy-whisper')!(stillUrl));
+ expect(background()).toContain(stillUrl);
+ expect(ensureImage).toHaveBeenCalledTimes(2);
expect(ensureVideo).not.toHaveBeenCalled();
});
diff --git a/apps/desktop/src/renderer/hooks/useWallpaperAsset.ts b/apps/desktop/src/renderer/hooks/useWallpaperAsset.ts
index 98f9d3908a..4581ed0a77 100644
--- a/apps/desktop/src/renderer/hooks/useWallpaperAsset.ts
+++ b/apps/desktop/src/renderer/hooks/useWallpaperAsset.ts
@@ -1,6 +1,6 @@
import { useCallback, useEffect, useState } from 'react';
import type { WallpaperId } from '@/../shared/appearanceSettings';
-import { isSceneWallpaper } from '@/lib/wallpaper';
+import { isCdnWallpaper } from '@/lib/wallpaper';
import manifest from '@/../shared/wallpaper-video-manifest.json';
type AssetState = {
@@ -16,9 +16,10 @@ export function useWallpaperAsset(id: WallpaperId, kind: 'image' | 'video', enab
const [state, setState] = useState<AssetState | null>(null);
const [attempt, setAttempt] = useState(0);
const retry = useCallback(() => setAttempt((value) => value + 1), []);
- const active = enabled && isSceneWallpaper(id);
- const entry = isSceneWallpaper(id) ? manifest[id] : null;
- const total = entry ? (kind === 'image' ? entry.image.bytes : entry.bytes) : 0;
+ const entry = isCdnWallpaper(id) ? manifest[id] : null;
+ const videoBytes = entry && 'bytes' in entry && typeof entry.bytes === 'number' ? entry.bytes : 0;
+ const total = kind === 'image' ? (entry?.image.bytes ?? 0) : videoBytes;
+ const active = enabled && total > 0;
const url = state?.key === key ? state.url : null;
useEffect(() => {
diff --git a/apps/desktop/src/renderer/lib/wallpaper.ts b/apps/desktop/src/renderer/lib/wallpaper.ts
index 6c51fc9592..c38c7e3c06 100644
--- a/apps/desktop/src/renderer/lib/wallpaper.ts
+++ b/apps/desktop/src/renderer/lib/wallpaper.ts
@@ -1,68 +1,50 @@
import type { WallpaperId } from '@/../shared/appearanceSettings';
-import sceneManifest from '@/../shared/wallpaper-video-manifest.json';
+import wallpaperManifest from '@/../shared/wallpaper-video-manifest.json';
import cindyWindow from '@/assets/wallpapers/previews/cindy-window.webp';
import cindyStudio from '@/assets/wallpapers/previews/cindy-studio.webp';
import cindyDream from '@/assets/wallpapers/previews/cindy-dream.webp';
-import cindyWhisper from '@/assets/wallpapers/cindy-whisper.webp';
-import cindyNeon from '@/assets/wallpapers/cindy-neon.webp';
-import cindyPrism from '@/assets/wallpapers/cindy-prism.webp';
-import cindyCrimson from '@/assets/wallpapers/cindy-crimson.webp';
-import cindyNightGlance from '@/assets/wallpapers/cindy-night-glance.webp';
-import cindyScarletStroll from '@/assets/wallpapers/cindy-scarlet-stroll.webp';
-import cloudRoaming from '@/assets/wallpapers/cloud-roaming.webp';
-import nightLaunch from '@/assets/wallpapers/night-launch.webp';
-import stardustVortex from '@/assets/wallpapers/stardust-vortex.webp';
-import silentOrbits from '@/assets/wallpapers/silent-orbits.webp';
-import duneDawn from '@/assets/wallpapers/dune-dawn.webp';
-import planetDawn from '@/assets/wallpapers/planet-dawn.webp';
-import neonValley from '@/assets/wallpapers/neon-valley.webp';
-import silentCircuit from '@/assets/wallpapers/silent-circuit.webp';
-import indigoFolds from '@/assets/wallpapers/indigo-folds.webp';
-import wheatfieldWatch from '@/assets/wallpapers/wheatfield-watch.webp';
-import moonSolitude from '@/assets/wallpapers/moon-solitude.webp';
-import teacupCat from '@/assets/wallpapers/teacup-cat.webp';
-import duneSphere from '@/assets/wallpapers/dune-sphere.webp';
-import amberLight from '@/assets/wallpapers/amber-light.webp';
-import oceanClouds from '@/assets/wallpapers/ocean-clouds.webp';
-import blushLeaves from '@/assets/wallpapers/blush-leaves.webp';
-import whiteWilderness from '@/assets/wallpapers/white-wilderness.webp';
-import blueGaze from '@/assets/wallpapers/blue-gaze.webp';
-import roseQuartz from '@/assets/wallpapers/rose-quartz.webp';
-import silverVeins from '@/assets/wallpapers/silver-veins.webp';
-import dawnArc from '@/assets/wallpapers/dawn-arc.webp';
-import tidalLines from '@/assets/wallpapers/tidal-lines.webp';
-import cindyWhisperThumbnail from '@/assets/wallpapers/thumbnails/cindy-whisper.webp';
-import cindyNeonThumbnail from '@/assets/wallpapers/thumbnails/cindy-neon.webp';
-import cindyPrismThumbnail from '@/assets/wallpapers/thumbnails/cindy-prism.webp';
-import cindyCrimsonThumbnail from '@/assets/wallpapers/thumbnails/cindy-crimson.webp';
-import cindyNightGlanceThumbnail from '@/assets/wallpapers/thumbnails/cindy-night-glance.webp';
-import cindyScarletStrollThumbnail from '@/assets/wallpapers/thumbnails/cindy-scarlet-stroll.webp';
-import cloudRoamingThumbnail from '@/assets/wallpapers/thumbnails/cloud-roaming.webp';
-import nightLaunchThumbnail from '@/assets/wallpapers/thumbnails/night-launch.webp';
-import stardustVortexThumbnail from '@/assets/wallpapers/thumbnails/stardust-vortex.webp';
-import silentOrbitsThumbnail from '@/assets/wallpapers/thumbnails/silent-orbits.webp';
-import duneDawnThumbnail from '@/assets/wallpapers/thumbnails/dune-dawn.webp';
-import planetDawnThumbnail from '@/assets/wallpapers/thumbnails/planet-dawn.webp';
-import neonValleyThumbnail from '@/assets/wallpapers/thumbnails/neon-valley.webp';
-import silentCircuitThumbnail from '@/assets/wallpapers/thumbnails/silent-circuit.webp';
-import indigoFoldsThumbnail from '@/assets/wallpapers/thumbnails/indigo-folds.webp';
-import wheatfieldWatchThumbnail from '@/assets/wallpapers/thumbnails/wheatfield-watch.webp';
-import moonSolitudeThumbnail from '@/assets/wallpapers/thumbnails/moon-solitude.webp';
-import teacupCatThumbnail from '@/assets/wallpapers/thumbnails/teacup-cat.webp';
-import duneSphereThumbnail from '@/assets/wallpapers/thumbnails/dune-sphere.webp';
-import amberLightThumbnail from '@/assets/wallpapers/thumbnails/amber-light.webp';
-import oceanCloudsThumbnail from '@/assets/wallpapers/thumbnails/ocean-clouds.webp';
-import blushLeavesThumbnail from '@/assets/wallpapers/thumbnails/blush-leaves.webp';
-import whiteWildernessThumbnail from '@/assets/wallpapers/thumbnails/white-wilderness.webp';
-import blueGazeThumbnail from '@/assets/wallpapers/thumbnails/blue-gaze.webp';
-import roseQuartzThumbnail from '@/assets/wallpapers/thumbnails/rose-quartz.webp';
-import silverVeinsThumbnail from '@/assets/wallpapers/thumbnails/silver-veins.webp';
-import dawnArcThumbnail from '@/assets/wallpapers/thumbnails/dawn-arc.webp';
-import tidalLinesThumbnail from '@/assets/wallpapers/thumbnails/tidal-lines.webp';
+import cindyWhisper from '@/assets/wallpapers/thumbnails/cindy-whisper.webp';
+import cindyNeon from '@/assets/wallpapers/thumbnails/cindy-neon.webp';
+import cindyPrism from '@/assets/wallpapers/thumbnails/cindy-prism.webp';
+import cindyCrimson from '@/assets/wallpapers/thumbnails/cindy-crimson.webp';
+import cindyNightGlance from '@/assets/wallpapers/thumbnails/cindy-night-glance.webp';
+import cindyScarletStroll from '@/assets/wallpapers/thumbnails/cindy-scarlet-stroll.webp';
+import cloudRoaming from '@/assets/wallpapers/thumbnails/cloud-roaming.webp';
+import nightLaunch from '@/assets/wallpapers/thumbnails/night-launch.webp';
+import stardustVortex from '@/assets/wallpapers/thumbnails/stardust-vortex.webp';
+import silentOrbits from '@/assets/wallpapers/thumbnails/silent-orbits.webp';
+import duneDawn from '@/assets/wallpapers/thumbnails/dune-dawn.webp';
+import planetDawn from '@/assets/wallpapers/thumbnails/planet-dawn.webp';
+import neonValley from '@/assets/wallpapers/thumbnails/neon-valley.webp';
+import silentCircuit from '@/assets/wallpapers/thumbnails/silent-circuit.webp';
+import indigoFolds from '@/assets/wallpapers/thumbnails/indigo-folds.webp';
+import wheatfieldWatch from '@/assets/wallpapers/thumbnails/wheatfield-watch.webp';
+import moonSolitude from '@/assets/wallpapers/thumbnails/moon-solitude.webp';
+import teacupCat from '@/assets/wallpapers/thumbnails/teacup-cat.webp';
+import duneSphere from '@/assets/wallpapers/thumbnails/dune-sphere.webp';
+import amberLight from '@/assets/wallpapers/thumbnails/amber-light.webp';
+import oceanClouds from '@/assets/wallpapers/thumbnails/ocean-clouds.webp';
+import blushLeaves from '@/assets/wallpapers/thumbnails/blush-leaves.webp';
+import whiteWilderness from '@/assets/wallpapers/thumbnails/white-wilderness.webp';
+import blueGaze from '@/assets/wallpapers/thumbnails/blue-gaze.webp';
+import roseQuartz from '@/assets/wallpapers/thumbnails/rose-quartz.webp';
+import silverVeins from '@/assets/wallpapers/thumbnails/silver-veins.webp';
+import dawnArc from '@/assets/wallpapers/thumbnails/dawn-arc.webp';
+import tidalLines from '@/assets/wallpapers/thumbnails/tidal-lines.webp';
-/** Only manifest-backed scenes use the main-process downloader; local stills stay offline. */
-export function isSceneWallpaper(id: WallpaperId): id is keyof typeof sceneManifest {
- return Object.hasOwn(sceneManifest, id);
+/** All official originals use the main-process downloader; only previews are bundled. */
+export function isCdnWallpaper(id: WallpaperId): id is keyof typeof wallpaperManifest {
+ return (
+ Object.hasOwn(wallpaperManifest, id) &&
+ wallpaperManifest[id as keyof typeof wallpaperManifest].delivery === 'cdn'
+ );
+}
+
+export function isSceneWallpaper(id: WallpaperId): boolean {
+ return (
+ Object.hasOwn(wallpaperManifest, id) &&
+ 'sha256' in wallpaperManifest[id as keyof typeof wallpaperManifest]
+ );
}
/** Decorative artwork; the application applies a theme-derived readability veil. */
@@ -104,38 +86,6 @@ export function getBuiltinWallpaperBackground(id: WallpaperId): string | undefin
return BUILTIN_WALLPAPER_BACKGROUNDS[id];
}
-/** Picker previews avoid decoding every full-resolution still at once. */
-const BUILTIN_WALLPAPER_THUMBNAILS: Partial<Record<WallpaperId, string>> = {
- 'cindy-whisper': `url("${cindyWhisperThumbnail}")`,
- 'cindy-neon': `url("${cindyNeonThumbnail}")`,
- 'cindy-prism': `url("${cindyPrismThumbnail}")`,
- 'cindy-crimson': `url("${cindyCrimsonThumbnail}")`,
- 'cindy-night-glance': `url("${cindyNightGlanceThumbnail}")`,
- 'cindy-scarlet-stroll': `url("${cindyScarletStrollThumbnail}")`,
- 'cloud-roaming': `url("${cloudRoamingThumbnail}")`,
- 'night-launch': `url("${nightLaunchThumbnail}")`,
- 'stardust-vortex': `url("${stardustVortexThumbnail}")`,
- 'silent-orbits': `url("${silentOrbitsThumbnail}")`,
- 'dune-dawn': `url("${duneDawnThumbnail}")`,
- 'planet-dawn': `url("${planetDawnThumbnail}")`,
- 'neon-valley': `url("${neonValleyThumbnail}")`,
- 'silent-circuit': `url("${silentCircuitThumbnail}")`,
- 'indigo-folds': `url("${indigoFoldsThumbnail}")`,
- 'wheatfield-watch': `url("${wheatfieldWatchThumbnail}")`,
- 'moon-solitude': `url("${moonSolitudeThumbnail}")`,
- 'teacup-cat': `url("${teacupCatThumbnail}")`,
- 'dune-sphere': `url("${duneSphereThumbnail}")`,
- 'amber-light': `url("${amberLightThumbnail}")`,
- 'ocean-clouds': `url("${oceanCloudsThumbnail}")`,
- 'blush-leaves': `url("${blushLeavesThumbnail}")`,
- 'white-wilderness': `url("${whiteWildernessThumbnail}")`,
- 'blue-gaze': `url("${blueGazeThumbnail}")`,
- 'rose-quartz': `url("${roseQuartzThumbnail}")`,
- 'silver-veins': `url("${silverVeinsThumbnail}")`,
- 'dawn-arc': `url("${dawnArcThumbnail}")`,
- 'tidal-lines': `url("${tidalLinesThumbnail}")`,
-};
-
export function getBuiltinWallpaperPreview(id: WallpaperId): string | undefined {
- return BUILTIN_WALLPAPER_THUMBNAILS[id] ?? getBuiltinWallpaperBackground(id);
+ return getBuiltinWallpaperBackground(id);
}
diff --git a/apps/desktop/src/shared/wallpaper-video-manifest.json b/apps/desktop/src/shared/wallpaper-video-manifest.json
index 3288322465..37252e4ca6 100644
--- a/apps/desktop/src/shared/wallpaper-video-manifest.json
+++ b/apps/desktop/src/shared/wallpaper-video-manifest.json
@@ -37,5 +37,201 @@
"sha256": "2a2043b9207c7dfaaed5951b567eba1eb24aeb192c3eb78a3c0ee9a46a732361",
"bytes": 1790734
}
+ },
+ "cindy-whisper": {
+ "delivery": "cdn",
+ "image": {
+ "sha256": "20c6046e462d514b7fc7d4d5b30351c510f395915bb91fdbd23d8e3cd61ba24d",
+ "bytes": 570506
+ }
+ },
+ "cindy-neon": {
+ "delivery": "cdn",
+ "image": {
+ "sha256": "e8a38fc4e291e7f3930d1cafd6d0cf73c141be150ffac783754ec83fd28e2069",
+ "bytes": 192046
+ }
+ },
+ "cindy-prism": {
+ "delivery": "cdn",
+ "image": {
+ "sha256": "84c73fc02a1232e7178ad22a6034c003f5d657c79f3db2199ae25a1a3b1c5d83",
+ "bytes": 369734
+ }
+ },
+ "cindy-crimson": {
+ "delivery": "cdn",
+ "image": {
+ "sha256": "6c5e7c5b21d398745ea833df21e3d6ab32aba12fbbb40ae0d7c73eed69cc0dc9",
+ "bytes": 376348
+ }
+ },
+ "cindy-night-glance": {
+ "delivery": "cdn",
+ "image": {
+ "sha256": "091d6d0ad4c64c6d658cce219f35fe72021e3af849512d2cb8c50bdeeb37315d",
+ "bytes": 799156
+ }
+ },
+ "cindy-scarlet-stroll": {
+ "delivery": "cdn",
+ "image": {
+ "sha256": "4cecd5b6ebefdc298c881eb17f56445565eea45ebb189dac8b8dc1ed01bb5c7c",
+ "bytes": 677244
+ }
+ },
+ "cloud-roaming": {
+ "delivery": "cdn",
+ "image": {
+ "sha256": "36ad77734856a34d4d21c89a8abb62cfbd2dc977d937e0a19ae04183aa8b7ab1",
+ "bytes": 186442
+ }
+ },
+ "night-launch": {
+ "delivery": "cdn",
+ "image": {
+ "sha256": "81b6f3807eea9cb989b8873c6daea2345d2fcfb7b6ad03dfdc0f9d73bdeef82f",
+ "bytes": 406080
+ }
+ },
+ "stardust-vortex": {
+ "delivery": "cdn",
+ "image": {
+ "sha256": "15961306156ff0d408598dc9679034186ebd0a4a2e424a45a9a90ff565cb7e6b",
+ "bytes": 480212
+ }
+ },
+ "silent-orbits": {
+ "delivery": "cdn",
+ "image": {
+ "sha256": "21a4135ae41e7f75f7e4829dce467041bab8c733cdbf588cb76b7605adcc1e75",
+ "bytes": 710060
+ }
+ },
+ "dune-dawn": {
+ "delivery": "cdn",
+ "image": {
+ "sha256": "070c9dc925c3a71eb8623db363a3c60d625dae5067446c99c7a179deacecdeee",
+ "bytes": 282116
+ }
+ },
+ "planet-dawn": {
+ "delivery": "cdn",
+ "image": {
+ "sha256": "5c0034d6e9e0d341b737568600d70cb8511dfe45aca232b5ad5676d93310a76b",
+ "bytes": 404226
+ }
+ },
+ "neon-valley": {
+ "delivery": "cdn",
+ "image": {
+ "sha256": "04dd0f82c890904f47c1198319375c69cfb62ad72e435d65133b6b56f57396e8",
+ "bytes": 655006
+ }
+ },
+ "silent-circuit": {
+ "delivery": "cdn",
+ "image": {
+ "sha256": "cad7e877de6c66e711ec2a80cc3f4316a539cdd7694cedf33177bfb6ad27fd11",
+ "bytes": 325584
+ }
+ },
+ "indigo-folds": {
+ "delivery": "cdn",
+ "image": {
+ "sha256": "21cb022d1a492809e1c3e2de99e0f4ec697174846c00d3d2a39c04e1643ae2f9",
+ "bytes": 323432
+ }
+ },
+ "wheatfield-watch": {
+ "delivery": "cdn",
+ "image": {
+ "sha256": "ae68d0404576c5df0aa5b9e7505737443b93a08c747efab71749b86b659a1880",
+ "bytes": 897422
+ }
+ },
+ "moon-solitude": {
+ "delivery": "cdn",
+ "image": {
+ "sha256": "efc5b241a1000d5bcc5edb5eff2eeb2e359f211ae23fa34c5886af0820f1693f",
+ "bytes": 477252
+ }
+ },
+ "teacup-cat": {
+ "delivery": "cdn",
+ "image": {
+ "sha256": "73ba1f2175ff328230bec093857c0138b7e5018a9a2fea05b26acfeb39be6f7f",
+ "bytes": 697458
+ }
+ },
+ "dune-sphere": {
+ "delivery": "cdn",
+ "image": {
+ "sha256": "5ebc0912b68fd41d4908fc0364841d8a468a401498d3adc7ea2ebd90e0a38eb6",
+ "bytes": 381164
+ }
+ },
+ "amber-light": {
+ "delivery": "cdn",
+ "image": {
+ "sha256": "08209831fc2a495b878021862ebc6cd6e036b3509ca7fdcb2e21e81ddf12b0ed",
+ "bytes": 547930
+ }
+ },
+ "ocean-clouds": {
+ "delivery": "cdn",
+ "image": {
+ "sha256": "d7852f5046786e9d7f7bf7b28cf5f7bd4c92731a21a2bc8513591c71c09ebc94",
+ "bytes": 261362
+ }
+ },
+ "blush-leaves": {
+ "delivery": "cdn",
+ "image": {
+ "sha256": "1bfea5c8b698ba469f20494748a4757bef5f289fe1152752f119385e998fe1cb",
+ "bytes": 322246
+ }
+ },
+ "white-wilderness": {
+ "delivery": "cdn",
+ "image": {
+ "sha256": "384009a1ccf1a1310f0318c872161cff2521c2f3aef62b5d4e8d3a312725ed13",
+ "bytes": 256524
+ }
+ },
+ "blue-gaze": {
+ "delivery": "cdn",
+ "image": {
+ "sha256": "aa6cc107f477927b344fa5b39e523ac2ca61f85d64f80c164fc64478aa5e4a6b",
+ "bytes": 182562
+ }
+ },
+ "rose-quartz": {
+ "delivery": "cdn",
+ "image": {
+ "sha256": "c627ee2ae28c87f19d19cedf4c89002c1a69864d5982e1173fa730eebe41346a",
+ "bytes": 622300
+ }
+ },
+ "silver-veins": {
+ "delivery": "cdn",
+ "image": {
+ "sha256": "d824fcacb3bf3627da9eeb27aa9a30451928be9db4997ae1cac6a2bc407a29d0",
+ "bytes": 347328
+ }
+ },
+ "dawn-arc": {
+ "delivery": "cdn",
+ "image": {
+ "sha256": "76819a854079bc84c7d7420b3d2821300f64c0084927778bb06571c78ce3257c",
+ "bytes": 400652
+ }
+ },
+ "tidal-lines": {
+ "delivery": "cdn",
+ "image": {
+ "sha256": "cf5d38c78dc0da45e5092ef21eff75c3b23f0bbbf1923a7848abd21d8a5e06b0",
+ "bytes": 606158
+ }
}
}
diff --git a/docs/design-rules/DESIGN.md b/docs/design-rules/DESIGN.md
index 9591fbe271..0f922c5101 100644
--- a/docs/design-rules/DESIGN.md
+++ b/docs/design-rules/DESIGN.md
@@ -79,15 +79,17 @@ Verify actual Light/Dark screenshots across host pages and the expanded tool pan
The built-in picker retains Window Companion, Future Atelier and Dream Wander,
with their Static / Dynamic choice, alongside 26 supplied still images: character,
cat, landscape, space and abstract artworks (user curation, 2026-10-16). The supplied
-stills ship as metadata-free WebP at their source resolution, with separate lightweight
-thumbnails. Blue Gaze and Amber Light are hidden from the picker.
+stills use metadata-free WebP at their source resolution, delivered on demand from
+the CDN (user decision, 2026-10-17). Only lightweight thumbnails and the three scene
+previews ship with the app. Blue Gaze and Amber Light are hidden from the picker.
Previously saved selections keep their artwork and motion behavior;
removing a catalog choice does not rewrite appearance preferences or delete source images.
-The original three scenes retain mainline on-demand image/video downloads, verified
-cache reuse, and preview fallback. Their download progress and retry action appear
+All official images share the existing on-demand downloader, verified cache reuse,
+and preview fallback; only the original three scenes offer video. Download progress and retry appear
below the grid when needed while the thumbnails remain available for selection.
-Reuse the settings DownloadMeter; keep all new stills offline
-and do not request CDN assets for IDs absent from the download manifest.
+Reuse the settings DownloadMeter. Browsing the grid or hiding the wallpaper does not
+download originals; only a selected, visible image is requested. Reuse valid cached
+images offline and after upgrades. Do not request CDN assets for IDs absent from the manifest.
The original three scenes lead the Cindy group, followed by Whisper, Crimson Realm, Night Glance, Scarlet Stroll,
Neon Silhouette, Prism Shards, followed by the two cat wallpapers Wheatfield Watch
and Teacup Cat. Other artwork follows this group; Moon Gazer (formerly Giant Moon Platform) sits
diff --git a/docs/dev-rules/media-storage-and-protocols.md b/docs/dev-rules/media-storage-and-protocols.md
index 54c07a2c96..05bf6b7fcb 100644
--- a/docs/dev-rules/media-storage-and-protocols.md
+++ b/docs/dev-rules/media-storage-and-protocols.md
@@ -96,9 +96,12 @@
回归见 `remoteMediaPersistentCache.test.ts`、`remoteMediaProtocol.test.ts` 与 `storageIpc.test.ts`。
- 零引用入仓只适用于已有草稿或生成结果提交链路。新增零引用窗口时,必须证明内容在消息
落库前不会被回收,并用测试覆盖成功、失败、取消和重试。
-- 三款官方壁纸改为 OSS/CDN 按需分发(2026-10-15 用户裁决,替代此前全部随包的决定)。
- 包内仅保留 `renderer/assets/wallpapers/previews/` 中的 640×400 WebP;原始高清图和
- 2304×1440 MP4 保留为发布输入,不进入 Renderer 资源依赖图。默认无壁纸和浏览设置列表不下载,
+- 所有官方壁纸原图均为 OSS/CDN 按需分发(2026-10-17 用户裁决,将三款场景的已有下载链路
+ 扩展到其余静态图片,替代静态原图随包的决定)。包内仅保留
+ `renderer/assets/wallpapers/previews/` 中的三款 640×400 WebP 与 `thumbnails/` 中的静态缩略图;
+ 原始高清图和 2304×1440 MP4 保留为发布输入,不进入 Renderer 资源依赖图。
+ 清单中静态条目只有 `delivery` 与 `image`,顶层视频元数据仅用于三款动态场景;
+ 静态条目不暴露动态选项、不下载视频。默认无壁纸和浏览设置列表不下载,
选中且可见时下载对应高清图,动态模式且未启用减少动态效果时再下载视频;下载或解码失败保留可用背景。
传输复用统一下载器并保留 guardedOutboundFetch 的来源校验,清单大小及 SHA-256 校验后入仓。
缓存位于既有 `userData/cindy-media/client-wallpaper/`,仅以内容哈希和扩展名寻址,
@@ -109,11 +112,14 @@
`customWallpaper.test.ts` 覆盖自定义媒体操作不误删官方图片和视频。
发布脚本默认核验仓内原始素材,`--directory` 也接受按 hash 命名的导出目录或旧 `-hd.mp4` 输入。
`node scripts/publish-wallpaper-videos.mjs --verify-only` 离线核验;
- `node scripts/publish-wallpaper-videos.mjs --check-cdn --region=global` 只读校验线上六个文件;
+ `node scripts/publish-wallpaper-videos.mjs --check-cdn --region=global` 只读校验清单全部线上文件;
实际发布使用 `node --env-file=<发布配置> scripts/publish-wallpaper-videos.mjs --region=global`。
- 中国大陆版显式用 `--region=cn`,两区分别发布并校验,资源先于客户端上线。
- 对象名为 `wallpapers/<sha256>.webp` / `.mp4`;缩略图可用
- `node scripts/prepare-wallpaper-previews.mjs` 从原始图片重建,总预算 300 KiB。
+ 中国大陆版显式用 `--region=cn`,内部 dev 环境显式用 `--region=dev`;三个环境分别发布并校验,
+ 资源先于对应客户端上线。只读校验优先读取本环境的 `XDT_GLOBAL_CDN_BASE_URL` / `XDT_CDN_BASE_URL` /
+ `XDT_DEVCH_CDN_BASE_URL`,未配置时读取对应 endpoint 文件;dev 不回落到生产配置。
+ 对象名为 `wallpapers/<sha256>.webp` / `.mp4`;三款场景预览图可用
+ `node scripts/prepare-wallpaper-previews.mjs` 从原始图片重建,该组三张图的总预算为 300 KiB。
+ 静态缩略图复用现有 `thumbnails/`,当前随包预览资源合计约 0.55 MiB。
清单见 Desktop 的 `src/shared/wallpaper-video-manifest.json`。
- 伙伴头像的本机副本(2026-10-17 用户裁决:读过的头像在本机缓存一份,显示前先读缓存):另一台电脑上
伙伴的 `cindy-media://blobs/…` 头像与云端伙伴身份的 `https://` 公开头像,经 `companion-cloud/avatarCache.ts`
diff --git a/scripts/publish-wallpaper-videos.mjs b/scripts/publish-wallpaper-videos.mjs
index 4b4a4df9b9..fe6f1a3d11 100644
--- a/scripts/publish-wallpaper-videos.mjs
+++ b/scripts/publish-wallpaper-videos.mjs
@@ -16,9 +16,9 @@ const region =
const directory = args.find((arg) => arg.startsWith("--directory="))?.slice(12);
const verifyOnly = args.includes("--verify-only");
const checkCdn = args.includes("--check-cdn");
-if (!["global", "cn"].includes(region)) {
+if (!["global", "cn", "dev"].includes(region)) {
throw new Error(
- "Usage: node scripts/publish-wallpaper-videos.mjs [--directory=<originals>] --region=global|cn [--verify-only | --check-cdn]",
+ "Usage: node scripts/publish-wallpaper-videos.mjs [--directory=<originals>] --region=global|cn|dev [--verify-only | --check-cdn]",
);
}
const source =
@@ -40,7 +40,7 @@ for (const [id, entry] of Object.entries(manifest)) {
if (!["bundled", "cdn"].includes(entry.delivery))
throw new Error("Unknown wallpaper delivery: " + id);
for (const [asset, ext, mime] of [
- [entry, ".mp4", "video/mp4"],
+ [entry.sha256 ? entry : null, ".mp4", "video/mp4"],
[entry.image, ".webp", "image/webp"],
]) {
if (!asset) continue;
@@ -69,7 +69,8 @@ for (const [id, entry] of Object.entries(manifest)) {
createHash("sha256").update(bytes).digest("hex") !== asset.sha256
)
throw new Error("Asset differs from reviewed manifest: " + id + ext);
- if (entry.delivery === "cdn") assets.push({ file, ...asset, ext, mime });
+ if (entry.delivery === "cdn")
+ assets.push({ id, file, ...asset, ext, mime });
console.log(id + ext + ": " + asset.bytes + " bytes");
}
}
@@ -80,17 +81,32 @@ console.log(
);
if (checkCdn || !verifyOnly) {
// Read-only verification needs no OSS credentials and never uploads.
- const endpointFile =
- region === "global" ? "endpoint.global.json" : "endpoint.json";
- const endpoint = JSON.parse(
- await fs.readFile(
- new URL("../config/" + endpointFile, import.meta.url),
- "utf8",
- ),
- );
- const config = checkCdn
- ? { cdnBase: endpoint.cdnBaseUrl }
- : resolveOssConfig(region);
+ let config;
+ if (checkCdn) {
+ const cdnEnvName = {
+ global: "XDT_GLOBAL_CDN_BASE_URL",
+ cn: "XDT_CDN_BASE_URL",
+ dev: "XDT_DEVCH_CDN_BASE_URL",
+ }[region];
+ let cdnBase = process.env[cdnEnvName]?.trim();
+ if (!cdnBase) {
+ const endpointFile = {
+ global: "endpoint.global.json",
+ cn: "endpoint.json",
+ dev: "endpoint.dev.json",
+ }[region];
+ const endpoint = JSON.parse(
+ await fs.readFile(
+ new URL("../config/" + endpointFile, import.meta.url),
+ "utf8",
+ ),
+ );
+ cdnBase = endpoint.cdnBaseUrl;
+ }
+ config = { cdnBase };
+ } else {
+ config = resolveOssConfig(region);
+ }
const client = checkCdn ? null : createOSSClient(region);
for (const asset of assets) {
const relative = "wallpapers/" + asset.sha256 + asset.ext;
@@ -114,7 +130,9 @@ if (checkCdn || !verifyOnly) {
},
);
if (!response.ok)
- throw new Error("CDN resource is not readable: " + response.status);
+ throw new Error(
+ `CDN resource is not readable (${region}, ${asset.id}${asset.ext}): ${response.status}`,
+ );
const bytes = Buffer.from(await response.arrayBuffer());
if (
bytes.length !== asset.bytes ||
diff --git a/scripts/test-hygiene-baseline.json b/scripts/test-hygiene-baseline.json
index 7e6bccd993..5e39dd0d66 100644
--- a/scripts/test-hygiene-baseline.json
+++ b/scripts/test-hygiene-baseline.json
@@ -146,9 +146,6 @@
"apps/desktop/src/main/__tests__/usageBroadcasterXaiSubscription.test.ts": {
"resetModules": 1
},
- "apps/desktop/src/main/__tests__/wallpaperVideo.test.ts": {
- "resetModules": 1
- },
"apps/desktop/src/main/__tests__/windowsDiagnosticsTrayWiring.test.ts": {
"sourceReads": 1
},