From c2016e723ff5df626ce479602879174e1bf0dd8f Mon Sep 17 00:00:00 2001 From: ctao Date: Fri, 24 Jul 2026 19:59:45 +0200 Subject: [PATCH] fix: gitea backend + allowedHosts + admin route --- astro.config.mjs | 3 +++ public/admin/config.yml | 21 ++++++++++----------- public/admin/index.html | 13 ------------- src/pages/admin/index.astro | 16 ++++++++++++++++ 4 files changed, 29 insertions(+), 24 deletions(-) delete mode 100644 public/admin/index.html create mode 100644 src/pages/admin/index.astro diff --git a/astro.config.mjs b/astro.config.mjs index 616dbb2..2cfe1fb 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -6,6 +6,9 @@ export default defineConfig({ server: { port: 4321, host: true }, vite: { server: { + // Vite blocks unknown Host headers by default; the demo is viewed through an + // ephemeral cloudflared quick tunnel, so allow any *.trycloudflare.com host. + allowedHosts: ['.trycloudflare.com'], // Same-origin path for the Sveltia/Decap local backend proxy (default port // moved to 8082 to avoid colliding with Metro on 8081). Proxying it here // means the CMS admin talks to one origin, so editing also works through the diff --git a/public/admin/config.yml b/public/admin/config.yml index bb86a91..c3c9f28 100644 --- a/public/admin/config.yml +++ b/public/admin/config.yml @@ -1,17 +1,16 @@ -# Sveltia/Decap CMS config. In production `backend` would be GitHub (editors log in -# with GitHub, content committed to the repo). For this local demo we use the local -# backend: edits are written straight to the Markdown files on disk via a local proxy. +# Sveltia CMS config — backend: local Gitea (demo). Editors log in via Gitea OAuth +# (PKCE, no client secret); edits are committed to the ctao/portal repo in Gitea. +# NOTE: base_url/api_root point at an ephemeral cloudflared quick tunnel — if the +# tunnel restarts, update these URLs and the OAuth app redirect_uri in Gitea. backend: - name: github - repo: ctao/portal-ctao # placeholder — unused in local mode + name: gitea + repo: ctao/portal branch: main + base_url: https://powerseller-increased-banana-extremely.trycloudflare.com + api_root: https://powerseller-increased-banana-extremely.trycloudflare.com/api/v1 + app_id: 73c02331-8842-4ddc-b769-8b09c3c422fb -# Local editing without GitHub. The proxy runs on 8082 (8081 is taken by Metro) and -# is reached same-origin at /api/v1 (proxied by Astro) so editing also works via the tunnel. -local_backend: - url: /api/v1 - -media_folder: "public/uploads" # relative to the proxy CWD (demo-git-cms/) +media_folder: "public/uploads" public_folder: "/uploads" collections: diff --git a/public/admin/index.html b/public/admin/index.html deleted file mode 100644 index 1a2b088..0000000 --- a/public/admin/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - CTAO — Edytor treści - - - - - - diff --git a/src/pages/admin/index.astro b/src/pages/admin/index.astro new file mode 100644 index 0000000..1a01e9f --- /dev/null +++ b/src/pages/admin/index.astro @@ -0,0 +1,16 @@ +--- +// Editor entry point (/admin). Sveltia CMS loads its config from ./config.yml +// (served statically from public/admin/config.yml). The external bundle is kept +// inline so Astro doesn't try to process/bundle it. +--- + + + + + + CTAO — Edytor treści + + + + +