feat(desktop): add offline cache and verified app updates
ci / module boundaries / boundaries (push) Successful in 7s
ci / mobile / mobile (Metro-бандл Android) (push) Successful in 1m2s
ci / ts / ts (packages + web) (push) Successful in 3m8s
ci / desktop / rust (desktop proxy) (push) Successful in 4m21s
release / release (версия и заметки) (push) Successful in 6s
release / android (APK в релиз) (push) Successful in 4m0s
release / desktop (Linux и Windows в релиз) (push) Successful in 11m49s
release / prune (старые файлы и прогоны) (push) Successful in 5s
ci / module boundaries / boundaries (push) Successful in 7s
ci / mobile / mobile (Metro-бандл Android) (push) Successful in 1m2s
ci / ts / ts (packages + web) (push) Successful in 3m8s
ci / desktop / rust (desktop proxy) (push) Successful in 4m21s
release / release (версия и заметки) (push) Successful in 6s
release / android (APK в релиз) (push) Successful in 4m0s
release / desktop (Linux и Windows в релиз) (push) Successful in 11m49s
release / prune (старые файлы и прогоны) (push) Successful in 5s
Clean release notes in Android and desktop update dialogs. Persist downloaded audio and offline playback events per server and user; add desktop update checks, checksum verification and installer launch.
This commit is contained in:
1 parent
75ae2092ad
commit
ab49e22357
27 files changed
+785
-39
No files matched your search
@@ -1,12 +1,29 @@
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
import { AuthSession, type AuthUser } from '@pipu/core';
|
||||
|
||||
import { createDesktop, isDesktop } from './desktop';
|
||||
import { createDesktop, desktopFetch, isDesktop } from './desktop';
|
||||
|
||||
afterEach(() => {
|
||||
vi.unstubAllGlobals();
|
||||
});
|
||||
|
||||
describe('desktop bridge', () => {
|
||||
it('restores the last desktop user when the proxy cannot reach the server', async () => {
|
||||
vi.stubGlobal('fetch', vi.fn().mockResolvedValue(new Response('offline', { status: 502, headers: { 'x-pipu-transport-error': '1' } })));
|
||||
const user = { id: 'alice', username: 'alice' } as AuthUser;
|
||||
const clear = vi.fn();
|
||||
const session = new AuthSession({ clientType: 'desktop', fetch: desktopFetch, baseUrl: 'http://local', refreshStore: {
|
||||
get: async () => 'refresh', set: vi.fn(), clear, getUser: async () => user,
|
||||
} });
|
||||
expect(await session.restore()).toEqual({ status: 'signed_in', offline: true, user });
|
||||
expect(clear).not.toHaveBeenCalled();
|
||||
});
|
||||
it('reports a failed proxy hop as a network failure, preserving real HTTP errors', async () => {
|
||||
vi.stubGlobal('fetch', vi.fn().mockResolvedValue(new Response('offline', { status: 502, headers: { 'x-pipu-transport-error': '1' } })));
|
||||
await expect(desktopFetch('http://local/api')).rejects.toThrow('Server unavailable');
|
||||
vi.stubGlobal('fetch', vi.fn().mockResolvedValue(new Response('denied', { status: 401 })));
|
||||
expect((await desktopFetch('http://local/api')).status).toBe(401);
|
||||
});
|
||||
it('is inactive in the browser', () => {
|
||||
expect(isDesktop()).toBe(false);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user