Skip to content

About

The official assets CDN for all websites under FRC Team 1114 - Simbotics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Simbotics Assets

The PDFs and videos for the Team 1114 – Simbotics websites, served at https://assets.simbotics.org. Images stay in each site's own repository.

files/
  resources/      presentations and guides from the resource library (resources.simbotics.org)
  robot-boards/   robot board PDFs
video/            the home page hero video
worker/           the Cloudflare Worker that serves the files
scripts/
  manifest.mjs    lists every file in manifest.json

A file at files/resources/2010-mobility.pdf here is at https://assets.simbotics.org/files/resources/2010-mobility.pdf.

How it works

There's no build and no hosting service for the files themselves. worker/index.ts is a Cloudflare Worker on assets.simbotics.org that fetches each requested file from this repository on raw.githubusercontent.com and sends it back with the right headers:

  • The right file type, so PDFs open in the browser's viewer and videos play. GitHub sends application/octet-stream.
  • Partial downloads (range requests), which PDF viewers and video players use.
  • CORS (Access-Control-Allow-Origin: *), so any of the team's sites can load the files.
  • Caching at Cloudflare's edge for 30 days, and in browsers for an hour.

Only files/, video/ and manifest.json are served, and only PDF, MP4 and JSON files. Anything else (this README, the Worker's code, a stray HTML file) is a 404.

Each deploy points the Worker at the commit being deployed, rather than at main. A file at a commit never changes, so Cloudflare can cache it for a long time, and the next deploy reads the new commit, so changes show up without purging the cache. Browsers may keep an old copy for up to an hour.

The repository must stay public: the Worker reads files without a GitHub token.

Adding or changing a file

  1. Add the file under files/ (PDFs) or video/ (MP4s). Use lowercase names with hyphens, starting with the year for anything dated, e.g. files/resources/2026-scouting-guide.pdf.
  2. Run npm run manifest and commit manifest.json with the file. CI fails if you forget.
  3. Push to main. The deploy workflow publishes it within a couple of minutes.
  4. Link to it from the site, e.g. href: 'files/resources/2026-scouting-guide.pdf' in the resources site's src/data/resources.ts.

Keep files under 100 MB, GitHub's limit for a single file. Long videos belong on YouTube. Removing a file doesn't shrink the repository (it stays in the git history), so avoid committing very large files you don't need.

Development

Requires Node.js 20 or newer.

npm install
npm run dev         # the Worker at http://localhost:8787, reading files from main on GitHub
npm test            # the Worker's unit tests (Vitest)
npm run typecheck
npm run manifest    # update manifest.json

npm run dev reads from GitHub, not your local copy, so a file shows up there only once it's pushed to main.

About

The official assets CDN for all websites under FRC Team 1114 - Simbotics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages