feat(web): add account workspaces and signed content flows

This commit is contained in:
justme committed 2026-10-14 04:06:03 +08:00
1 parent 7b8d61d1ba
commit b5cf3d5958
117 files changed
+2789 -1674

No files matched your search

@@ -0,0 +1,19 @@
import type { ChannelInfo, ShareInfo } from '../generated/api';
import type { SavedResource } from '../database';
/** Server-owned fields only: preserve local credentials, drafts, and user edit timestamps. */
export function channelCache(raw: ChannelInfo): Partial<SavedResource> {
return { name: raw.settings.name ?? undefined, creatorAccount: raw.creator_account ?? undefined,
createdAt: raw.created_at, expiresAt: raw.expires_at, seats: raw.settings.seats,
maxDownloads: raw.settings.file_max_downloads,
ttlSeconds: raw.settings.ttl_seconds, channelMetadata: raw };
}
export function shareCache(raw: ShareInfo): Partial<SavedResource> {
if (raw.state !== 'draft' && raw.state !== 'sealed') throw new Error('分享状态无效');
return { createdAt: raw.sealed_at ?? raw.created_at, expiresAt: raw.expires_at, state: raw.state,
ttlSeconds: raw.settings.ttl_seconds, maxVisitors: raw.settings.max_visitors,
maxDownloads: raw.settings.file_max_downloads || null, shareMetadata: raw };
}
export function isOfflineFailure(error: unknown): boolean {
return error instanceof Error && error.message === '网络连接失败';
}