This project is a redesigned Team 619 website built for maintainability and low hosting cost.
- Astro for site generation
- Markdown and MDX content collections
- Decap CMS for non-technical content editing
- Deployed to GitHub Pages via GitHub Actions
From the project root:
npm install
npm run devSite runs at http://localhost:4321.
Decap admin route:
http://localhost:4321/admin/
- Homepage content:
src/content/pages/home.md - News posts:
src/content/news/*.mdandsrc/content/news/*.mdx
npm run build
npm run previewDeployment is handled automatically by .github/workflows/deploy.yml on every push to main. It uses the withastro/action to build and deploy to GitHub Pages.
- Node version:
22 - Build command:
astro build(viawithastro/action) - Build output directory:
dist
The Decap admin panel is available at /admin. It is configured in public/admin/config.yml to use the 619Code/carobotics-website GitHub repo on the main branch. Editing through the CMS creates commits directly to the repo, which triggers a new deployment.
GitHub Pages does not support server-side OAuth, so authentication for Decap CMS is handled by a Cloudflare Worker acting as an OAuth proxy. The deployed proxy lives at https://decap-proxy.carobotics.workers.dev.
- The Decap admin panel redirects the user to the proxy's
/auth?provider=githubendpoint. - The proxy redirects to GitHub's OAuth authorization page.
- GitHub redirects back to the proxy's
/callback?provider=githubendpoint with an auth code. - The proxy exchanges the code for an access token and passes it back to the Decap admin panel.
The proxy is based on sterlingwes/decap-proxy and is deployed separately from this repo.
- Clone the proxy repo:
git clone https://github.com/sterlingwes/decap-proxy - Copy the sample config:
cp wrangler.toml.sample wrangler.toml - Set the worker
nameinwrangler.tomltodecap-proxy(or your preferred name) - Login to Cloudflare:
npx wrangler login - Set the OAuth secrets from your GitHub OAuth App:
npx wrangler secret put GITHUB_OAUTH_ID npx wrangler secret put GITHUB_OAUTH_SECRET
- Deploy:
npx wrangler deploy
The OAuth App is registered under the 619Code GitHub account at github.com/settings/developers with:
- Homepage URL:
https://decap-proxy.carobotics.workers.dev - Authorization callback URL:
https://decap-proxy.carobotics.workers.dev/callback
public/admin/config.yml points to the proxy:
backend:
name: github
repo: 619Code/carobotics-website
branch: main
base_url: https://decap-proxy.carobotics.workers.dev
auth_endpoint: /authThe Decap CMS script in public/admin/index.html is loaded from unpkg with a Subresource Integrity (SRI) hash. This prevents the browser from executing tampered CDN content. The hash must be updated whenever the version number changes.
- Update the version in the
<script>srcURL inpublic/admin/index.html. - Compute the new SRI hash for the updated file (PowerShell):
Or with bash/openssl:
$response = Invoke-WebRequest -Uri "https://unpkg.com/decap-cms@<VERSION>/dist/decap-cms.js" -UseBasicParsing $hash = [System.Security.Cryptography.SHA384]::Create().ComputeHash($response.RawContentStream) "sha384-" + [Convert]::ToBase64String($hash)
curl -sL https://unpkg.com/decap-cms@<VERSION>/dist/decap-cms.js | openssl dgst -sha384 -binary | openssl base64 -A | sed 's/^/sha384-/'
- Replace the
integrity="sha384-..."attribute value inpublic/admin/index.htmlwith the new hash.