docs: wire consent storage and bug reports for docs.coordinode.com#8
docs: wire consent storage and bug reports for docs.coordinode.com#8
Conversation
Use coordinode-docs.sw.foundation as API proxy — coordinode.com DNS is on PowerDNS (not Cloudflare), so direct CF Worker zone routing is impossible. sw.foundation subdomain acts as proxy (same pattern as gitlab-mcp and privacy sites). - theme/index.ts: createKVStorage absolute URL pointing to coordinode-docs.sw.foundation/api/consent - BugReportWidget.vue: fetch absolute URL pointing to coordinode-docs.sw.foundation/api/report-bug Closes #7
📝 WalkthroughSummary by CodeRabbitBug Fixes
WalkthroughTwo documentation theme files updated to use absolute URLs pointing to Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/.vitepress/theme/index.ts`:
- Around line 17-19: The hardcoded proxy origin passed to createKVStorage
("https://coordinode-docs.sw.foundation/api/consent") should be extracted into a
single shared constant (e.g., CONSENT_API_ORIGIN) sourced from a config module
or env (preferably process.env/VITE_CONSENT_API_ORIGIN) and used to compose the
full endpoint (join origin + "/api/consent") before calling createKVStorage;
update docs/.vitepress/theme/index.ts to import that constant (or read the env)
and replace the inline URL, and propagate the same constant to any other files
that currently hardcode this host so all endpoints derive from the single
config.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: b292a35f-c56c-4c00-809f-a80adf7b131d
📒 Files selected for processing (2)
docs/.vitepress/theme/components/BugReportWidget.vuedocs/.vitepress/theme/index.ts
| // Absolute URL: coordinode.com DNS is on PowerDNS (not Cloudflare), so the | ||
| // consent worker is proxied through coordinode-docs.sw.foundation (CF zone). | ||
| storage: createKVStorage("https://coordinode-docs.sw.foundation/api/consent"), |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Extract the proxy origin to shared config/env to avoid endpoint drift.
Line 19 hardcodes the API host in theme code. Since the same host is used in multiple files, move the origin to one config constant (preferably env-driven) and compose endpoint paths from it.
♻️ Proposed refactor
+const DOCS_API_ORIGIN =
+ (import.meta.env as Record<string, string>).VITE_DOCS_API_ORIGIN ||
+ "https://coordinode-docs.sw.foundation";
+
const consentTheme = enhanceWithConsent(DefaultTheme, {
gaId: GA_ID,
@@
- storage: createKVStorage("https://coordinode-docs.sw.foundation/api/consent"),
+ storage: createKVStorage(`${DOCS_API_ORIGIN}/api/consent`),
});🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/.vitepress/theme/index.ts` around lines 17 - 19, The hardcoded proxy
origin passed to createKVStorage
("https://coordinode-docs.sw.foundation/api/consent") should be extracted into a
single shared constant (e.g., CONSENT_API_ORIGIN) sourced from a config module
or env (preferably process.env/VITE_CONSENT_API_ORIGIN) and used to compose the
full endpoint (join origin + "/api/consent") before calling createKVStorage;
update docs/.vitepress/theme/index.ts to import that constant (or read the env)
and replace the inline URL, and propagate the same constant to any other files
that currently hardcode this host so all endpoints derive from the single
config.
Summary
theme/index.ts:createKVStorageuses absolute URLhttps://coordinode-docs.sw.foundation/api/consentBugReportWidget.vue:fetchuses absolute URLhttps://coordinode-docs.sw.foundation/api/report-bugWhy a subdomain proxy?
coordinode.comDNS is on PowerDNS (not Cloudflare), so Cloudflare Worker zone routes fordocs.coordinode.comare impossible.coordinode-docs.sw.foundation(in thesw.foundationCF zone) acts as API proxy — same pattern asgitlab-mcp.sw.foundationandprivacy.sw.foundation.Worker PRs:
Closes #7