mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-22 07:15:47 +00:00
feat(themes): fresher store refresh + external-services notice (#1016)
* feat(themes): fresher store refresh + external-services notice Manual refresh now fetches the registry from GitHub raw first (~5 min cache) and falls back to the jsDelivr CDN, so a freshly merged theme shows up without waiting on — or purging — the shared CDN @main edge (up to 12 h). Normal loads still use the CDN. Adds a notice on the Theme Store that the catalogue and previews load from external services (jsDelivr / GitHub), in line with the app's network transparency. i18n ×9. * docs(themes): note the store-refresh PR in the Theme Store entry Now that #1015 is merged, fold PR #1016 into the still-unreleased Theme Store changelog and credits entry.
This commit is contained in:
@@ -84,4 +84,31 @@ describe('fetchRegistry', () => {
|
||||
expect(r.registry.generatedAt).toBe('fresh2');
|
||||
expect(fetchMock).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('force-refresh tries GitHub raw first', async () => {
|
||||
const calls: string[] = [];
|
||||
vi.stubGlobal('fetch', vi.fn(async (url: string) => { calls.push(url); return okRes(reg('forced')); }));
|
||||
|
||||
await fetchRegistry({ force: true });
|
||||
expect(calls[0]).toContain('raw.githubusercontent.com');
|
||||
});
|
||||
|
||||
it('force-refresh falls back to jsDelivr when raw fails', async () => {
|
||||
const fetchMock = vi.fn(async (url: string) =>
|
||||
url.includes('raw.githubusercontent.com') ? failRes() : okRes(reg('cdn')));
|
||||
vi.stubGlobal('fetch', fetchMock);
|
||||
|
||||
const r = await fetchRegistry({ force: true });
|
||||
expect(r.registry.generatedAt).toBe('cdn');
|
||||
expect(fetchMock).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
it('non-force load uses the CDN only (not raw)', async () => {
|
||||
const calls: string[] = [];
|
||||
vi.stubGlobal('fetch', vi.fn(async (url: string) => { calls.push(url); return okRes(reg('cdn')); }));
|
||||
|
||||
await fetchRegistry();
|
||||
expect(calls).toHaveLength(1);
|
||||
expect(calls[0]).not.toContain('raw.githubusercontent.com');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user