mirror of
https://github.com/saltbo/zpan.git
synced 2026-10-29 18:05:37 +08:00
* feat: public share landing page /s/:token + Workers SSR OG meta - Add SPA route `/s/:token` (TanStack Router, outside _authenticated) - Implement share components: ShareLanding, FilePreview, FolderBrowser, PasswordPrompt, SaveToDriveDialog, ShareError - File preview: image/video/audio/PDF via object URL fetch; fallback for other types with download CTA - Folder browser: breadcrumb navigation + children table with download - Password gate: POST /api/share/:token/verify with error feedback - Save to drive: workspace + folder picker, quota/password/gone error handling - Workers SSR: inject OG meta tags for /s/:token requests (title, description, image, twitter:card); fetch share metadata via /api/share/:token - Add /s/* to wrangler.toml run_worker_first for SSR routing - Add zValidator to /:token/children endpoint for typed RPC query params - Export ShareApiRoute type from server/app.ts; add RPC clients in rpc.ts - Add share.* i18n keys (en + zh) - 9 new unit tests covering error code derivation, escaping, i18n coverage Agent-Profile: https://agent-kanban.dev/agents/b724a773425e397c * test: add coverage for share public API wrappers and path traversal guard - api.test.ts: add unit tests for getShareLanding, verifySharePassword, getShareChildren, saveShareToDrive (success + all error paths) - share-public.integration.test.ts: add path traversal guard test (.. in path param returns 400 Invalid path) Agent-Profile: https://agent-kanban.dev/agents/b724a773425e397c * test: cover explicit page/pageSize params in children endpoint Add integration test for GET /api/share/:token/children with explicit page and pageSize query params to satisfy codecov/patch branch coverage. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * test: add error path coverage for children endpoint Cover invalid token (404), trashed matter (410), and non-numeric page/pageSize (NaN fallback) in GET /:token/children to satisfy codecov/patch threshold requirements. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: add ASSETS binding to wrangler.toml for Workers SSR Without binding = "ASSETS", env.ASSETS is undefined at runtime and the /s/:token SSR handler throws error code 1101. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: resolve CF SSR OG meta by calling service layer directly instead of self-subrequest Cloudflare Workers cannot fetch() their own origin when the path is listed in run_worker_first — the request loops back and returns a 500 error code 1101. Replace the HTTP subrequest in fetchShareMeta with a direct call to resolveShareByToken(platform.db, token) from the service layer. Add CF integration tests asserting that a valid landing share produces real og:title metadata and an unknown token falls back gracefully. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
33 lines
984 B
TOML
33 lines
984 B
TOML
name = "zpan"
|
|
main = "./workers/bootstrap.ts"
|
|
compatibility_date = "2026-04-12"
|
|
compatibility_flags = ["nodejs_compat"]
|
|
|
|
[assets]
|
|
binding = "ASSETS"
|
|
not_found_handling = "single-page-application"
|
|
run_worker_first = ["/api/*", "/dl/*", "/s/*"]
|
|
|
|
[[d1_databases]]
|
|
binding = "DB"
|
|
database_name = "zpan-db"
|
|
database_id = "5bd64957-fa49-4da0-8b7b-6e0ad84037e7"
|
|
migrations_dir = "./migrations"
|
|
|
|
[observability]
|
|
enabled = true
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# Staging environment — used by non-production branch builds.
|
|
# CLOUDFLARE_ENV=staging is set automatically in the build script.
|
|
# Workers Builds creates preview versions on the same zpan Worker
|
|
# but with staging D1 binding.
|
|
# ----------------------------------------------------------------------------
|
|
[env.staging]
|
|
|
|
[[env.staging.d1_databases]]
|
|
binding = "DB"
|
|
database_name = "zpan-db-staging"
|
|
database_id = "a9197d7a-6524-42f0-b646-e714dcb30b3b"
|
|
migrations_dir = "./migrations"
|