Initial commit: Sproutlink short URL system

This commit is contained in:
2026-06-18 20:08:22 +08:00
commit 45875e9feb
40 changed files with 11485 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
name = "sproutlink"
main = "src/index.ts"
compatibility_date = "2024-09-23"
compatibility_flags = ["nodejs_compat"]
account_id = "YOUR_CLOUDFLARE_ACCOUNT_ID"
# Static assets: Vite build output is uploaded to Cloudflare CDN separately from
# the Worker JS bundle — does NOT count toward the 4 MB Worker size limit.
[assets]
directory = "../web/dist"
# Serve index.html for any path that doesn't match a real file (SPA routing)
not_found_handling = "single-page-application"
# Routes handled by the Worker:
# /{4-char-code} → public redirect
# /{4-char-code}/verify → password form submit
# /api/* → REST API
# Everything else → served from static assets (the React SPA)
[[d1_databases]]
binding = "DB"
database_name = "sproutlink"
database_id = "YOUR_D1_DATABASE_ID"
# Non-secret vars (override in dashboard or via wrangler secret)
[vars]
ALLOWED_ORIGINS = "*"