Skip to content

Import links: web form and relay documentation - #26

Merged
fylorn merged 1 commit into
mainfrom
feat/import-links-docs
Sep 29, 2026
Merged

fylorn merged 1 commit into
mainfrom
feat/import-links-docs

Conversation

@fylorn

@fylorn fylorn commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Site side of ThinkWatch Lite import links (app side: ThinkWatchProject/ThinkWatch-Lite#252).

  • /import and /zh-CN/import — the web form https://thinkwat.ch/import#name=…&url=…&protocol=…&key=…&models=….
    • Reads the fragment with URLSearchParams (never sent to a server) and removes it from the address bar and history entry with history.replaceState; reloads on hashchange so a second link is never shown with the first one's data.
    • Validates with the same rules as the app (src/lib/import-link.ts, mirroring import_link.rs): allowlisted parameters, no duplicates or empty values, https only (http for localhost/127.0.0.1/[::1]), no userinfo/query/fragment, host shown in ASCII (IDN → punycode), key limited to key characters (no $ { } so ${NAME} can never reach the app), protocol enum, name and model rules. An invalid link shows nothing but the reason.
    • Every value is rendered with textContent; the key is hidden until "Show".
    • The only navigation is thinkwatch://import?… rebuilt from the validated values with encodeURIComponent.
    • No third-party scripts: Base gains an analytics prop and this page turns Google Analytics off. noindex, excluded from the sitemap. Offers the Lite download (LiteDownload) when the app is not installed.
  • Lite docs "Import links" (/docs/lite/import-links, en + zh-CN), for relay/vendor operators: link forms, parameter table, limits, what the app does with a link, examples for Anthropic- and OpenAI-compatible relays, what a link intentionally cannot set and why, keys in links. Ends with a link builder (ImportLinkBuilder.astro, hooked into _DocArticle.astro for this page only) that validates in the browser and writes both link forms with textContent.

Checks

  • astro build passes (55 pages). The existing core-docs drift warning is unrelated.
  • Verified in a local preview: valid link (IDN host shown as xn--…), key=${OPENAI_API_KEY} rejected, name=<img …> rejected with no element created, fragment stripped, zh redirect keeps the fragment, builder output matches the docs examples, no googletagmanager on the import pages.
  • The site validator's output was cross-checked against the app's Rust parser (the documented example links are a Rust test in the Lite PR).

🤖 Generated with Claude Code

- /import and /zh-CN/import: the web form of a ThinkWatch Lite import link.
  The parameters stay in the fragment, are checked with the same rules as the
  app (src/lib/import-link.ts), rendered with textContent only, and removed
  from the address bar after reading. The only navigation is to
  thinkwatch://import?… built from the checked values. No analytics or other
  third-party script on this page (Base gains an `analytics` prop), noindex,
  left out of the sitemap, and a download button when the app is missing.
- Lite docs "Import links" (en, zh-CN) for relay and vendor operators: link
  forms, parameters, limits, what the app does, examples for Anthropic- and
  OpenAI-compatible relays, what a link cannot set and why, and a client-side
  link builder that generates both link forms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fylorn
fylorn merged commit 23c5d66 into main Sep 29, 2026
1 check passed
@fylorn
fylorn deleted the feat/import-links-docs branch September 29, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant