8f2c21d25a
P4b Task 4:宿主 loader 以 iframe 载入的轮播页(/embed/:slotToken,裸布局)。 - src/embed/feed.ts:纯函数集——A22 旧响应裁决(dispatch seq + configVersion 双闸:过期/回看丢弃、等值差分合并、升值全量重置)、照片队列差分(新照片 追加队尾、缺席淘汰、thumb 签名刷新)、interval/高度夹取、轮询退避; - src/embed/useEmbedFeed.ts:取数编排(If-None-Match → 304 零处理)、轮询 (查询 interval 覆盖 → EMBED_POLL_INTERVAL_MS,连续 5 失败 ×5 退避,成功 归零;404/410 静默 collapse 隐藏自身)、A23 不可见暂停(document 隐藏 + IntersectionObserver 滚出视口 + 本地收起;恢复立即校准)、轮播 intervalMs 切换;__embedPollMs e2e 注入点; - src/embed/postMessage.ts:上行 resize/collapse(referrer origin 收敛,缺失 退 '*'——载荷无敏感数据,宿主侧 loader source+origin 双校验)、下行 expand (event.source === window.parent 白名单); - EmbedPage.vue:交叉淡入淡出(仅 thumb 小图省流量)、点击 window.open 单图 深链(noopener)、计数圆点、「照片即将上线」空态卡、×收起;lang 查询 (auto→相册 defaultLocale)驱动嵌入词条子集; - api client:fetchPublicEmbedSlot(304/ETag 分支,不走 apiRequest); - e2e:宿主夹具页 public/__test__/embed-host.html(仅测试资产)+ embed.spec 7 用例(轮换/新标签深链/收起记忆/窄屏 sm/轮询增量/换绑重置/空态/幽灵槽); helpers 增展示位 admin API 种子 + flushOutbox; - vitest 18 用例(裁决矩阵/队列差分/夹取/退避/304/可见性状态机)。 配套修正:api CORS exposedHeaders ETag(跨源浏览器可读,304 语义成立); contracts 新增浏览器安全子路径 ./constants(根出口 re-export internal-sync 的 node:crypto 会打进浏览器包);eslint ignore embed-loader 产物拷贝 (Task 3 起 viewer lint 红,先修)。 Co-Authored-By: Claude Code <noreply@anthropic.com>
72 lines
2.5 KiB
TypeScript
72 lines
2.5 KiB
TypeScript
export default {
|
|
app: { title: 'Live Gallery' },
|
|
home: { hint: 'Open an album link to start viewing' },
|
|
album: {
|
|
loading: 'Loading…',
|
|
loadingMore: 'Loading more…',
|
|
emptyNotice: 'Photos coming soon',
|
|
time: 'Time',
|
|
venue: 'Venue',
|
|
views: 'Views',
|
|
categories: 'Categories',
|
|
all: 'All',
|
|
sortLabel: 'Sort',
|
|
sortLatest: 'Latest',
|
|
sortHot: 'Popular',
|
|
end: 'You have reached the end',
|
|
newPhotos: 'New photos — tap to refresh',
|
|
retry: 'Retry',
|
|
},
|
|
lang: { switch: 'Switch language' },
|
|
prefs: { reduceMotion: 'Reduce motion' },
|
|
// Embed carousel iframe page (P4b Task 4): subset driven by the lang query.
|
|
embed: {
|
|
comingSoon: 'Photos coming soon',
|
|
openPhoto: 'Open photo',
|
|
close: 'Collapse widget',
|
|
},
|
|
download: {
|
|
action: 'Download photo',
|
|
original: 'Download original',
|
|
options: 'Download options',
|
|
busy: 'Preparing…',
|
|
failed: 'Download failed, please try again',
|
|
// WeChat in-app browser guidance (no programmatic download): long-press save + copy link.
|
|
wechatTitle: 'How to save this photo',
|
|
wechatHint: 'Pages opened inside WeChat cannot download directly. Long-press the photo above to save it, or copy the link and open it in a browser to download.',
|
|
copyLink: 'Copy link',
|
|
copied: 'Link copied',
|
|
copyFailed: 'Copy failed — long-press to select the link below',
|
|
dismiss: 'Got it',
|
|
},
|
|
viewer: {
|
|
title: 'Photo viewer',
|
|
close: 'Close',
|
|
previous: 'Previous photo',
|
|
next: 'Next photo',
|
|
counter: '{current} / {total}',
|
|
like: 'Like',
|
|
likeCount: '{count} likes',
|
|
bubbleOpen: 'Open the liked photo',
|
|
loadFailed: 'Failed to load image',
|
|
// PHOTO_NOT_PUBLIC 专用:not found / unpublished / hidden share one code (anti-enumeration).
|
|
photoUnavailable: 'Photo not found or unavailable',
|
|
backToAlbum: 'Back to album',
|
|
},
|
|
route: { tokenLabel: 'Album token', photoLabel: 'Photo' },
|
|
errors: {
|
|
albumNotFound: 'Album not found',
|
|
// ALBUM_NOT_PUBLIC 专用:offline / disabled / ghost token 同码(防枚举)。
|
|
albumNotAvailable: 'Album not found or offline',
|
|
photoNotFound: 'Photo not found',
|
|
notFound: 'Page not found',
|
|
authExpired: 'Session expired',
|
|
forbidden: 'Access denied',
|
|
rateLimited: 'Too many requests, please try again later',
|
|
validationFailed: 'Invalid request',
|
|
internal: 'Service temporarily unavailable, please try again later',
|
|
unknown: 'Something went wrong, please try again later',
|
|
network: 'Network error, please check your connection',
|
|
},
|
|
};
|