Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/.vitepress/theme/components/BugReportWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ async function submit() {
errorMessage.value = "";

try {
const response = await fetch("/api/report-bug", {
// Absolute URL: coordinode.com DNS is on PowerDNS (not Cloudflare), so the
// bug-reports worker is proxied through coordinode-docs.sw.foundation (CF zone).
const response = await fetch("https://coordinode-docs.sw.foundation/api/report-bug", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
Expand Down
4 changes: 3 additions & 1 deletion docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ const GA_ID = (import.meta.env as Record<string, string>).VITE_GA_ID || "";
const consentTheme = enhanceWithConsent(DefaultTheme, {
gaId: GA_ID,
// KV storage via Cloudflare Worker (configured in R-DOC2 — bug-reports-worker)
storage: createKVStorage("/api/consent"),
// 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"),
Comment on lines +17 to +19
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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.

});

export default {
Expand Down
Loading