commit
initial commit
diff --git a/.dev.vars.example b/.dev.vars.example
new file mode 100644
index 0000000..c98ee2d
--- /dev/null
+++ b/.dev.vars.example
@@ -0,0 +1,12 @@
+# Copy to .dev.vars for `wrangler dev`. In production set these with
+# `wrangler secret put <NAME>` instead.
+
+# Point at a local auth-server (`npm run dev` there, port 8787) and register a
+# client with redirect URI http://localhost:8788/auth/callback.
+AUTH_ISSUER=http://localhost:8787
+OIDC_CLIENT_ID=cdn
+OIDC_CLIENT_SECRET=
+
+# Signs the login cookie. Changing it signs everyone out.
+# Generate with: openssl rand -base64 32
+SESSION_SECRET=
diff --git a/.github/workflows/mirror.yml b/.github/workflows/mirror.yml
new file mode 100644
index 0000000..a47e728
--- /dev/null
+++ b/.github/workflows/mirror.yml
@@ -0,0 +1,71 @@
+name: Mirror
+
+on:
+ push:
+
+jobs:
+ mirror:
+ runs-on: ubuntu-latest
+
+ permissions:
+ contents: read
+
+ concurrency:
+ group: mirror-${{ github.repository }}
+ cancel-in-progress: false
+
+ env:
+ MIRROR_HOST: backup.doughmination.gay
+ MIRROR_USERNAME: clove
+ MIRROR_REPO: cdn
+ MIRROR_TOKEN: ${{ secrets.MIRROR_TOKEN }}
+
+ steps:
+ - name: Clone every ref
+ env:
+ SOURCE_TOKEN: ${{ github.token }}
+ SERVER_URL: ${{ github.server_url }}
+ run: |
+ set -euo pipefail
+
+ sourceHost="${SERVER_URL#https://}"
+
+ git clone --mirror \
+ "https://x-access-token:${SOURCE_TOKEN}@${sourceHost}/${GITHUB_REPOSITORY}.git" \
+ source.git
+
+ - name: Drop pull-request refs
+ working-directory: source.git
+ run: |
+ set -euo pipefail
+
+ git for-each-ref --format='%(refname)' 'refs/pull/*' \
+ | while read -r ref; do
+ git update-ref -d "$ref"
+ done
+
+ - name: Push mirror
+ working-directory: source.git
+ run: |
+ set -euo pipefail
+
+ if [ -z "$MIRROR_USERNAME" ]; then
+ echo "MIRROR_USERNAME is not set" >&2
+ exit 1
+ fi
+
+ if [ -z "$MIRROR_REPO" ]; then
+ echo "MIRROR_REPO is not set" >&2
+ exit 1
+ fi
+
+ targetUrl="https://${MIRROR_HOST}/${MIRROR_USERNAME}/${MIRROR_REPO}.git"
+
+ echo "Mirroring ${GITHUB_REPOSITORY} -> ${targetUrl}"
+
+ git remote add mirror "$targetUrl"
+
+ # Credentials go through a helper so the token never lands in .git/config
+ git -c credential.helper= \
+ -c "credential.helper=!f() { echo username=\"\$MIRROR_USERNAME\"; echo password=\"\$MIRROR_TOKEN\"; }; f" \
+ push --mirror mirror
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3238d0f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,12 @@
+# macOS
+.DS_Store
+
+# dependencies
+node_modules
+
+# wrangler
+.wrangler
+.dev.vars
+.dev.vars.*
+!.dev.vars.example
+assets/
diff --git a/.node-version b/.node-version
new file mode 100644
index 0000000..2bd5a0a
--- /dev/null
+++ b/.node-version
@@ -0,0 +1 @@
+22
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..cfe0c91
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,20 @@
+# Contributing Guidelines
+
+Thank you for considering contributing!
+
+## How to Contribute
+- Fork the repository
+- Create a new branch for your feature or fix
+- Submit a pull request with a clear description
+
+## Code of Conduct
+All contributors are expected to follow the [Code of Conduct](CODE_OF_CONDUCT.md).
+
+## Issues
+- Please use issues for bug reports, feature requests, and questions.
+
+## Commit Messages
+- Use clear, descriptive commit messages.
+
+## License
+By contributing, you agree your contributions will be licensed under the repository's license.
diff --git a/LICENCE.md b/LICENCE.md
new file mode 100644
index 0000000..640ddfb
--- /dev/null
+++ b/LICENCE.md
@@ -0,0 +1,316 @@
+# Doughmination Authorised Source Licence
+
+**Version 1.2**
+
+This Licence may be referred to as the **Doughmination Authorised Source Licence (DASL)**. This version may be referred to as **DASL-1.2**.
+
+Copyright © 2026 Clove Nytrix Doughmination Twilight.
+
+---
+
+# 1. Definitions
+
+For the purposes of this Licence:
+
+**"Software"** means the source code, object code, documentation, configuration, assets, and any associated files distributed under this Licence.
+
+**"Authorisation"** means explicit written permission granted by Clove Nytrix Doughmination Twilight permitting specific use of the Software.
+
+**"Authorised Person"** means a person or organisation expressly identified as authorised in an official licensing record maintained by Clove Nytrix Doughmination Twilight, including the `PEOPLE.md` file of an Official Licensing Repository or, where applicable, the `README.md` file of the relevant Software project.
+
+**"Contributor"** means any person or organisation that has received Authorisation, or is otherwise expressly authorised under this Licence, to modify, contribute to, or submit changes to the Software.
+
+**"Contribution"** means any source code, object code, documentation, configuration, assets, or other material submitted, provided, or incorporated into the Software by a Contributor.
+
+**"Fork"** means a copy or repository of the Software created through a version-control forking mechanism or an equivalent process, including forks hosted on third-party platforms.
+
+**"Contribution Fork"** means a Fork created and used solely for the purpose of preparing, reviewing, testing, or submitting Contributions to the original Software.
+
+**"Official Licensing Repositories"** means the repositories maintained by Clove Nytrix Doughmination Twilight for the administration and publication of licensing information:
+
+* GitHub: https://github.com/doughmination/licencing
+* Codeberg: https://codeberg.org/clove/licencing
+* Backup Forge: https://backup.doughmination.gay/clove/licencing
+
+**"Official Licensing Records"** means licensing records published within an Official Licensing Repository, including `PEOPLE.md`, or other records expressly identified as authoritative by Clove Nytrix Doughmination Twilight.
+
+**"Artificial Intelligence System"** means any artificial intelligence, machine-learning, generative, automated code-generation, or substantially similar system capable of generating, modifying, analysing, or transforming Software or other material.
+
+**"Meaningful Human Contribution"** means substantive human involvement in the creation, review, understanding, testing, modification, or approval of a Contribution sufficient for the Contributor to reasonably understand and take responsibility for the resulting Contribution.
+
+**"Trademarked Components"** means any trademarks, trade names, service marks, logos, branding, identifiers, product names, system names, or other distinctive branding owned or claimed by Clove Nytrix Doughmination Twilight, whether registered or unregistered.
+
+---
+
+# 2. Grant of Rights
+
+Except where expressly permitted by this Licence, by an applicable Official Licensing Record, or by separate written Authorisation, no licence or permission is granted to use, copy, modify, merge, publish, distribute, sublicense, host, deploy, execute, sell, create derivative works from, or otherwise exploit the Software.
+
+The Software is made available solely for inspection and review of its source code, subject to the specific permissions expressly granted by this Licence.
+
+All rights not expressly granted are reserved.
+
+---
+
+# 3. Forking and Contribution Forks
+
+Forking of the Software is expressly permitted to **all persons and organisations**, without requiring prior written Authorisation.
+
+This permission to fork is granted **solely to facilitate contribution to the original Software**.
+
+An unauthorised Fork does **not** constitute an authorised copy of the Software and does not grant the person or organisation creating the Fork any general right to use, operate, deploy, distribute, publish, commercialise, or otherwise exploit the Software.
+
+An unauthorised Fork may be used only for activities directly connected with contributing to the original Software, including:
+
+* inspecting and studying the Software;
+* preparing proposed changes to the Software;
+* modifying the Software for the purpose of preparing a Contribution;
+* testing or validating proposed Contributions;
+* submitting pull requests, patches, merge requests, or equivalent proposals to the original Software; and
+* performing other activities reasonably necessary to prepare or submit Contributions to the original Software.
+
+Without separate Authorisation, an unauthorised Fork **must not** be:
+
+* operated as an independent instance of the Software;
+* deployed for personal, private, public, organisational, or production use;
+* used to provide services to the Fork creator or to third parties;
+* made available to third parties for use;
+* distributed as an independent application or product;
+* published as an independent project;
+* used as the basis of a competing or replacement service;
+* commercially exploited;
+* sublicensed;
+* used to create or distribute derivative works for purposes unrelated to contributing to the original Software; or
+* otherwise used in any manner that constitutes independent use of the Software.
+
+The fact that a version-control platform permits a person to create, access, host, or publish a Fork does not constitute Authorisation to use that Fork for any purpose beyond those expressly permitted by this Section.
+
+The person or organisation creating an unauthorised Fork is responsible for ensuring that the Fork remains within the scope of this Section.
+
+Where a person or organisation wishes to use a Fork for any purpose other than contributing to the original Software, they must first obtain separate Authorisation from Clove Nytrix Doughmination Twilight or hold an applicable Authorisation recorded in an Official Licensing Record.
+
+A Contribution Fork may contain modifications that are necessary to prepare or test a Contribution, provided that those modifications remain within the scope of this Section.
+
+The permission to create a Fork does **not** constitute general permission to use the Software and does not grant any rights beyond those expressly stated in this Section.
+
+---
+
+# 4. Authorised Use
+
+Any person or organisation wishing to use the Software for purposes other than the permitted inspection, review, or Contribution Fork activities described in this Licence must first obtain written Authorisation from Clove Nytrix Doughmination Twilight, unless an applicable Official Licensing Record expressly grants the required permission.
+
+Authorisation may:
+
+* permit commercial or non-commercial use;
+* permit modification or contribution to the Software;
+* permit use of a Fork beyond Contribution Fork activities;
+* impose conditions or limitations;
+* restrict fields of use, duration, territory, or distribution;
+* specify particular projects, repositories, components, or versions;
+* require attribution, reporting, licensing fees, revenue sharing, or other obligations; or
+* be refused entirely.
+
+Authorisation to contribute to the Software does not, by itself, grant permission to redistribute, publish, deploy, sublicense, commercially exploit, or otherwise use the Software outside the scope of the authorised contribution activity.
+
+Any Authorisation permitting contribution is subject to the Contributor and Human Authorship Requirements set out in Section 8 unless expressly stated otherwise in writing.
+
+No Authorisation shall be implied through publication of the Software, possession of the Software, creation of a Fork, prior communications, or previous permissions granted to other parties.
+
+---
+
+# 5. Trusted Persons and Allowlist
+
+Clove Nytrix Doughmination Twilight may maintain an allowlist of trusted persons or organisations who are authorised to perform specified activities relating to the Software.
+
+The allowlist may be published in:
+
+* `PEOPLE.md` within an Official Licensing Repository; or
+* the `README.md` of the relevant Software project where that file expressly identifies the applicable Authorisation and scope.
+
+The allowlist may specify, for each Authorised Person:
+
+* the identity or account of the Authorised Person;
+* the projects or repositories to which the Authorisation applies;
+* the activities they may perform;
+* whether they may modify or contribute to the Software;
+* whether they may create or maintain Contribution Forks;
+* whether they may operate or deploy the Software;
+* whether they may use a Fork for purposes beyond contributing to the original Software;
+* whether they may review or approve Contributions;
+* whether they may distribute or publish particular material;
+* whether they may exercise additional rights beyond those granted to ordinary Contributors;
+* any restrictions or conditions applicable to their Authorisation; and
+* the duration or status of the Authorisation.
+
+An Authorised Person is permitted only to the extent expressly specified by the applicable allowlist entry.
+
+Being listed as an Authorised Person does not grant unrestricted rights to the Software.
+
+Clove Nytrix Doughmination Twilight may add, modify, restrict, suspend, or remove an Authorised Person or their authorised scope at any time.
+
+Where an Authorised Person is listed in both `PEOPLE.md` and a project's `README.md`, the more specific project-level scope shall apply to that project unless the applicable record expressly states otherwise.
+
+Where multiple Official Licensing Records contain conflicting entries concerning the same person or project, the most recently published applicable record shall control, unless the applicable record specifies another precedence rule.
+
+An allowlist entry constitutes Authorisation for the scope expressly stated in that entry and does not require separate written permission for activities falling within that scope.
+
+---
+
+# 6. Requesting Authorisation
+
+Requests for Authorisation should be submitted to:
+
+**[[email protected]](mailto:[email protected])**
+
+Clove Nytrix Doughmination Twilight may maintain Official Licensing Records identifying authorised persons, organisations, and licensing conditions.
+
+The Official Licensing Repositories are:
+
+* GitHub: https://github.com/doughmination/licencing
+* Codeberg: https://codeberg.org/clove/licencing
+* Backup Forge: https://backup.doughmination.gay/clove/licencing
+
+Where an individual or organisation is expressly listed as authorised within an applicable Official Licensing Record, that listing constitutes evidence of an active Authorisation subject to any accompanying conditions.
+
+Absence from the Official Licensing Records shall not be interpreted as evidence that permission has been granted.
+
+---
+
+# 7. Attribution
+
+Where Authorisation permits redistribution of the Software, all copies or substantial portions of the Software must include:
+
+* this Licence;
+* the copyright notice; and
+* reasonable attribution to **Clove Nytrix Doughmination Twilight**.
+
+Modified versions must clearly indicate that they have been modified.
+
+---
+
+# 8. Contributor and Human Authorship Requirements
+
+Where Authorisation permits a Contributor to modify, contribute to, or submit changes to the Software, the Contributor must retain Meaningful Human Contribution and responsibility for each Contribution.
+
+Artificial Intelligence Systems may be used as development tools or aids. Permitted uses may include, but are not limited to:
+
+* explaining programming concepts or existing code;
+* assisting with research;
+* identifying potential bugs or errors;
+* suggesting implementations or approaches;
+* assisting with debugging;
+* suggesting refactoring;
+* generating or assisting with tests;
+* assisting with documentation; and
+* other development activities where the Contributor retains meaningful human involvement and responsibility.
+
+The use of an Artificial Intelligence System must not replace the Contributor's substantive development work, judgement, understanding, review, testing, or responsibility for a Contribution.
+
+A Contributor must not submit or incorporate a Contribution where the Contributor has not meaningfully reviewed, understood, and taken responsibility for the resulting Contribution.
+
+Submitting substantially AI-generated material with little or no Meaningful Human Contribution is prohibited.
+
+In particular, a Contributor must not delegate the substantive development of a Contribution to an Artificial Intelligence System and submit the resulting material with only superficial or cursory human review.
+
+The use of an Artificial Intelligence System does not transfer responsibility for a Contribution away from the Contributor. The Contributor remains responsible for ensuring that every Contribution complies with this Licence and any applicable Authorisation.
+
+A Contributor may be required, as a condition of Authorisation, to disclose material use of Artificial Intelligence Systems in a Contribution where reasonably requested by Clove Nytrix Doughmination Twilight.
+
+Nothing in this Section prohibits ordinary use of automated development tooling where such tooling does not materially replace the Contributor's Meaningful Human Contribution.
+
+Violation of this Section constitutes a breach of the applicable Authorisation.
+
+---
+
+# 9. Representation and Branding
+
+You must not:
+
+* misrepresent the origin of the Software;
+* claim authorship of the original Software;
+* imply endorsement, sponsorship, certification, or affiliation by Clove Nytrix Doughmination Twilight; or
+* represent modified versions as official releases without prior written Authorisation.
+
+---
+
+# 10. Trademarked Components
+
+This Licence grants no rights to use any Trademarked Components.
+
+Without prior written Authorisation, you may not use any Trademarked Components in a manner that suggests endorsement, official status, compatibility certification, partnership, or origin.
+
+Current trademarks include, but are not limited to:
+
+* **Doughmination System®** (United Kingdom, UK00004263144)
+
+This list is non-exhaustive.
+
+---
+
+# 11. No Implied Rights
+
+No rights, licences, permissions, waivers, or immunities shall arise by implication, estoppel, or otherwise.
+
+Publication of the Software does not constitute permission to use the Software beyond the rights expressly granted by this Licence.
+
+The creation of a Fork does not constitute permission to use the Software independently of the original Software.
+
+The ability to access, clone, fork, download, or host the Software through a version-control platform does not constitute additional Authorisation.
+
+---
+
+# 12. Source-Available Status
+
+The Software is source-available.
+
+It is **not** open-source software.
+
+This Licence is not an Open Source Initiative-approved licence and should not be interpreted as granting the freedoms commonly associated with open-source licences.
+
+---
+
+# 13. Revocation
+
+Unless otherwise agreed in writing, any Authorisation granted under this Licence may be revoked by Clove Nytrix Doughmination Twilight.
+
+An allowlist entry may likewise be modified, suspended, or removed.
+
+Upon revocation or removal of Authorisation, all use relying upon that Authorisation must cease immediately unless otherwise specified within the revocation notice, applicable Official Licensing Record, or written agreement.
+
+The general permission to create Contribution Forks under Section 3 is not an individual Authorisation and may only be restricted or withdrawn by a subsequent version of this Licence or another legally applicable notice issued by Clove Nytrix Doughmination Twilight.
+
+Revocation does not affect obligations that, by their nature, survive termination.
+
+---
+
+# 14. Disclaimer of Warranty
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, OR NON-INFRINGEMENT.
+
+TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE ENTIRE RISK ARISING OUT OF THE USE OF THE SOFTWARE REMAINS WITH THE USER.
+
+---
+
+# 15. Limitation of Liability
+
+TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL CLOVE NYTRIX DOUGHMINATION TWILIGHT BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, CONSEQUENTIAL, OR PUNITIVE DAMAGES, OR FOR ANY LOSS OF PROFITS, REVENUE, DATA, GOODWILL, BUSINESS INTERRUPTION, OR OTHER COMMERCIAL LOSS ARISING FROM OR RELATING TO THE SOFTWARE OR ITS USE, WHETHER BASED IN CONTRACT, TORT, NEGLIGENCE, STRICT LIABILITY, OR OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+---
+
+# 16. Governing Law
+
+This Licence shall be governed by and construed in accordance with the laws of England and Wales.
+
+The courts of England and Wales shall have exclusive jurisdiction over disputes arising from or relating to this Licence unless otherwise required by applicable law.
+
+---
+
+# 17. Derivative Licences
+
+No person may publish, distribute, or present a licence derived from, based upon, or substantially similar to this Licence without prior written Authorisation from Clove Nytrix Doughmination Twilight.
+
+Where such permission is granted, the derivative licence must prominently state that it is derived from the Doughmination Authorised Source Licence (DASL) and must credit Clove Nytrix Doughmination Twilight as the original author.
+
+---
+
+**End of Licence**
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..06a3827
--- /dev/null
+++ b/README.md
@@ -0,0 +1,90 @@
+<div align="center">
+ <h1>CDN</h1>
+
+ <p>Clove's personal asset host — images, 3D models, fonts, and sound effects — with a small directory browser and an SSO-gated upload page. A Cloudflare Worker in front of an R2 bucket, at <a href="https://m.doughmination.gay">m.doughmination.gay</a>.</p>
+</div>
+
+## What this is
+
+A Cloudflare Worker that does three jobs:
+
+1. **Serves assets** out of the `cdn` R2 bucket for every other Doughmination site. A request for `/img/foo.png` returns the object `img/foo.png`, with range and conditional-request support so audio/video seek properly.
+2. **Browses itself.** `index.html` fetches `/api/list` (every object in the bucket) and renders folder navigation client-side via the URL hash (e.g. `#/f/Comic-Code`).
+3. **Takes uploads.** `/upload` is gated by the Doughmination SSO (`auth-server/`). Anyone the SSO lets sign in to the `cdn` client can drop files into any folder.
+
+## Layout
+
+```
+cdn/
+├── src/
+│ ├── main.ts Routing: worker routes → static site → R2
+│ ├── auth.ts OIDC sign-in against the SSO (/login, /auth/callback, /logout)
+│ ├── files.ts R2: serve, list, upload
+│ ├── cors.ts CORS allowlist (echoes an allowed Origin back)
+│ ├── genshin.ts GET /genshin/ui/<file>.png → cached enka.network/ui/* proxy
+│ └── views.ts Small server-rendered message pages
+├── public/ The site itself (deployed as Workers static assets)
+│ ├── index.html Directory browser
+│ ├── upload.html Upload page (+ upload.js)
+│ ├── licence.html Rendered licence page (LICENCE.md is served by the worker)
+│ ├── 404.html Not-found page
+│ ├── style.css Shared theme (see "Styling" below)
+│ ├── script.js Browser: folder navigation, filter, copy links
+│ ├── sfx.js UI sounds script, hotlinked by the other sites
+│ └── .well-known/ security.txt, ssh.txt, etc.
+├── assets/ The old in-repo assets, waiting to be copied into R2
+├── scripts/ Model conversion helpers (unrelated to the worker)
+└── wrangler.jsonc
+```
+
+## How the pieces fit
+
+- **Request order:** CORS → worker routes (`/login`, `/auth/*`, `/upload`, `/api/*`, `/genshin/ui/*`, `/LICENCE.md`, `/.well-known/change-password`) → a static file from `public/` → an R2 object → `404.html`. Static files win over R2 objects, so uploads to a path that a site file already uses are refused.
+- **Sign-in:** a standard OIDC authorization-code flow with PKCE, run server-side as a confidential client. The id_token is checked against the SSO's JWKS, then the worker sets its own 12-hour session cookie (an HS256 JWT signed with `SESSION_SECRET`). The worker does no group checks of its own: the SSO only issues codes to accounts in the client's allowed groups, so any valid session may upload. There is no server-side session state.
+- **Uploads:** `PUT /api/files/<path>` with the file as the raw body. It requires a signed-in session and a same-origin `Origin` header, and it won't replace an existing file unless the page's "Replace" box is ticked (`?overwrite=1`). Workers cap request bodies at 100 MB (Free/Pro plans), which limits single uploads to that size.
+- **CORS:** `Access-Control-Allow-Origin` can only be one origin, so `src/cors.ts` keeps an allowlist of the Doughmination domains and echoes back the request's `Origin` when it matches.
+- **Genshin UI proxy:** `src/genshin.ts` fetches `enka.network/ui/<file>.png` once, then serves it from Cloudflare's edge cache (30-day immutable). The API hands out icon URLs pointing here so the Discord bot's Genshin character card can pull splash art / weapon / artifact icons without rate-limiting Enka.
+- **Caching:** files are served with `Cache-Control: public, max-age=86400`, and `/api/list` is cached for 60 seconds. URLs may change at any time, so nothing is cached longer.
+
+## Setup
+
+1. **R2:** create the bucket: `npx wrangler r2 bucket create cdn`.
+2. **SSO:** in the SSO admin (`https://auth.doughmination.gay/admin`):
+ - create a group `cdn-upload` and add yourself to it
+ - create a **confidential** client with id `cdn`, redirect URI `https://m.doughmination.gay/auth/callback`, and allowed group `cdn-upload`. That allow-list is the only thing deciding who can upload, so don't leave it empty
+ - the uploading account needs a verified email, which the SSO requires before it issues codes
+3. **Secrets:**
+ ```sh
+ npx wrangler secret put OIDC_CLIENT_SECRET # shown once when the client was created
+ npx wrangler secret put SESSION_SECRET # openssl rand -base64 32
+ ```
+4. **Deploy:** `npm install && npm run deploy`. Then move the `m.doughmination.gay` custom domain from the old Pages project to the worker (or uncomment `routes` in `wrangler.jsonc`), and delete the Pages project.
+5. **Copy the old assets:** everything under `assets/` goes into the bucket with the same paths. For example, `assets/img/bg/main.png` becomes the key `img/bg/main.png`. The dashboard upload works, or:
+ ```sh
+ cd assets && find . -type f -printf '%P\n' | while IFS= read -r f; do
+ npx wrangler r2 object put "cdn/$f" --file "$f" --remote
+ done
+ ```
+ Once they're in R2, `assets/` can be deleted from the repo.
+
+**Local dev:** copy `.dev.vars.example` to `.dev.vars`, then run `npm run dev` (port 8788). Point it at a local auth-server on 8787 that has a `cdn` client with redirect URI `http://localhost:8788/auth/callback`. Local R2 starts empty.
+
+## Styling
+
+The CDN uses the **same look as every other Doughmination site** (see the monorepo `AGENTS.md` → "Uniform styling") — the terminal/clunky redesign:
+
+- Dark trans-pink palette tokens (`--accent: #f5a9b8`, `--bg: #0a0b10`, …), unchanged.
+- **IBM Plex Mono**, loaded from Google Fonts — replaced the old self-hosted Comic Code face.
+- The trans-flag gradient title animation was dropped for a solid `.trans-title` heading with a thin static `.flag-stripe` accent bar above it.
+- Square corners everywhere (`border-radius: 0`) — no more rounded panels/buttons.
+- No emoji in the UI: the folder/file/upload glyphs in `script.js` are small inline SVG icons instead of 📁/📄/⬇.
+
+The one deliberate exception: **no UI sounds here.** `sfx.js` and the `sfx/` files are hosted for the *other* sites to use; the CDN itself stays silent.
+
+## Please don't hotlink
+
+These URLs can change at any time without warning. Anything pointing here may break — mirror what you need instead.
+
+## Licence
+
+Licensed under the **Doughmination Authorised Source Licence (DASL-1.0)**. See [LICENCE.md](./LICENCE.md).
diff --git a/SECURITY.md b/SECURITY.md
new file mode 100644
index 0000000..8f6edbc
--- /dev/null
+++ b/SECURITY.md
@@ -0,0 +1,16 @@
+# Security Policy
+
+## Reporting a Vulnerability
+If you discover a security vulnerability, please email <a href="mailto:[email protected]">[email protected]</a> with details. You may also open a private issue if you prefer.
+
+
+
+## Supported Versions
+Only the latest version of this repository is supported for security updates.
+
+## Responsible Disclosure
+We appreciate responsible disclosure and will respond as quickly as possible to any reports.
+
+## Additional Resources
+- [GitHub Security Advisories](https://docs.github.com/en/code-security/security-advisories)
+- [Open Source Guides: Security](https://opensource.guide/security/)
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..d707d78
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,1998 @@
+{
+ "name": "cdn",
+ "version": "0.2.0",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "cdn",
+ "version": "0.2.0",
+ "dependencies": {
+ "hono": "^4.13.9",
+ "jose": "^6.2.12"
+ },
+ "devDependencies": {
+ "@cloudflare/workers-types": "^5.20260924.1",
+ "typescript": "^7.0.2",
+ "wrangler": "^4.137.0"
+ }
+ },
+ "node_modules/@cloudflare/kv-asset-handler": {
+ "version": "0.5.0",
+ "resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.5.0.tgz",
+ "integrity": "sha512-jxQYkj8dSIzc0cD6cMMNdOc1UVjqSqu8BZdor5s8cGjW2I8BjODt/kWPVdY+u9zj3ms75Q5qaZgnxUad83+eAg==",
+ "dev": true,
+ "license": "MIT OR Apache-2.0",
+ "engines": {
+ "node": ">=22.0.0"
+ }
+ },
+ "node_modules/@cloudflare/unenv-preset": {
+ "version": "2.16.2",
+ "resolved": "https://registry.npmjs.org/@cloudflare/unenv-preset/-/unenv-preset-2.16.2.tgz",
+ "integrity": "sha512-JBP1+Z7ZSNG/d4mRP+y8VC5dka3tZVMLEZRvS+rzQ4DGV1EoxRFQckcJTTkXbHSQiTj0DtNI01Zwb/V2fX0mvQ==",
+ "dev": true,
+ "license": "MIT OR Apache-2.0",
+ "peerDependencies": {
+ "unenv": "2.0.0-rc.24",
+ "workerd": ">1.20260305.0 <2.0.0-0"
+ },
+ "peerDependenciesMeta": {
+ "workerd": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@cloudflare/workerd-darwin-64": {
+ "version": "1.20260921.1",
+ "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20260921.1.tgz",
+ "integrity": "sha512-3iB2WnYOlZ29T+1zhCwbHFExCBp6E9bgmDUMryATYwrIGEQ1YbvR78m4ydm56XKN/d/yF3803ivMGfZMYDtiMg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=16"
+ }
+ },
+ "node_modules/@cloudflare/workerd-darwin-arm64": {
+ "version": "1.20260921.1",
+ "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20260921.1.tgz",
+ "integrity": "sha512-FpqVR7IQXVBmGtajyonEmhmb5UAsmV7dTaIkpemmHZXHEw7uYpkhkzKPjc4BOPhNQy8iwt2p+RZBPMY3Y7/bvQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=16"
+ }
+ },
+ "node_modules/@cloudflare/workerd-linux-64": {
+ "version": "1.20260921.1",
+ "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20260921.1.tgz",
+ "integrity": "sha512-riAJIohaVp5A8Sqy4yKlzHOaLPOICMf5oey+jC2rm45RVT+wK8+7UU0d31Dy/02Nc8YUkobAFwNVjX06P8WQ5g==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16"
+ }
+ },
+ "node_modules/@cloudflare/workerd-linux-arm64": {
+ "version": "1.20260921.1",
+ "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20260921.1.tgz",
+ "integrity": "sha512-tnJu08tT7s0XWDqp3O0H/vCp0voy9OqVAzspb89biMo1dh8IiEpnyXnoPmdJ7H4qBnXCmXgy0kuEphuvpDPj9w==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16"
+ }
+ },
+ "node_modules/@cloudflare/workerd-windows-64": {
+ "version": "1.20260921.1",
+ "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20260921.1.tgz",
+ "integrity": "sha512-VgNcRPstoZMb1G94JTrx+jU24GtkkazNfox0gnF/2fkuXpcfW/M0e0xvdMovYfwt8ZxG5AB2ZNvanD6ufBwiuQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=16"
+ }
+ },
+ "node_modules/@cloudflare/workers-types": {
+ "version": "5.20260924.1",
+ "resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-5.20260924.1.tgz",
+ "integrity": "sha512-puvr63PrfAFIkdh3FInGEgS0VTQ49WYNYDC2Eupd+qvwWwGpSRjxJD5Iz22oNHCmV1UEcsDz+OtGF++01vUloA==",
+ "dev": true,
+ "license": "MIT OR Apache-2.0"
+ },
+ "node_modules/@cspotcode/source-map-support": {
+ "version": "0.8.1",
+ "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
+ "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/trace-mapping": "0.3.9"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@emnapi/runtime": {
+ "version": "1.11.3",
+ "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.3.tgz",
+ "integrity": "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==",
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "tslib": "^2.4.0"
+ }
+ },
+ "node_modules/@esbuild/aix-ppc64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.1.tgz",
+ "integrity": "sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "aix"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-arm": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.1.tgz",
+ "integrity": "sha512-0k2F129Xdio1TdJfzJ8sy1Q47vUD2NnwdhiAf7drUN1EBTfPf4hsFCtmMgu/6m8JSzsBrlmVjudMBQqOfG8usQ==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-arm64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.1.tgz",
+ "integrity": "sha512-34EGEbCIAgosYz6goLcopX6Mo7NyGv9tfwEM2/7Ce2VcVRk568iSvniGWcUXIy7wEDR1wzolcxcriFVrWYcwBg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-x64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.1.tgz",
+ "integrity": "sha512-dbwY7ltSMDWsRatcRpCnES4F+im88OCUgGZjy52shC7GqHRE/cYlxNbB4Z4UpJswpcc4Qxd2oE/ufM0p61IKng==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/darwin-arm64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.1.tgz",
+ "integrity": "sha512-TZbWkQY7kvTAXbXUT7uVACR5cMHsDiSz9z7ZKAX/RTq/WJEk3QyRr0wZpNhBDX+/0CtdqUIJlOiodQcta6tY3Q==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/darwin-x64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.1.tgz",
+ "integrity": "sha512-zfdzgK9ACBNZLI/CyHTOx81SyNbM6YXn7rxSgX97VjyiPl9W1i4Ka4fgKECEoFCKGpvBj5qArWIGgQjOwkgskQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/freebsd-arm64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.1.tgz",
+ "integrity": "sha512-wG2EA8ENdEI0qhkSZMjfqrdY+ziCYCPMmtZjjIwOmXFjmyzEHn+UUxk5of+SYsjtfs3VpnlC7QLzSI5hY/rOAw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/freebsd-x64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.1.tgz",
+ "integrity": "sha512-i7dZ9vQgnvSCzi/rYCXNgtF/U+eKZNJBzu3eTQbRgHnM7tNSizLOkRFAl3qzVc/Op/u5YkHHa4pf/3DOYHthLQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-arm": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.1.tgz",
+ "integrity": "sha512-qVXBOHQS+d5Y722GwJzJUtOLlX7km3CraOaGormF1pDtPd2C/l1SHRPgjLunLGe51Sh5YYWKMFDyV4SxgMQYTQ==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-arm64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.1.tgz",
+ "integrity": "sha512-yHs+0uc8+nvEAfAfxrWQKK5peSNzBc4PegcMO0EJ2hT71uA7vB8Ihg2e77R2P7SG5uYjPbHlLLmve4LLLRCf0g==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-ia32": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.1.tgz",
+ "integrity": "sha512-d1z4ZuP0ajrfz/FhGT4vv278rX8KnPPJx8i5+AtK7TYbx9Le9F1hyzurZpkEyjkGa9dUGhQow4C1NmeGvqxN2w==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-loong64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.1.tgz",
+ "integrity": "sha512-M5sRjUVZrkm1OAPR3dlOYzNmN+loZKGVi1VUQGrwuqLcbR6qeAz+famMhjASeH3YVKvZz+zT1jlh/keC3Rj/lg==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-mips64el": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.1.tgz",
+ "integrity": "sha512-mRObBZeHh2OxcBFPWE/FjylkRgZdYuiTR3vaTozquCGOH14iP9oN4x4Ge81CoIDYQrXmIxpFumJBu5MtZpnQJQ==",
+ "cpu": [
+ "mips64el"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-ppc64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.1.tgz",
+ "integrity": "sha512-slScBsMAb3GFDcdrCgLwZtPYRoH2H/youv10QiZyRjmsP48fznoveWytSgCI/R0ZcUgpc0ZhIUEx6LHts8yrfQ==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-riscv64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.1.tgz",
+ "integrity": "sha512-kw0owk1o0GFETUJyW0jc0G4Yzs0BHZn0JDZ8JRT088vjJYX777BAs1fDGxAC+q831qOs2DTC96mNsG2opdfyyQ==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-s390x": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.1.tgz",
+ "integrity": "sha512-/lAIjX8aYFRByhh6L5rYtPEDRqa9de/4V/juOXcta5frjvzXO4/sqEtyytse0g3zZFuWu5cDN0MkLz2qRDD2Ag==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-x64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.1.tgz",
+ "integrity": "sha512-u/anNYF2mmVOEDwLtnQ1wOr3EZ9sTNGLWrsYGYwHWzGA3Si84IOkHXlbWTD1NB+9/1lcnweYKO54uhxZydNzfA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/netbsd-arm64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.1.tgz",
+ "integrity": "sha512-oks0DYbLwWMmaakTsCb+zL4E+aHRVLom9IJZOAthMQEPiQmydXHkziYEsGYRx0uNV/IjEKGAV941JzH02pflqw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/netbsd-x64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.1.tgz",
+ "integrity": "sha512-aeL6lAnN89Hz43Mlh1G8ARasbuoYvSITDEx0tHh5b7jJnHcssqgjy9Yx430GDpmCa6OyrKoS0aNRjKundRizGg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openbsd-arm64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.1.tgz",
+ "integrity": "sha512-MEFJe5C3R8pwXdZ5Y21oo6m7ePiS0d9pWucn99O/wvyJZChoIQKrQDxKrGeW8F5+T0okTHesAmDeiHDTIq0V/Q==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openbsd-x64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.1.tgz",
+ "integrity": "sha512-i/ZLIOafE0Z8cI/XANJAixoJL/uRAoS2xOA3rb0xN+KK0K177cMAsQYkzHtBrtMXAKuAc7HGgcWiZ/sRC1Nxgw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openharmony-arm64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.1.tgz",
+ "integrity": "sha512-ge+Z7EXFNt2BO1oAMsVpiQ8EwndV9i1xXerAeTIK7AtPs3bKFXQM7nlRxDSIUIMeueR1CNXxqztLzdNeReKBJg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openharmony"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/sunos-x64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.1.tgz",
+ "integrity": "sha512-BEjgtECkL3vY+SaSQ6nzVfiALUeFxpawyp8Jmf5PtYhf1Ug40N1h/hxlhts+f1FvSvarEigdxS3BlSMI2PJLcQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "sunos"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-arm64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.1.tgz",
+ "integrity": "sha512-lCv9eK/H6ZJWbE7bh2nw54CZ9M2nupBxJcTsdk/QQnWkdSjKGuxmmH8/GWrlT1eMmZfn4dGcCjRte397WqfQXA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-ia32": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.1.tgz",
+ "integrity": "sha512-zvb/mB2bSCoJOpoCBgYKKpX6YM6mJBlBUVUtVj41DlZJVEB6/0CKlRYxP5wWl1C1ILiCoAU5wZZ4q1P3qeS6Eg==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-x64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.1.tgz",
+ "integrity": "sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@img/colour": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@img/colour/-/colour-1.1.0.tgz",
+ "integrity": "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@img/sharp-darwin-arm64": {
+ "version": "0.35.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.35.4.tgz",
+ "integrity": "sha512-Uhfl4V4lhP2nbUVF9+hyH1+luj86f1gUFeo8ALYxFoULoU+G87D43BfeMP8XHsk9boxAnCY/bf2EHwhA7MuGsA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-darwin-arm64": "1.3.3"
+ }
+ },
+ "node_modules/@img/sharp-darwin-x64": {
+ "version": "0.35.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.35.4.tgz",
+ "integrity": "sha512-hWniXY3bG5qKpkKrAwPe4y+VTPmf086YQAnkxWh7uA1YrlRouWGa0M0Mxj3ZjnXFkv7/TD1bTy9lGUK26vRvWw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-darwin-x64": "1.3.3"
+ }
+ },
+ "node_modules/@img/sharp-freebsd-wasm32": {
+ "version": "0.35.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-freebsd-wasm32/-/sharp-freebsd-wasm32-0.35.4.tgz",
+ "integrity": "sha512-lIsKw/BU+kjB4eZjxrYrZmwOJYi3Ajrv66iAlBmUPyKc3HpnloevB1g3wxGD9P/5BbQ1brBGl65VRRrCvQDEqA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "dependencies": {
+ "@img/sharp-wasm32": "0.35.4"
+ },
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-darwin-arm64": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.3.3.tgz",
+ "integrity": "sha512-suTBPTDGrI9WodccaDdwZItTSaBYASlBk1NSfElSHrUfzu3szG6lvIF58+WiFvnfzuK8ZBFS5zE00PxqxnRiPg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-darwin-x64": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.3.3.tgz",
+ "integrity": "sha512-FVJZ5mITMobmXIz/hPDTw0EintTW5H3WfrxwLqEqjiIihlu+hVRyGrFQ60xl0Lxn7Bt3zdpevPaQi0HEzqz9fw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linux-arm": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.3.3.tgz",
+ "integrity": "sha512-3rbU4vqXXc3hY/OiXdl52xZvT0F1yEngWfvqudtPJg/KkyiaQw2DRsFrNzpmLvfavbwOq3qXn36GP8obHRULQA==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linux-arm64": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.3.3.tgz",
+ "integrity": "sha512-0DaL0A6Xu6sQSQFwe4iVCrKWU2cCTItnRsYsCdxAMm9NF6twAA9BKnoqy4hqz4+azQ0JHuA26qiUKsf1XJ/v5A==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linux-ppc64": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.3.3.tgz",
+ "integrity": "sha512-cdn1OvUBwsXhbC0zSzJnNzf5MZ/mTrobawDvNXBTxe8VtqKAm0sRuEY2Evzovb/w9JMk4TvRxqt1mekSuJz64w==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linux-riscv64": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-riscv64/-/sharp-libvips-linux-riscv64-1.3.3.tgz",
+ "integrity": "sha512-HjPVx7yKz+0lqdhDlTw1tt90wamBoxhiXpvl1XZpJLiHH4RCJ5yDTqH+VlYPv2fwFs89JFw4c1IexYOcQUi4IQ==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linux-s390x": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.3.3.tgz",
+ "integrity": "sha512-neWLh+3yCNThxnfy3c4BbVBeGgt9aftno+XbT56iK28RgeDs3UOFWviLWlUu0bArYVYJaFDK+RRohbicUNCm8Q==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linux-x64": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.3.3.tgz",
+ "integrity": "sha512-4vKmvAst9nrowcqquKFAyZJUDolUaIp8uRiN0mWFguJ1IplC9/pitXtlnnlU4aa/eJw3J7i67V+pwUL+wZGdsA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linuxmusl-arm64": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.3.3.tgz",
+ "integrity": "sha512-Y9kQaLMuNoB0bPYOOdcZMaseNrFpPodIWWMrx+CZyydf2xn68j9WYc6sWWRrDwNkzCQjKYfc68L7jKjGlHMibw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "libc": [
+ "musl"
+ ],
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linuxmusl-x64": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.3.3.tgz",
+ "integrity": "sha512-fj8Mv0HHfD1Rr+4I68+3agJynxDWtBFgicTbSOb9Bke6pIwzGcJ+RX/yHjmiEGFMCavY/dxvem7MyNaJF+wDiw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "libc": [
+ "musl"
+ ],
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-linux-arm": {
+ "version": "0.35.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.35.4.tgz",
+ "integrity": "sha512-7OAS8gI0EReKGVN2HssHlM6umJgxF5VI3xN0p9FA91p/YO+ou5hiNghLdZ5BEHztwaaK5+bLKRf8x/o2L2nk9A==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linux-arm": "1.3.3"
+ }
+ },
+ "node_modules/@img/sharp-linux-arm64": {
+ "version": "0.35.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.35.4.tgz",
+ "integrity": "sha512-De4jpEnAU8Hd5oT0j1G3uL4ZvTuipVMn7YC6vPaJhy6/7EwEae0SVAoBrUMYQbkLGDm85taVWwuPc1a44LTzCQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linux-arm64": "1.3.3"
+ }
+ },
+ "node_modules/@img/sharp-linux-ppc64": {
+ "version": "0.35.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.35.4.tgz",
+ "integrity": "sha512-2oYZJeIl4kCcMGk4ouZVjnkCtFrpQFlNEtJ6GbxzhHQchwH0NH/qEb9ykmOl29dqwMq+JhFdZn+1ak2FKhI9fQ==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linux-ppc64": "1.3.3"
+ }
+ },
+ "node_modules/@img/sharp-linux-riscv64": {
+ "version": "0.35.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-riscv64/-/sharp-linux-riscv64-0.35.4.tgz",
+ "integrity": "sha512-cPbNChoRURAWdebDIHSenxRpgEdy7JkPydSnUxRm9VvKD7m0/xVaR/8Fzlu81pk5nHEvHH87UZUA7cTtwnbJSA==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linux-riscv64": "1.3.3"
+ }
+ },
+ "node_modules/@img/sharp-linux-s390x": {
+ "version": "0.35.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.35.4.tgz",
+ "integrity": "sha512-RY0JFY8Fd6RonCBtHz+DvadaPkXDSI1AUn6yWL9TipqkZ1vY8w8evqdgyDFnkm4/K1ve1TvZiaePP5oSd4+WVQ==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linux-s390x": "1.3.3"
+ }
+ },
+ "node_modules/@img/sharp-linux-x64": {
+ "version": "0.35.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.35.4.tgz",
+ "integrity": "sha512-9qvvEAuk8k89TfWUoX2htWjbAMX8p+NxCppjpcg5k6xMsjhBQPTsoIh36h9Qde4WRuGpJeYnOjdosDn/cnv+OA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linux-x64": "1.3.3"
+ }
+ },
+ "node_modules/@img/sharp-linuxmusl-arm64": {
+ "version": "0.35.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.35.4.tgz",
+ "integrity": "sha512-KB5jxpfWQTr0nc3xdHtWChdbifHrBGsd2SM62Eyxrl8afikm+f5qGBU75SJIZBT/S1MC8XyacdlXBMSWq6OURA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "libc": [
+ "musl"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linuxmusl-arm64": "1.3.3"
+ }
+ },
+ "node_modules/@img/sharp-linuxmusl-x64": {
+ "version": "0.35.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.35.4.tgz",
+ "integrity": "sha512-f+eZJZIQNEEd26RPSW+76chwOf1XtA2Y/O+5ocVyLliHkeih3e+jhLVBdNTd2rS3IbNXK8+ug93Vf5ZXtF5Lxg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "libc": [
+ "musl"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linuxmusl-x64": "1.3.3"
+ }
+ },
+ "node_modules/@img/sharp-wasm32": {
+ "version": "0.35.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.35.4.tgz",
+ "integrity": "sha512-zQnl4Kwp7Q6NHsENtU2T/00Zi+w3AQNwz3+UaTyVBy2FpXrzXzGjndpK61onhZjRtRpQXxCTeqw19bVyXOh7jA==",
+ "dev": true,
+ "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT",
+ "optional": true,
+ "dependencies": {
+ "@emnapi/runtime": "^1.11.3"
+ },
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-webcontainers-wasm32": {
+ "version": "0.35.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-webcontainers-wasm32/-/sharp-webcontainers-wasm32-0.35.4.tgz",
+ "integrity": "sha512-ESfNkywmCfPNyaZjxooddJQiQ+l/nTpGEOGthxiLnIHXC/CmcBixnfwUleX9mCz9ovrUUvKMap/pm8RYbzfwaA==",
+ "cpu": [
+ "wasm32"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "dependencies": {
+ "@img/sharp-wasm32": "0.35.4"
+ },
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-win32-arm64": {
+ "version": "0.35.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.35.4.tgz",
+ "integrity": "sha512-iNdlBX9gLVvqe2I3uIJSIKTq6wckP/DYxZtcqxm09x5Gi24DnFBmPAWZmr60ZyYMG0xlzo6goG3670ar+RXvRw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0 AND LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-win32-ia32": {
+ "version": "0.35.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.35.4.tgz",
+ "integrity": "sha512-kqRsbaa5CS6KHlpxnN7WhE6vAAugXyZButpRdvDWetlv6Qv4N9WTcrWzF7tXfB9T7MsoadqdI8hmwLq6UlLvtw==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "Apache-2.0 AND LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": "^20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-win32-x64": {
+ "version": "0.35.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.35.4.tgz",
+ "integrity": "sha512-XtmnYhBcrORsJ4XJngyzr/EWP0hRZLAZRFaApdKuviyqF78+ylxh2y06ZmtULAMOnObJ3ucpN0AcwSWnMowTRg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0 AND LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@jridgewell/resolve-uri": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
+ "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/@jridgewell/sourcemap-codec": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz",
+ "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@jridgewell/trace-mapping": {
+ "version": "0.3.9",
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
+ "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/resolve-uri": "^3.0.3",
+ "@jridgewell/sourcemap-codec": "^1.4.10"
+ }
+ },
+ "node_modules/@poppinss/colors": {
+ "version": "4.1.6",
+ "resolved": "https://registry.npmjs.org/@poppinss/colors/-/colors-4.1.6.tgz",
+ "integrity": "sha512-H9xkIdFswbS8n1d6vmRd8+c10t2Qe+rZITbbDHHkQixH5+2x1FDGmi/0K+WgWiqQFKPSlIYB7jlH6Kpfn6Fleg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "kleur": "^4.1.5"
+ }
+ },
+ "node_modules/@poppinss/dumper": {
+ "version": "0.6.5",
+ "resolved": "https://registry.npmjs.org/@poppinss/dumper/-/dumper-0.6.5.tgz",
+ "integrity": "sha512-NBdYIb90J7LfOI32dOewKI1r7wnkiH6m920puQ3qHUeZkxNkQiFnXVWoE6YtFSv6QOiPPf7ys6i+HWWecDz7sw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@poppinss/colors": "^4.1.5",
+ "@sindresorhus/is": "^7.0.2",
+ "supports-color": "^10.0.0"
+ }
+ },
+ "node_modules/@poppinss/exception": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/@poppinss/exception/-/exception-1.2.3.tgz",
+ "integrity": "sha512-dCED+QRChTVatE9ibtoaxc+WkdzOSjYTKi/+uacHWIsfodVfpsueo3+DKpgU5Px8qXjgmXkSvhXvSCz3fnP9lw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@sindresorhus/is": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-7.2.0.tgz",
+ "integrity": "sha512-P1Cz1dWaFfR4IR+U13mqqiGsLFf1KbayybWwdd2vfctdV6hDpUkgCY0nKOLLTMSoRd/jJNjtbqzf13K8DCCXQw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sindresorhus/is?sponsor=1"
+ }
+ },
+ "node_modules/@speed-highlight/core": {
+ "version": "1.2.24",
+ "resolved": "https://registry.npmjs.org/@speed-highlight/core/-/core-1.2.24.tgz",
+ "integrity": "sha512-qeW2e1l78afw8VhRPfPQ1Gjj+KU5XFQ/OFV5ti6eTa9bruO7mJyZtA4vw0ofqmA3tKCkROE9xLk3VZoeRc98nw==",
+ "dev": true,
+ "license": "CC0-1.0"
+ },
+ "node_modules/@typescript/typescript-aix-ppc64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-aix-ppc64/-/typescript-aix-ppc64-7.0.2.tgz",
+ "integrity": "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "aix"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-darwin-arm64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-arm64/-/typescript-darwin-arm64-7.0.2.tgz",
+ "integrity": "sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-darwin-x64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-x64/-/typescript-darwin-x64-7.0.2.tgz",
+ "integrity": "sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-freebsd-arm64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-arm64/-/typescript-freebsd-arm64-7.0.2.tgz",
+ "integrity": "sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-freebsd-x64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-x64/-/typescript-freebsd-x64-7.0.2.tgz",
+ "integrity": "sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-linux-arm": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm/-/typescript-linux-arm-7.0.2.tgz",
+ "integrity": "sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-linux-arm64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm64/-/typescript-linux-arm64-7.0.2.tgz",
+ "integrity": "sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-linux-loong64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-loong64/-/typescript-linux-loong64-7.0.2.tgz",
+ "integrity": "sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-linux-mips64el": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-mips64el/-/typescript-linux-mips64el-7.0.2.tgz",
+ "integrity": "sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==",
+ "cpu": [
+ "mips64el"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-linux-ppc64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-ppc64/-/typescript-linux-ppc64-7.0.2.tgz",
+ "integrity": "sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-linux-riscv64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-riscv64/-/typescript-linux-riscv64-7.0.2.tgz",
+ "integrity": "sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-linux-s390x": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-s390x/-/typescript-linux-s390x-7.0.2.tgz",
+ "integrity": "sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-linux-x64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-x64/-/typescript-linux-x64-7.0.2.tgz",
+ "integrity": "sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-netbsd-arm64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-arm64/-/typescript-netbsd-arm64-7.0.2.tgz",
+ "integrity": "sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-netbsd-x64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-x64/-/typescript-netbsd-x64-7.0.2.tgz",
+ "integrity": "sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-openbsd-arm64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-arm64/-/typescript-openbsd-arm64-7.0.2.tgz",
+ "integrity": "sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-openbsd-x64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-x64/-/typescript-openbsd-x64-7.0.2.tgz",
+ "integrity": "sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-sunos-x64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-sunos-x64/-/typescript-sunos-x64-7.0.2.tgz",
+ "integrity": "sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "sunos"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-win32-arm64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-arm64/-/typescript-win32-arm64-7.0.2.tgz",
+ "integrity": "sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-win32-x64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-x64/-/typescript-win32-x64-7.0.2.tgz",
+ "integrity": "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/blake3-wasm": {
+ "version": "2.1.5",
+ "resolved": "https://registry.npmjs.org/blake3-wasm/-/blake3-wasm-2.1.5.tgz",
+ "integrity": "sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/cookie": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.1.1.tgz",
+ "integrity": "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/detect-libc": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
+ "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/error-stack-parser-es": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/error-stack-parser-es/-/error-stack-parser-es-1.0.5.tgz",
+ "integrity": "sha512-5qucVt2XcuGMcEGgWI7i+yZpmpByQ8J1lHhcL7PwqCwu9FPP3VUXzT4ltHe5i2z9dePwEHcDVOAfSnHsOlCXRA==",
+ "dev": true,
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/antfu"
+ }
+ },
+ "node_modules/esbuild": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.1.tgz",
+ "integrity": "sha512-HrJrvZv5ayxBzPfwphOoNzkzOIIlifzk0KJrGK2c8R4+LKpMtpYLQeUdjnwjWv/LZlkH2laZk+4w78pi99D4Vw==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "bin": {
+ "esbuild": "bin/esbuild"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "optionalDependencies": {
+ "@esbuild/aix-ppc64": "0.28.1",
+ "@esbuild/android-arm": "0.28.1",
+ "@esbuild/android-arm64": "0.28.1",
+ "@esbuild/android-x64": "0.28.1",
+ "@esbuild/darwin-arm64": "0.28.1",
+ "@esbuild/darwin-x64": "0.28.1",
+ "@esbuild/freebsd-arm64": "0.28.1",
+ "@esbuild/freebsd-x64": "0.28.1",
+ "@esbuild/linux-arm": "0.28.1",
+ "@esbuild/linux-arm64": "0.28.1",
+ "@esbuild/linux-ia32": "0.28.1",
+ "@esbuild/linux-loong64": "0.28.1",
+ "@esbuild/linux-mips64el": "0.28.1",
+ "@esbuild/linux-ppc64": "0.28.1",
+ "@esbuild/linux-riscv64": "0.28.1",
+ "@esbuild/linux-s390x": "0.28.1",
+ "@esbuild/linux-x64": "0.28.1",
+ "@esbuild/netbsd-arm64": "0.28.1",
+ "@esbuild/netbsd-x64": "0.28.1",
+ "@esbuild/openbsd-arm64": "0.28.1",
+ "@esbuild/openbsd-x64": "0.28.1",
+ "@esbuild/openharmony-arm64": "0.28.1",
+ "@esbuild/sunos-x64": "0.28.1",
+ "@esbuild/win32-arm64": "0.28.1",
+ "@esbuild/win32-ia32": "0.28.1",
+ "@esbuild/win32-x64": "0.28.1"
+ }
+ },
+ "node_modules/fsevents": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
+ }
+ },
+ "node_modules/hono": {
+ "version": "4.13.9",
+ "resolved": "https://registry.npmjs.org/hono/-/hono-4.13.9.tgz",
+ "integrity": "sha512-7dMkQmZoC4E6F7AtaQSPhlWAdnBti+j7rreMZl8QB4jFiEhP9TWbGWUMi8WYzBCgmgulxuvLQupKqo+Co6Omyg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=16.9.0"
+ }
+ },
+ "node_modules/jose": {
+ "version": "6.2.12",
+ "resolved": "https://registry.npmjs.org/jose/-/jose-6.2.12.tgz",
+ "integrity": "sha512-9NiFmJEex0sy2Dk58j2UGBSHgUs2ypF9eZSu4L6vjOX3Dp96Sw1F3uL+H+D1sx02jZZdzUT0HgvCy59CuvXcWw==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/panva"
+ }
+ },
+ "node_modules/kleur": {
+ "version": "4.1.5",
+ "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz",
+ "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/miniflare": {
+ "version": "5.20260921.0-alpha",
+ "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-5.20260921.0-alpha.tgz",
+ "integrity": "sha512-vHH/unOYvV2jA1Q9SdkmzrQhhMoksdwg5jegu6ZeKaaRzgxZhVbt1NdTpQjHF2VTgiBjgP8SiUlUMfruB3N3SQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@cspotcode/source-map-support": "0.8.1",
+ "sharp": "0.35.4",
+ "undici": "7.29.0",
+ "workerd": "1.20260921.1",
+ "ws": "8.21.0",
+ "youch": "4.1.0-beta.10"
+ },
+ "engines": {
+ "node": ">=22.0.0"
+ }
+ },
+ "node_modules/path-to-regexp": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz",
+ "integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/pathe": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz",
+ "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/semver": {
+ "version": "7.8.5",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
+ "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
+ "dev": true,
+ "license": "ISC",
+ "bin": {
+ "semver": "bin/semver.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/sharp": {
+ "version": "0.35.4",
+ "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.35.4.tgz",
+ "integrity": "sha512-n++8XWcj+jCOr2IOl7h8LbKnGBDY4aPbmprMONBNFdn0ImXqpGVv5zliDs0V9HbmbCQLpbuo2ej9rAoOQTvMDA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@img/colour": "^1.1.0",
+ "detect-libc": "^2.1.2",
+ "semver": "^7.8.5"
+ },
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-darwin-arm64": "0.35.4",
+ "@img/sharp-darwin-x64": "0.35.4",
+ "@img/sharp-freebsd-wasm32": "0.35.4",
+ "@img/sharp-libvips-darwin-arm64": "1.3.3",
+ "@img/sharp-libvips-darwin-x64": "1.3.3",
+ "@img/sharp-libvips-linux-arm": "1.3.3",
+ "@img/sharp-libvips-linux-arm64": "1.3.3",
+ "@img/sharp-libvips-linux-ppc64": "1.3.3",
+ "@img/sharp-libvips-linux-riscv64": "1.3.3",
+ "@img/sharp-libvips-linux-s390x": "1.3.3",
+ "@img/sharp-libvips-linux-x64": "1.3.3",
+ "@img/sharp-libvips-linuxmusl-arm64": "1.3.3",
+ "@img/sharp-libvips-linuxmusl-x64": "1.3.3",
+ "@img/sharp-linux-arm": "0.35.4",
+ "@img/sharp-linux-arm64": "0.35.4",
+ "@img/sharp-linux-ppc64": "0.35.4",
+ "@img/sharp-linux-riscv64": "0.35.4",
+ "@img/sharp-linux-s390x": "0.35.4",
+ "@img/sharp-linux-x64": "0.35.4",
+ "@img/sharp-linuxmusl-arm64": "0.35.4",
+ "@img/sharp-linuxmusl-x64": "0.35.4",
+ "@img/sharp-webcontainers-wasm32": "0.35.4",
+ "@img/sharp-win32-arm64": "0.35.4",
+ "@img/sharp-win32-ia32": "0.35.4",
+ "@img/sharp-win32-x64": "0.35.4"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/supports-color": {
+ "version": "10.2.2",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-10.2.2.tgz",
+ "integrity": "sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/supports-color?sponsor=1"
+ }
+ },
+ "node_modules/tslib": {
+ "version": "2.8.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
+ "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
+ "dev": true,
+ "license": "0BSD",
+ "optional": true
+ },
+ "node_modules/typescript": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-7.0.2.tgz",
+ "integrity": "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "bin": {
+ "tsc": "bin/tsc"
+ },
+ "engines": {
+ "node": ">=16.20.0"
+ },
+ "optionalDependencies": {
+ "@typescript/typescript-aix-ppc64": "7.0.2",
+ "@typescript/typescript-darwin-arm64": "7.0.2",
+ "@typescript/typescript-darwin-x64": "7.0.2",
+ "@typescript/typescript-freebsd-arm64": "7.0.2",
+ "@typescript/typescript-freebsd-x64": "7.0.2",
+ "@typescript/typescript-linux-arm": "7.0.2",
+ "@typescript/typescript-linux-arm64": "7.0.2",
+ "@typescript/typescript-linux-loong64": "7.0.2",
+ "@typescript/typescript-linux-mips64el": "7.0.2",
+ "@typescript/typescript-linux-ppc64": "7.0.2",
+ "@typescript/typescript-linux-riscv64": "7.0.2",
+ "@typescript/typescript-linux-s390x": "7.0.2",
+ "@typescript/typescript-linux-x64": "7.0.2",
+ "@typescript/typescript-netbsd-arm64": "7.0.2",
+ "@typescript/typescript-netbsd-x64": "7.0.2",
+ "@typescript/typescript-openbsd-arm64": "7.0.2",
+ "@typescript/typescript-openbsd-x64": "7.0.2",
+ "@typescript/typescript-sunos-x64": "7.0.2",
+ "@typescript/typescript-win32-arm64": "7.0.2",
+ "@typescript/typescript-win32-x64": "7.0.2"
+ }
+ },
+ "node_modules/undici": {
+ "version": "7.29.0",
+ "resolved": "https://registry.npmjs.org/undici/-/undici-7.29.0.tgz",
+ "integrity": "sha512-IDxfleLmmbSskfWSUATiN1nfn2rDuvnMOqb5CWR92iIfojA0Ud+ulOAAEQ57LPr9rWmsreUyf5lwyao+7GNNVw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=20.18.1"
+ }
+ },
+ "node_modules/unenv": {
+ "version": "2.0.0-rc.24",
+ "resolved": "https://registry.npmjs.org/unenv/-/unenv-2.0.0-rc.24.tgz",
+ "integrity": "sha512-i7qRCmY42zmCwnYlh9H2SvLEypEFGye5iRmEMKjcGi7zk9UquigRjFtTLz0TYqr0ZGLZhaMHl/foy1bZR+Cwlw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "pathe": "^2.0.3"
+ }
+ },
+ "node_modules/workerd": {
+ "version": "1.20260921.1",
+ "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20260921.1.tgz",
+ "integrity": "sha512-4HyG7G1W4ksa6tUZ8bV2jxDRWuL5PXnHm9+Z1sjFPb9OZNoYtXz4y7QQRh4ibi0BF/lOmlAVjbhkUqsAVZuUKA==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "Apache-2.0",
+ "bin": {
+ "workerd": "bin/workerd"
+ },
+ "engines": {
+ "node": ">=16"
+ },
+ "optionalDependencies": {
+ "@cloudflare/workerd-darwin-64": "1.20260921.1",
+ "@cloudflare/workerd-darwin-arm64": "1.20260921.1",
+ "@cloudflare/workerd-linux-64": "1.20260921.1",
+ "@cloudflare/workerd-linux-arm64": "1.20260921.1",
+ "@cloudflare/workerd-windows-64": "1.20260921.1"
+ }
+ },
+ "node_modules/wrangler": {
+ "version": "4.137.0",
+ "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-4.137.0.tgz",
+ "integrity": "sha512-vq2JmxkvwOjnsMUejQwd89/EK6u1d20OMlGUVVmb55gVi2zSBKp2rvmxUiPqrSEntK8NwzpTF3DQ/S2I9/TLsg==",
+ "dev": true,
+ "license": "MIT OR Apache-2.0",
+ "dependencies": {
+ "@cloudflare/kv-asset-handler": "0.5.0",
+ "@cloudflare/unenv-preset": "2.16.2",
+ "blake3-wasm": "2.1.5",
+ "esbuild": "0.28.1",
+ "miniflare": "5.20260921.0-alpha",
+ "path-to-regexp": "6.3.0",
+ "unenv": "2.0.0-rc.24",
+ "workerd": "1.20260921.1"
+ },
+ "bin": {
+ "cf-wrangler": "bin/cf-wrangler.js",
+ "wrangler": "bin/wrangler.js",
+ "wrangler2": "bin/wrangler.js"
+ },
+ "engines": {
+ "node": ">=22.0.0"
+ },
+ "optionalDependencies": {
+ "fsevents": "2.3.3"
+ },
+ "peerDependencies": {
+ "@cloudflare/workers-types": "^5.20260921.1"
+ },
+ "peerDependenciesMeta": {
+ "@cloudflare/workers-types": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/ws": {
+ "version": "8.21.0",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.0.tgz",
+ "integrity": "sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=10.0.0"
+ },
+ "peerDependencies": {
+ "bufferutil": "^4.0.1",
+ "utf-8-validate": ">=5.0.2"
+ },
+ "peerDependenciesMeta": {
+ "bufferutil": {
+ "optional": true
+ },
+ "utf-8-validate": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/youch": {
+ "version": "4.1.0-beta.10",
+ "resolved": "https://registry.npmjs.org/youch/-/youch-4.1.0-beta.10.tgz",
+ "integrity": "sha512-rLfVLB4FgQneDr0dv1oddCVZmKjcJ6yX6mS4pU82Mq/Dt9a3cLZQ62pDBL4AUO+uVrCvtWz3ZFUL2HFAFJ/BXQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@poppinss/colors": "^4.1.5",
+ "@poppinss/dumper": "^0.6.4",
+ "@speed-highlight/core": "^1.2.7",
+ "cookie": "^1.0.2",
+ "youch-core": "^0.3.3"
+ }
+ },
+ "node_modules/youch-core": {
+ "version": "0.3.3",
+ "resolved": "https://registry.npmjs.org/youch-core/-/youch-core-0.3.3.tgz",
+ "integrity": "sha512-ho7XuGjLaJ2hWHoK8yFnsUGy2Y5uDpqSTq1FkHLK4/oqKtyUU1AFbOOxY4IpC9f0fTLjwYbslUz0Po5BpD1wrA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@poppinss/exception": "^1.2.2",
+ "error-stack-parser-es": "^1.0.5"
+ }
+ }
+ }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..ab96f39
--- /dev/null
+++ b/package.json
@@ -0,0 +1,22 @@
+{
+ "name": "cdn",
+ "version": "0.2.0",
+ "description": "Clove's asset host: a Cloudflare Worker serving files from R2, with an SSO-gated upload page.",
+ "type": "module",
+ "private": true,
+ "scripts": {
+ "dev": "wrangler dev",
+ "deploy": "wrangler deploy",
+ "cf-typegen": "wrangler types --env-interface Env",
+ "typecheck": "tsc --noEmit"
+ },
+ "dependencies": {
+ "hono": "^4.13.9",
+ "jose": "^6.2.12"
+ },
+ "devDependencies": {
+ "@cloudflare/workers-types": "^5.20260924.1",
+ "typescript": "^7.0.2",
+ "wrangler": "^4.137.0"
+ }
+}
diff --git a/public/.well-known/gpc.json b/public/.well-known/gpc.json
new file mode 100644
index 0000000..6136783
--- /dev/null
+++ b/public/.well-known/gpc.json
@@ -0,0 +1,4 @@
+{
+ "gpc": true,
+ "lastUpdate": "2026-08-06"
+}
diff --git a/public/.well-known/humans.txt b/public/.well-known/humans.txt
new file mode 100644
index 0000000..6f05cc2
--- /dev/null
+++ b/public/.well-known/humans.txt
@@ -0,0 +1,11 @@
+/* TEAM */
+Owner and Developer: Clove Twilight, AKA Doughmination
+
+/* SITE */
+Built with: HTML, CSS, JS
+Hosted at: doughmination.gay
+Language: English
+
+/* THANKS */
+Ari for helping with some CSS (@AriTheStupidCat on GitHub)
+GitHub for hosting the repo
\ No newline at end of file
diff --git a/public/.well-known/robots.txt b/public/.well-known/robots.txt
new file mode 100644
index 0000000..d4fe14d
--- /dev/null
+++ b/public/.well-known/robots.txt
@@ -0,0 +1,20 @@
+# Dear robots:
+# This file exists to stop bad computers from making bad decisions.
+# If you are a good computer, please follow the rules of this file and let the bad computers be confused by it.
+# Thank you.
+# - Clove, the site owner
+
+
+User-agent: Googlebot
+Disallow:
+User-agent: googlebot-image
+Disallow:
+User-agent: googlebot-mobile
+Disallow:
+User-agent: ClaudeBot
+Disallow:
+User-agent: *
+Content-Signal: search=yes,ai-train=no
+Disallow: /
+Disallow: /cgi-bin/
+Sitemap: /sitemap.xml
\ No newline at end of file
diff --git a/public/.well-known/security.txt b/public/.well-known/security.txt
new file mode 100644
index 0000000..1ba9817
--- /dev/null
+++ b/public/.well-known/security.txt
@@ -0,0 +1,6 @@
+# Security contact for Clove / doughmination.
+# If you find a vulnerability in any of my sites, please reach out.
+Contact: mailto:[email protected]
+Expires: 2027-08-06T00:00:00.000Z
+Preferred-Languages: en
+Canonical: https://m.doughmination.gay/.well-known/security.txt
diff --git a/public/.well-known/ssh.txt b/public/.well-known/ssh.txt
new file mode 100644
index 0000000..ca55979
--- /dev/null
+++ b/public/.well-known/ssh.txt
@@ -0,0 +1,5 @@
+# SSH public keys for Clove / doughmination.
+
+# --- keys below ---
+ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICB3b3zOTNxhLaSZfrjV8RL88X1CK3GqPOmMTP4wwFy1 clove@macbook
+ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBTkYcUaLkDb47BfXz2mGi1nTOjcOtOSb9sEiNqIsWAE [email protected]
diff --git a/public/404.html b/public/404.html
new file mode 100644
index 0000000..227de83
--- /dev/null
+++ b/public/404.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>404 — Not Found</title>
+ <meta name="robots" content="noindex">
+ <link rel="icon" href="/img/avatars/favicon.png" type="image/png">
+ <link rel="stylesheet" href="/style.css">
+</head>
+<body>
+ <main>
+ <h1>404</h1>
+ <p>That asset isn't here. It may have moved — URLs here can change at any point.</p>
+ <p><a href="/">Back home</a></p>
+ </main>
+</body>
+</html>
diff --git a/public/index.html b/public/index.html
new file mode 100644
index 0000000..47ca0e1
--- /dev/null
+++ b/public/index.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>CDN</title>
+ <meta name="description" content="A personal CDN for assets.">
+ <meta name="robots" content="noindex">
+ <meta property="og:type" content="website">
+ <meta property="og:site_name" content="CDN">
+ <meta property="og:title" content="Clove's CDN">
+ <meta property="og:description" content="Assets for Clove's other sites.">
+ <meta property="og:image" content="https://m.doughmination.gay/img/avatars/favicon.png">
+ <meta name="twitter:card" content="summary">
+ <meta name="twitter:title" content="Clove's CDN">
+ <meta name="twitter:description" content="Assets for Clove's other sites.">
+ <meta name="twitter:image" content="https://m.doughmination.gay/img/avatars/favicon.png">
+ <meta name="theme-color" content="#f5a9b8">
+ <link rel="icon" href="/img/avatars/favicon.png" type="image/png">
+ <link rel="stylesheet" href="/style.css">
+</head>
+<body>
+ <main>
+ <div class="flag-stripe"></div>
+ <h1 class="trans-title">Hey, this is my CDN.</h1>
+ <p>
+ Assets for my other sites. Meant for me, but you're welcome to look around.
+ </p>
+ <p class="note">
+ Please don't hotlink. I can change these URLs at any point without
+ warning, so anything pointing here may break.
+ </p>
+
+ <nav class="crumbs" id="crumbs" aria-label="Breadcrumb"></nav>
+ <div class="folderbar" id="folderbar"></div>
+ <input class="filter" id="filter" type="search" placeholder="Filter this folder…" autocomplete="off">
+ <ul class="listing" id="listing"></ul>
+
+ <footer id="footer">
+ <span id="fcount"></span>
+ <a href="/licence.html">Licence</a> ·
+ <a href="/upload">Upload</a>
+ </footer>
+ </main>
+ <script src="/script.js"></script>
+</body>
+</html>
diff --git a/public/licence.html b/public/licence.html
new file mode 100644
index 0000000..6ac85a0
--- /dev/null
+++ b/public/licence.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Licence</title>
+ <meta name="robots" content="noindex">
+ <link rel="icon" href="/img/avatars/favicon.png" type="image/png">
+ <link rel="stylesheet" href="/style.css">
+</head>
+<body>
+ <main>
+ <p><a href="/">← back</a></p>
+ <article class="doc" id="doc">Loading licence…</article>
+ </main>
+
+ <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
+ <script>
+ (async () => {
+ const el = document.getElementById("doc");
+ let md = null;
+ try {
+ md = await (await fetch("/LICENCE.md", { cache: "no-cache" })).text();
+ } catch {
+ el.textContent = "Couldn't load the licence. See /LICENCE.md";
+ return;
+ }
+ const render = window.marked
+ ? (typeof marked.parse === "function" ? marked.parse : marked)
+ : null;
+ if (render) {
+ el.innerHTML = render(md); // trusted, first-party content
+ } else {
+ // Renderer didn't load — show the raw text rather than nothing.
+ el.innerHTML = "";
+ const pre = document.createElement("pre");
+ pre.textContent = md;
+ el.appendChild(pre);
+ }
+ })();
+ </script>
+</body>
+</html>
diff --git a/public/script.js b/public/script.js
new file mode 100644
index 0000000..fe32060
--- /dev/null
+++ b/public/script.js
@@ -0,0 +1,140 @@
+// Directory browser. Reads /api/list (every object in the R2 bucket) and
+// renders folder navigation via the URL hash, e.g. #/f/Comic-Code.
+
+const listing = document.getElementById("listing");
+const crumbs = document.getElementById("crumbs");
+const folderbar = document.getElementById("folderbar");
+const filter = document.getElementById("filter");
+const fcount = document.getElementById("fcount");
+
+let FILES = []; // [{ path, size }]
+let CAN_UPLOAD = false;
+
+// Small blocky stroke icons — replacing the old folder/file/upload emoji.
+const ICON_STYLE = 'style="vertical-align:-2px;margin-right:0.35em"';
+const ICON_FOLDER = `<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="square" ${ICON_STYLE}><path d="M3 6h6l2 3h10v11H3V6z"/></svg>`;
+const ICON_FILE = `<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="square" ${ICON_STYLE}><path d="M5 2h10l4 4v16H5V2z"/><path d="M15 2v4h4"/></svg>`;
+const ICON_UPLOAD = `<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="square" ${ICON_STYLE}><path d="M12 17V4M7 9l5-5 5 5M4 21h16"/></svg>`;
+
+function fmtSize(n) {
+ if (n < 1024) return `${n} B`;
+ if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;
+ return `${(n / (1024 * 1024)).toFixed(1)} MB`;
+}
+
+// Current folder path from the hash, e.g. "f/Comic-Code" ("" = root).
+function currentPath() {
+ const raw = decodeURIComponent(location.hash.replace(/^#\/?/, ""));
+ return raw.replace(/\/+$/, "");
+}
+
+// Immediate children (folders + files) of the given prefix.
+function childrenOf(prefix) {
+ const base = prefix ? prefix + "/" : "";
+ const folders = new Set();
+ const files = [];
+ for (const f of FILES) {
+ if (!f.path.startsWith(base)) continue;
+ const rest = f.path.slice(base.length);
+ const slash = rest.indexOf("/");
+ if (slash === -1) {
+ files.push({ name: rest, path: f.path, size: f.size });
+ } else {
+ folders.add(rest.slice(0, slash));
+ }
+ }
+ return {
+ folders: [...folders].sort((a, b) => a.localeCompare(b)),
+ files: files.sort((a, b) => a.name.localeCompare(b.name)),
+ };
+}
+
+function renderCrumbs(prefix) {
+ const parts = prefix ? prefix.split("/") : [];
+ let acc = "";
+ const links = [`<a href="#/">cdn</a>`];
+ for (const p of parts) {
+ acc = acc ? `${acc}/${p}` : p;
+ links.push(`<a href="#/${encodeURI(acc)}">${p}</a>`);
+ }
+ crumbs.innerHTML = links.join('<span class="sep">/</span>');
+}
+
+function render() {
+ const prefix = currentPath();
+ renderCrumbs(prefix);
+ const { folders, files } = childrenOf(prefix);
+ const q = filter.value.trim().toLowerCase();
+
+ // Uploaders get a shortcut to the upload page, aimed at this folder.
+ folderbar.innerHTML = CAN_UPLOAD
+ ? `<a class="folderbtn" href="/upload#${encodeURI(prefix)}">${ICON_UPLOAD}Upload here</a>`
+ : "";
+
+ const rows = [];
+
+ for (const name of folders) {
+ if (q && !name.toLowerCase().includes(q)) continue;
+ const target = prefix ? `${prefix}/${name}` : name;
+ rows.push(
+ `<li class="row folder">
+ <a class="name" href="#/${encodeURI(target)}">${ICON_FOLDER}${name}/</a>
+ </li>`,
+ );
+ }
+
+ for (const f of files) {
+ if (q && !f.name.toLowerCase().includes(q)) continue;
+ const url = `/${encodeURI(f.path)}`;
+ rows.push(
+ `<li class="row file">
+ <a class="name" href="${url}" target="_blank" rel="noopener">${ICON_FILE}${f.name}</a>
+ <span class="size">${fmtSize(f.size)}</span>
+ <button class="copy" data-path="${f.path}" title="Copy URL">copy</button>
+ </li>`,
+ );
+ }
+
+ listing.innerHTML =
+ rows.join("") || `<li class="row empty">Nothing here.</li>`;
+}
+
+listing.addEventListener("click", (e) => {
+ const btn = e.target.closest("button.copy");
+ if (!btn) return;
+ const url = `${location.origin}/${btn.dataset.path}`;
+ navigator.clipboard?.writeText(url).then(() => {
+ const was = btn.textContent;
+ btn.textContent = "copied";
+ setTimeout(() => (btn.textContent = was), 1200);
+ });
+});
+
+filter.addEventListener("input", render);
+window.addEventListener("hashchange", () => {
+ filter.value = "";
+ render();
+});
+
+async function init() {
+ fcount.textContent = "loading… · ";
+ try {
+ const [res, me] = await Promise.all([
+ fetch("/api/list", { cache: "no-cache" }),
+ fetch("/api/me").then((r) => r.json()).catch(() => null),
+ ]);
+ const data = await res.json();
+ CAN_UPLOAD = Boolean(me);
+ FILES = data.files || [];
+ const count = data.count ?? FILES.length;
+ fcount.textContent =
+ `${count} files · © ${new Date().getFullYear()} · assets may move without notice · `;
+ render();
+ } catch {
+ fcount.textContent = "";
+ listing.innerHTML =
+ `<li class="row empty">Couldn't load the file list.</li>`;
+ }
+}
+
+init();
diff --git a/public/sfx.js b/public/sfx.js
new file mode 100644
index 0000000..2529bc9
--- /dev/null
+++ b/public/sfx.js
@@ -0,0 +1,132 @@
+/* sfx.js
+ * Copyright (c) 2026 Clove Nytrix Doughmination Twilight
+ * Licensed under the DASL-1.0 Licence.
+ * See LICENCE.md in the project root for full licence information.
+ *
+ * UI sounds: hover, click, toggle. On by default, muteable (persisted),
+ * silenced under prefers-reduced-motion. Set window.SFX_BASE to point at the
+ * folder holding hover.mp3 / click.mp3 / toggle.mp3 (defaults to "/sfx/").
+ */
+(function () {
+ var base = window.SFX_BASE || "/sfx/";
+
+ var reduceMotion = window.matchMedia
+ ? window.matchMedia("(prefers-reduced-motion: reduce)").matches
+ : false;
+
+ var STORE_KEY = "sfx-muted";
+
+ function readMuted() {
+ if (reduceMotion) return true;
+ try {
+ return localStorage.getItem(STORE_KEY) === "1";
+ } catch (e) {
+ return false;
+ }
+ }
+
+ var muted = readMuted();
+
+ var names = ["hover", "click", "toggle"];
+
+ var sounds = {};
+ names.forEach(function (name) {
+ var audio = new Audio(base + name + ".mp3");
+ audio.preload = "auto";
+ audio.volume = 0.3;
+ sounds[name] = audio;
+ });
+
+ var lastHover = 0;
+
+ function play(name) {
+ if (muted) return;
+ var audio = sounds[name];
+ if (!audio) return;
+ try {
+ audio.currentTime = 0;
+ var attempt = audio.play();
+ if (attempt && attempt.catch) attempt.catch(function () {});
+ } catch (e) {}
+ }
+
+ var interactive = 'a,button,[role="button"],summary,.row,.copy,.zip';
+ var toggleable = 'input[type="checkbox"],input[type="radio"],[role="switch"]';
+
+ document.addEventListener(
+ "pointerover",
+ function (event) {
+ var el = event.target.closest(interactive);
+ if (!el) return;
+ var now = Date.now();
+ if (now - lastHover < 90) return;
+ lastHover = now;
+ play("hover");
+ },
+ true,
+ );
+
+ document.addEventListener(
+ "click",
+ function (event) {
+ if (event.target.closest(toggleable)) {
+ play("toggle");
+ return;
+ }
+ if (event.target.closest(interactive)) play("click");
+ },
+ true,
+ );
+
+ document.addEventListener(
+ "change",
+ function (event) {
+ if (event.target.matches(toggleable + ",select")) play("toggle");
+ },
+ true,
+ );
+
+ function label() {
+ return muted ? "Unmute interface sounds" : "Mute interface sounds";
+ }
+
+ // Small blocky stroke icon — replacing the old 🔇/🔊 emoji glyphs.
+ var ICON_ATTRS =
+ 'width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="square" style="vertical-align:-2px"';
+
+ function glyph() {
+ var speaker = '<path d="M3 9v6h4l5 4V5L7 9H3z"/>';
+ var waves = muted
+ ? '<path d="M16 9l5 6M21 9l-5 6"/>'
+ : '<path d="M16 8a5 5 0 010 8M19 5a9 9 0 010 14"/>';
+ return "<svg " + ICON_ATTRS + ">" + speaker + waves + "</svg>";
+ }
+
+ function mount() {
+ var button = document.querySelector(".sfx-toggle");
+ if (!button) {
+ button = document.createElement("button");
+ button.className = "sfx-toggle";
+ document.body.appendChild(button);
+ }
+ button.type = "button";
+ button.innerHTML = glyph();
+ button.setAttribute("aria-label", label());
+
+ button.addEventListener("click", function () {
+ muted = !muted;
+ try {
+ localStorage.setItem(STORE_KEY, muted ? "1" : "0");
+ } catch (e) {}
+ button.innerHTML = glyph();
+ button.setAttribute("aria-label", label());
+ if (!muted) play("toggle");
+ });
+ }
+
+ if (document.readyState === "loading") {
+ document.addEventListener("DOMContentLoaded", mount);
+ } else {
+ mount();
+ }
+})();
diff --git a/public/style.css b/public/style.css
new file mode 100644
index 0000000..808967f
--- /dev/null
+++ b/public/style.css
@@ -0,0 +1,339 @@
+@font-face {
+ font-family: "Comic Code";
+ src: url("https://fonts.doughmination.co.uk/ComicCode-Regular_2022-05-24-151938_hsmz.woff2") format("woff2");
+ font-weight: 400;
+ font-style: normal;
+ font-display: swap;
+}
+
+@font-face {
+ font-family: "Comic Code";
+ src: url("https://fonts.doughmination.co.uk/ComicCode-Bold_2022-05-24-152309_zqkm.woff2") format("woff2");
+ font-weight: 700;
+ font-style: normal;
+ font-display: swap;
+}
+
+:root {
+ --bg: #0a0b10;
+ --bg-deep: #05060a;
+ --fg: #f4f6fb;
+ --muted: #9aa3c2;
+ --accent: #f5a9b8;
+ --accent-alt: #d15f8c;
+ --panel: #12141c;
+ --border: #232838;
+}
+
+* { box-sizing: border-box; }
+
+/* Trans-flag stripe, run above the title instead of animating it as gradient
+ text — same move as the terminal/clunky redesign across the other sites. */
+.flag-stripe {
+ height: 3px;
+ width: 72px;
+ margin: 0 0 0.9rem;
+ background: repeating-linear-gradient(
+ 90deg,
+ #5BCEFA 0 20%, #F5A9B8 20% 40%, #ffffff 40% 60%, #F5A9B8 60% 80%, #5BCEFA 80% 100%
+ );
+}
+
+.trans-title {
+ font-weight: 700;
+ letter-spacing: -0.01em;
+ text-transform: uppercase;
+ color: var(--fg);
+}
+
+html, body {
+ margin: 0;
+ min-height: 100%;
+}
+
+body {
+ background: var(--bg);
+ color: var(--fg);
+ font: 16px/1.6 "Comic Code", ui-monospace, SFMono-Regular, Menlo, monospace;
+ display: flex;
+ justify-content: center;
+ padding: 2rem;
+}
+
+main {
+ max-width: 44rem;
+ width: 100%;
+}
+
+h1 {
+ margin: 0 0 1rem;
+ font-size: 1.8rem;
+}
+
+p { margin: 0 0 1rem; }
+
+.note {
+ color: var(--muted);
+ border-left: 3px solid var(--accent);
+ padding-left: 0.9rem;
+ font-size: 0.95rem;
+}
+
+a { color: var(--accent); }
+
+/* Breadcrumbs */
+.crumbs {
+ margin: 1.5rem 0 0.75rem;
+ font-size: 0.95rem;
+}
+
+.crumbs a { text-decoration: none; }
+.crumbs a:hover { text-decoration: underline; }
+
+.crumbs .sep {
+ color: var(--muted);
+ margin: 0 0.4rem;
+}
+
+/* Filter */
+.filter {
+ width: 100%;
+ background: var(--panel);
+ color: var(--fg);
+ border: 1px solid var(--border);
+ border-radius: 0;
+ padding: 0.5rem 0.75rem;
+ font: inherit;
+ font-size: 0.95rem;
+ margin-bottom: 1rem;
+}
+
+.filter:focus {
+ outline: none;
+ border-color: var(--accent);
+}
+
+/* Folder action bar */
+.folderbar {
+ margin-bottom: 1rem;
+}
+
+.folderbar:empty {
+ margin-bottom: 0;
+}
+
+.folderbtn,
+.btn {
+ display: inline-block;
+ background: var(--panel);
+ border: 1px solid var(--accent);
+ border-radius: 0;
+ padding: 0.4rem 0.8rem;
+ font: inherit;
+ font-size: 0.9rem;
+ text-decoration: none;
+ color: var(--fg);
+ cursor: pointer;
+}
+
+.folderbtn:hover,
+.btn:hover:not(:disabled) {
+ background: var(--accent);
+ color: #14121a;
+}
+
+.btn:disabled {
+ border-color: var(--border);
+ color: var(--muted);
+ cursor: default;
+}
+
+/* Listing */
+.listing {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+ border: 1px solid var(--border);
+ border-radius: 0;
+ overflow: hidden;
+}
+
+.row {
+ display: flex;
+ align-items: center;
+ gap: 0.75rem;
+ padding: 0.5rem 0.9rem;
+ border-top: 1px solid var(--border);
+}
+
+.row:first-child { border-top: none; }
+.row:hover { background: var(--panel); }
+
+.row .name {
+ flex: 1;
+ min-width: 0;
+ text-decoration: none;
+ color: var(--fg);
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.row.folder .name { color: var(--accent); }
+.row .name:hover { text-decoration: underline; }
+
+.row .size {
+ color: var(--muted);
+ font-size: 0.85rem;
+ white-space: nowrap;
+}
+
+.row .copy {
+ background: transparent;
+ color: var(--muted);
+ border: 1px solid var(--border);
+ border-radius: 0;
+ padding: 0.15rem 0.55rem;
+ font: inherit;
+ font-size: 0.8rem;
+ cursor: pointer;
+}
+
+.row .copy:hover {
+ color: var(--fg);
+ border-color: var(--accent);
+}
+
+.row.empty {
+ color: var(--muted);
+ justify-content: center;
+}
+
+footer {
+ margin-top: 2rem;
+ color: var(--muted);
+ font-size: 0.85rem;
+}
+
+/* Upload page */
+.field {
+ display: block;
+ margin: 1.5rem 0 1rem;
+}
+
+.field .label {
+ display: block;
+ color: var(--muted);
+ font-size: 0.85rem;
+ margin-bottom: 0.3rem;
+}
+
+.field .filter { margin-bottom: 0; }
+
+.drop {
+ display: block;
+ border: 1px dashed var(--border);
+ padding: 2rem 1rem;
+ text-align: center;
+ color: var(--muted);
+ cursor: pointer;
+ margin-bottom: 1rem;
+}
+
+.drop:hover,
+.drop.over,
+.drop:focus-within {
+ border-color: var(--accent);
+ color: var(--fg);
+}
+
+.drop input {
+ position: absolute;
+ width: 1px;
+ height: 1px;
+ opacity: 0;
+}
+
+.actions {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ gap: 1rem;
+ margin-bottom: 1rem;
+ font-size: 0.9rem;
+}
+
+.actions label { color: var(--muted); }
+.actions input { accent-color: var(--accent); }
+
+.row .status {
+ color: var(--muted);
+ font-size: 0.85rem;
+ white-space: nowrap;
+}
+
+.row .status.ok { color: var(--accent); }
+.row .status.err { color: #ff6b81; white-space: normal; text-align: right; }
+
+.row .remove {
+ background: transparent;
+ color: var(--muted);
+ border: 1px solid var(--border);
+ border-radius: 0;
+ padding: 0.15rem 0.55rem;
+ font: inherit;
+ font-size: 0.8rem;
+ cursor: pointer;
+}
+
+.row .remove:hover { color: var(--fg); border-color: var(--accent); }
+
+@media (max-width: 520px) {
+ body { padding: 1.25rem 1rem; }
+ .row { flex-wrap: wrap; }
+}
+
+/* Rendered markdown (licence page) */
+.doc {
+ line-height: 1.7;
+}
+
+.doc h1 {
+ font-size: 1.5rem;
+ margin: 1.8rem 0 0.75rem;
+}
+
+.doc h2 {
+ font-size: 1.2rem;
+ margin: 1.5rem 0 0.6rem;
+}
+
+.doc h3 { font-size: 1.05rem; }
+
+.doc hr {
+ border: none;
+ border-top: 1px solid var(--border);
+ margin: 1.6rem 0;
+}
+
+.doc ul,
+.doc ol {
+ padding-left: 1.3rem;
+}
+
+.doc li { margin: 0.3rem 0; }
+
+.doc a { color: var(--accent); }
+
+.doc code {
+ background: var(--panel);
+ border: 1px solid var(--border);
+ border-radius: 0;
+ padding: 0.1rem 0.35rem;
+ font-size: 0.9em;
+}
+
+.doc pre {
+ white-space: pre-wrap;
+ word-break: break-word;
+}
diff --git a/public/upload.html b/public/upload.html
new file mode 100644
index 0000000..19d852d
--- /dev/null
+++ b/public/upload.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Upload</title>
+ <meta name="robots" content="noindex">
+ <meta name="theme-color" content="#f5a9b8">
+ <link rel="icon" href="/img/avatars/favicon.png" type="image/png">
+ <link rel="stylesheet" href="/style.css">
+</head>
+<body>
+ <main>
+ <div class="flag-stripe"></div>
+ <h1 class="trans-title">Upload</h1>
+ <p class="note">
+ Signed in as <strong id="who">…</strong> · <a href="/logout">Sign out</a> · <a href="/">Browse</a>
+ </p>
+
+ <label class="field">
+ <span class="label">Folder (blank for the top level)</span>
+ <input class="filter" id="folder" type="text" list="folders" placeholder="img/avatars" autocomplete="off" spellcheck="false">
+ <datalist id="folders"></datalist>
+ </label>
+
+ <label class="drop" id="drop">
+ <input id="picker" type="file" multiple>
+ Drop files here, or click to pick them.
+ </label>
+
+ <div class="actions">
+ <button class="btn" id="go" type="button" disabled>Upload</button>
+ <label><input id="overwrite" type="checkbox"> Replace files that already exist</label>
+ <span id="summary"></span>
+ </div>
+
+ <ul class="listing" id="queue"></ul>
+ </main>
+ <script src="/upload.js"></script>
+</body>
+</html>
diff --git a/public/upload.js b/public/upload.js
new file mode 100644
index 0000000..72a4103
--- /dev/null
+++ b/public/upload.js
@@ -0,0 +1,176 @@
+// Upload page. Files go one at a time as raw PUTs to /api/files/<path>; the
+// worker checks the SSO session and writes them into the R2 bucket.
+
+const folderInput = document.getElementById("folder");
+const folderList = document.getElementById("folders");
+const drop = document.getElementById("drop");
+const picker = document.getElementById("picker");
+const go = document.getElementById("go");
+const overwrite = document.getElementById("overwrite");
+const summary = document.getElementById("summary");
+const queueEl = document.getElementById("queue");
+
+// [{ file, status: "waiting" | "uploading" | "done" | "error", progress, message, url }]
+let queue = [];
+let busy = false;
+
+function fmtSize(n) {
+ if (n < 1024) return `${n} B`;
+ if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;
+ return `${(n / (1024 * 1024)).toFixed(1)} MB`;
+}
+
+function esc(s) {
+ return s.replace(/[&<>"']/g, (ch) => `&#${ch.charCodeAt(0)};`);
+}
+
+function folder() {
+ return folderInput.value.trim().replace(/^\/+|\/+$/g, "").replace(/\/{2,}/g, "/");
+}
+
+function encodePath(path) {
+ return path.split("/").map(encodeURIComponent).join("/");
+}
+
+function render() {
+ const rows = queue.map((item, i) => {
+ let status;
+ if (item.status === "uploading") status = `<span class="status">${item.progress}%</span>`;
+ else if (item.status === "done") {
+ status = `<span class="status ok">done</span>
+ <button class="copy" data-url="${esc(item.url)}" title="Copy URL">copy</button>`;
+ } else if (item.status === "error") status = `<span class="status err">${esc(item.message)}</span>`;
+ else status = busy ? `<span class="status">waiting</span>` : `<button class="remove" data-i="${i}">remove</button>`;
+
+ const name = item.status === "done"
+ ? `<a class="name" href="${esc(item.url)}" target="_blank" rel="noopener">${esc(item.file.name)}</a>`
+ : `<span class="name">${esc(item.file.name)}</span>`;
+ return `<li class="row file">${name}<span class="size">${fmtSize(item.file.size)}</span>${status}</li>`;
+ });
+ queueEl.innerHTML = rows.join("") || `<li class="row empty">No files picked yet.</li>`;
+
+ const pending = queue.filter((q) => q.status === "waiting" || q.status === "error").length;
+ go.disabled = busy || pending === 0;
+ go.textContent = pending > 1 ? `Upload ${pending} files` : "Upload";
+
+ const done = queue.filter((q) => q.status === "done").length;
+ summary.textContent = done ? `${done} uploaded` : "";
+}
+
+function add(files) {
+ for (const file of files) {
+ // Picking the same name again replaces the earlier pick.
+ queue = queue.filter((q) => q.file.name !== file.name || q.status === "done");
+ queue.push({ file, status: "waiting", progress: 0, message: "", url: "" });
+ }
+ render();
+}
+
+function put(item) {
+ return new Promise((resolve) => {
+ const path = folder() ? `${folder()}/${item.file.name}` : item.file.name;
+ const xhr = new XMLHttpRequest();
+ xhr.open("PUT", `/api/files/${encodePath(path)}${overwrite.checked ? "?overwrite=1" : ""}`);
+ if (item.file.type) xhr.setRequestHeader("Content-Type", item.file.type);
+ xhr.upload.onprogress = (e) => {
+ if (!e.lengthComputable) return;
+ item.progress = Math.round((e.loaded / e.total) * 100);
+ render();
+ };
+ xhr.onload = () => {
+ let body = null;
+ try { body = JSON.parse(xhr.responseText); } catch {}
+ if (xhr.status === 201 && body) {
+ item.status = "done";
+ item.url = body.url;
+ } else {
+ item.status = "error";
+ item.message = (body && body.error) || (xhr.status === 413 ? "Too big for one upload." : `Failed (${xhr.status}).`);
+ }
+ resolve();
+ };
+ xhr.onerror = () => {
+ item.status = "error";
+ item.message = "Network error.";
+ resolve();
+ };
+ item.status = "uploading";
+ item.progress = 0;
+ render();
+ xhr.send(item.file);
+ });
+}
+
+go.addEventListener("click", async () => {
+ busy = true;
+ for (const item of queue) {
+ if (item.status === "waiting" || item.status === "error") await put(item);
+ }
+ busy = false;
+ render();
+ loadFolders();
+});
+
+picker.addEventListener("change", () => {
+ add(picker.files);
+ picker.value = "";
+});
+
+for (const type of ["dragenter", "dragover"]) {
+ drop.addEventListener(type, (e) => {
+ e.preventDefault();
+ drop.classList.add("over");
+ });
+}
+for (const type of ["dragleave", "drop"]) {
+ drop.addEventListener(type, () => drop.classList.remove("over"));
+}
+drop.addEventListener("drop", (e) => {
+ e.preventDefault();
+ add(e.dataTransfer.files);
+});
+
+queueEl.addEventListener("click", (e) => {
+ const remove = e.target.closest("button.remove");
+ if (remove) {
+ queue.splice(Number(remove.dataset.i), 1);
+ render();
+ return;
+ }
+ const copy = e.target.closest("button.copy");
+ if (copy) {
+ navigator.clipboard?.writeText(copy.dataset.url).then(() => {
+ copy.textContent = "copied";
+ setTimeout(() => (copy.textContent = "copy"), 1200);
+ });
+ }
+});
+
+// Suggest existing folders.
+async function loadFolders() {
+ try {
+ const data = await (await fetch("/api/list", { cache: "no-store" })).json();
+ const dirs = new Set();
+ for (const f of data.files || []) {
+ const parts = f.path.split("/");
+ for (let i = 1; i < parts.length; i++) dirs.add(parts.slice(0, i).join("/"));
+ }
+ folderList.innerHTML = [...dirs].sort().map((d) => `<option value="${esc(d)}">`).join("");
+ } catch {}
+}
+
+async function init() {
+ // "Upload here" from the browser links to /upload#<folder>.
+ const fromHash = decodeURIComponent(location.hash.replace(/^#\/?/, ""));
+ if (fromHash) folderInput.value = fromHash;
+
+ try {
+ const me = await (await fetch("/api/me")).json();
+ document.getElementById("who").textContent = me ? `@${me.username}` : "nobody";
+ } catch {}
+
+ render();
+ loadFolders();
+}
+
+init();
diff --git a/scripts/README.md b/scripts/README.md
new file mode 100644
index 0000000..0ad164e
--- /dev/null
+++ b/scripts/README.md
@@ -0,0 +1,48 @@
+# MMD → glb converter
+
+Converts MikuMikuDanceFR `.pmx` models (e.g. the official HoYoverse Genshin
+releases) into web-ready `.glb` for the `/genshin` gallery. Target renderer is
+`<model-viewer>` (standard PBR), so only geometry, normals, UVs and each
+material's **base** texture are kept — sphere maps, toon ramps and morphs are
+dropped (model-viewer can't display them anyway). Handedness is converted from
+MMD (left-handed) to glTF (right-handed).de
+
+## Folders
+
+- `models-src/` — raw model downloads live here. **Not** under `public/`, so the
+ `.pmx` + textures are never served to the web. Drop each extracted model folder
+ in here (keep each `.pmx` next to its texture folder).
+- `public/models/` — the converted `.glb` files that the site actually serves.
+
+## One-time setup
+
+```bash
+python3 -m venv .venv && source .venv/bin/activate
+pip install -r scripts/requirements.txt
+```
+
+## Convert a model
+
+Run from the project root:
+
+```bash
+python3 scripts/pmx2glb.py "models-src/<folder>/<model>.pmx" "public/models/<name>.glb"
+```
+
+Example:
+
+```bash
+python3 scripts/pmx2glb.py "models-src/paimon/派蒙1.0.pmx" "public/models/paimon.glb"
+```
+
+Then add a card in `src/app/genshin/page.tsx` pointing `model` at the new file.
+
+## Notes
+
+- If a `.rar` won't extract in Finder, install "The Unarchiver" from the App
+ Store, or extract with `libarchive` in Python.
+- Chinese/Japanese texture filenames are handled automatically.
+- Textures larger than 2048px are downscaled to keep `.glb` sizes reasonable
+ (tweak `MAX_TEX` in `pmx2glb.py` to change this).
+- The script monkey-patches `pymeshio` to read "extended UV" vertices that newer
+ Genshin models use — stock pymeshio errors on them.
diff --git a/scripts/pmx2glb.py b/scripts/pmx2glb.py
new file mode 100644
index 0000000..d2d61d8
--- /dev/null
+++ b/scripts/pmx2glb.py
@@ -0,0 +1,269 @@
+#!/usr/bin/env python3
+# personal/scripts/pmx2glb.py
+# Copyright (c) 2026 Clove Nytrix Doughmination Twilight
+# Licensed under the DASL-1.0 Licence.
+# See LICENCE.md in the project root for full licence information.
+
+"""pmx2glb.py — convert an MMD .pmx model to a self-contained .glb.
+
+Target renderer is <model-viewer> (standard PBR), so we deliberately keep only
+what PBR can show: geometry, normals, UVs and each material's *base* texture.
+Sphere maps, toon ramps and morphs are dropped (model-viewer can't display them
+anyway). Handedness is converted MMD left-handed -> glTF right-handed by negating
+Z and reversing triangle winding.
+"""
+import io, json, os, struct, sys, glob
+from PIL import Image
+from pymeshio import common, pmx as pmxmod
+from pymeshio.pmx import reader
+
+# --- Patch pymeshio: support "extended UV" vertices (extra vec4 UV sets that
+# newer Genshin models carry). Stock pymeshio raises on them (and its exception
+# is itself buggy). We store the count and skip the extra UV floats per vertex. ---
+_orig_init = reader.Reader.__init__
+
+
+def _patched_init(self, ios, text_encoding, extended_uv, vertex_index_size,
+ texture_index_size, material_index_size, bone_index_size,
+ morph_index_size, rigidbody_index_size):
+ common.BinaryReader.__init__(self, ios)
+ self.extended_uv = extended_uv
+ self.read_text = self.get_read_text(text_encoding)
+ if vertex_index_size <= 2:
+ self.read_vertex_index = lambda: self.read_uint(vertex_index_size)
+ else:
+ self.read_vertex_index = lambda: self.read_int(vertex_index_size)
+ self.read_texture_index = lambda: self.read_int(texture_index_size)
+ self.read_material_index = lambda: self.read_int(material_index_size)
+ self.read_bone_index = lambda: self.read_int(bone_index_size)
+ self.read_morph_index = lambda: self.read_int(morph_index_size)
+ self.read_rigidbody_index = lambda: self.read_int(rigidbody_index_size)
+
+
+def _patched_read_vertex(self):
+ pos = self.read_vector3()
+ nrm = self.read_vector3()
+ uv = self.read_vector2()
+ for _ in range(4 * getattr(self, "extended_uv", 0)):
+ self.read_float() # discard extra UV channels
+ return pmxmod.Vertex(pos, nrm, uv, self.read_deform(), self.read_float())
+
+
+reader.Reader.__init__ = _patched_init
+reader.Reader.read_vertex = _patched_read_vertex
+
+MAX_TEX = 2048 # cap texture dimension to keep glb sizes sane
+
+
+def find_texture(pmx_dir, rel):
+ rel = rel.replace("\\", "/")
+ cand = os.path.normpath(os.path.join(pmx_dir, rel))
+ if os.path.isfile(cand):
+ return cand
+ # case-insensitive / loose fallback
+ base = os.path.basename(rel).lower()
+ for root, _dirs, files in os.walk(pmx_dir):
+ for f in files:
+ if f.lower() == base:
+ return os.path.join(root, f)
+ return None
+
+
+def load_png_bytes(path):
+ im = Image.open(path).convert("RGBA")
+ if max(im.size) > MAX_TEX:
+ s = MAX_TEX / max(im.size)
+ im = im.resize((max(1, int(im.size[0] * s)), max(1, int(im.size[1] * s))))
+ # A texture only counts as "transparent" if it has real cut-out regions
+ # (pixels that are actually see-through), not merely a fully-opaque alpha
+ # channel. Many MMD PNGs carry an all-opaque alpha; treating those as
+ # transparent makes <model-viewer> depth-sort them and the model renders
+ # see-through / inside-out. Threshold at 128 = genuine holes only.
+ lo = im.getchannel("A").getextrema()[0]
+ has_cutout = lo < 128
+ buf = io.BytesIO()
+ im.save(buf, format="PNG")
+ return buf.getvalue(), has_cutout
+
+
+def pad4(b, fill=b"\x00"):
+ r = (4 - (len(b) % 4)) % 4
+ return b + fill * r if r else b
+
+
+def convert(pmx_path, out_path):
+ pmx_dir = os.path.dirname(pmx_path)
+ m = reader.read_from_file(pmx_path)
+ verts = m.vertices
+
+ # --- attribute buffers (Z negated for LH->RH) ---
+ pos = bytearray(); nrm = bytearray(); uv = bytearray()
+ pmin = [1e30, 1e30, 1e30]; pmax = [-1e30, -1e30, -1e30]
+ for v in verts:
+ px, py, pz = v.position.x, v.position.y, -v.position.z
+ nx, ny, nz = v.normal.x, v.normal.y, -v.normal.z
+ pos += struct.pack("<3f", px, py, pz)
+ nrm += struct.pack("<3f", nx, ny, nz)
+ uv += struct.pack("<2f", v.uv.x, v.uv.y)
+ for k, val in enumerate((px, py, pz)):
+ pmin[k] = min(pmin[k], val); pmax[k] = max(pmax[k], val)
+
+ # --- unique textures -> embedded PNG bufferViews ---
+ tex_cache = {} # pmx texture_index -> (image_index, has_alpha)
+ images = [] # list of (png_bytes,)
+ for ti, rel in enumerate(m.textures):
+ p = find_texture(pmx_dir, rel)
+ if not p:
+ continue
+ try:
+ data, has_cutout = load_png_bytes(p)
+ except Exception as e:
+ print(f" ! texture skip {rel}: {e}")
+ continue
+ tex_cache[ti] = (len(images), has_cutout)
+ images.append(data)
+
+ # --- per-material index runs (winding reversed) ---
+ idx = m.indices
+ mat_prims = [] # (index_bytes, count, gltf_material_dict)
+ off = 0
+ for mat in m.materials:
+ n = mat.vertex_count
+ run = idx[off:off + n]
+ off += n
+ ib = bytearray()
+ for t in range(0, len(run), 3):
+ a, b, c = run[t], run[t + 1], run[t + 2]
+ ib += struct.pack("<3I", a, c, b) # reverse winding
+ col = mat.diffuse_color
+ alpha = getattr(mat, "alpha", 1.0)
+ pbr = {
+ "baseColorFactor": [1.0, 1.0, 1.0, float(alpha)],
+ "metallicFactor": 0.0,
+ "roughnessFactor": 0.9,
+ }
+ # Transparency policy that survives a real-time PBR renderer:
+ # - texture with genuine cut-outs -> MASK (no depth sorting needed)
+ # - uniformly semi-transparent material (mat.alpha < 1) -> BLEND
+ # - everything else -> OPAQUE
+ # This avoids the see-through/inside-out look you get when every
+ # alpha-channel texture is naively marked BLEND.
+ alpha_mode = "OPAQUE"
+ alpha_cutoff = None
+ if mat.texture_index in tex_cache:
+ img_i, has_cutout = tex_cache[mat.texture_index]
+ pbr["baseColorTexture"] = {"index": img_i}
+ if has_cutout:
+ alpha_mode = "MASK"
+ alpha_cutoff = 0.5
+ else:
+ pbr["baseColorFactor"] = [col.r, col.g, col.b, float(alpha)]
+ if alpha < 1.0:
+ alpha_mode = "BLEND"
+ alpha_cutoff = None
+ gmat = {
+ "name": (mat.name or f"mat{len(mat_prims)}")[:40],
+ "pbrMetallicRoughness": pbr,
+ "doubleSided": True,
+ "alphaMode": alpha_mode,
+ }
+ if alpha_cutoff is not None:
+ gmat["alphaCutoff"] = alpha_cutoff
+ mat_prims.append((bytes(ib), len(run), gmat))
+
+ # ---- assemble single binary buffer ----
+ blob = bytearray()
+ bviews = []
+
+ def add_view(data, target=None):
+ data = pad4(bytes(data))
+ bv = {"buffer": 0, "byteOffset": len(blob), "byteLength": len(data)}
+ if target:
+ bv["target"] = target
+ blob.extend(data)
+ bviews.append(bv)
+ return len(bviews) - 1
+
+ pos_bv = add_view(pos, 34962)
+ nrm_bv = add_view(nrm, 34962)
+ uv_bv = add_view(uv, 34962)
+
+ accessors = [
+ {"bufferView": pos_bv, "componentType": 5126, "count": len(verts),
+ "type": "VEC3", "min": pmin, "max": pmax},
+ {"bufferView": nrm_bv, "componentType": 5126, "count": len(verts), "type": "VEC3"},
+ {"bufferView": uv_bv, "componentType": 5126, "count": len(verts), "type": "VEC2"},
+ ]
+
+ primitives = []
+ materials = []
+ for ib, count, gmat in mat_prims:
+ if count == 0:
+ continue
+ ibv = add_view(ib, 34963)
+ acc = len(accessors)
+ accessors.append({"bufferView": ibv, "componentType": 5125,
+ "count": count, "type": "SCALAR"})
+ materials.append(gmat)
+ primitives.append({
+ "attributes": {"POSITION": 0, "NORMAL": 1, "TEXCOORD_0": 2},
+ "indices": acc, "material": len(materials) - 1,
+ })
+
+ gltf_images, gltf_textures = [], []
+ for i, data in enumerate(images):
+ ibv = add_view(data)
+ gltf_images.append({"bufferView": ibv, "mimeType": "image/png"})
+ gltf_textures.append({"source": i, "sampler": 0})
+
+ gltf = {
+ "asset": {"version": "2.0", "generator": "pmx2glb"},
+ "scene": 0,
+ "scenes": [{"nodes": [0]}],
+ "nodes": [{"mesh": 0, "name": m.name or "model"}],
+ "meshes": [{"name": m.name or "model", "primitives": primitives}],
+ "materials": materials,
+ "buffers": [{"byteLength": len(blob)}],
+ "bufferViews": bviews,
+ "accessors": accessors,
+ }
+ if gltf_images:
+ gltf["images"] = gltf_images
+ gltf["textures"] = gltf_textures
+ gltf["samplers"] = [{"magFilter": 9729, "minFilter": 9987,
+ "wrapS": 10497, "wrapT": 10497}]
+
+ json_chunk = pad4(json.dumps(gltf, ensure_ascii=False).encode("utf-8"), b" ")
+ bin_chunk = pad4(bytes(blob))
+
+ def chunk(ctype, data):
+ return struct.pack("<II", len(data), ctype) + data
+
+ jc = chunk(0x4E4F534A, json_chunk)
+ bc = chunk(0x004E4942, bin_chunk)
+ total = 12 + len(jc) + len(bc)
+ header = struct.pack("<III", 0x46546C67, 2, total)
+ with open(out_path, "wb") as f:
+ f.write(header + jc + bc)
+
+ print(f" -> {os.path.basename(out_path)}: "
+ f"{len(verts)} verts, {sum(c for _, c, _ in mat_prims)//3} tris, "
+ f"{len(materials)} prims, {len(images)} textures, "
+ f"{total/1024/1024:.2f} MB")
+
+
+if __name__ == "__main__":
+ if len(sys.argv) < 2:
+ print("usage: python3 scripts/pmx2glb.py <input.pmx> [output.glb]")
+ print(" if output is omitted, writes public/models/<input-name>.glb")
+ sys.exit(1)
+ pmx = sys.argv[1]
+ if len(sys.argv) >= 3:
+ out = sys.argv[2]
+ else:
+ # default: public/models/<pmx-filename>.glb (relative to project root)
+ stem = os.path.splitext(os.path.basename(pmx))[0]
+ out = os.path.join("public", "models", stem + ".glb")
+ os.makedirs(os.path.dirname(out) or ".", exist_ok=True)
+ print(f" converting {os.path.basename(pmx)} -> {out}")
+ convert(pmx, out)
diff --git a/scripts/rename.py b/scripts/rename.py
new file mode 100644
index 0000000..ecf17a7
--- /dev/null
+++ b/scripts/rename.py
@@ -0,0 +1,159 @@
+#!/usr/bin/env python3
+
+import json
+import re
+import time
+from pathlib import Path
+from urllib.request import Request, urlopen
+from urllib.error import HTTPError, URLError
+
+# Set this to True once you're happy with the output.
+RENAME = True
+
+API = "https://api.pluralkit.me/v2/members/"
+USER_AGENT = "PluralKit Avatar Renamer/1.0"
+
+IMAGE_EXTENSIONS = {".webp", ".png", ".jpg", ".jpeg"}
+
+
+def get_member(member_id):
+ url = API + member_id
+
+ request = Request(
+ url,
+ headers={
+ "User-Agent": USER_AGENT
+ }
+ )
+
+ try:
+ with urlopen(request, timeout=10) as response:
+ return json.load(response)
+
+ except HTTPError as e:
+ if e.code == 404:
+ print(f" [!] Member {member_id} does not exist")
+ else:
+ print(f" [!] API error for {member_id}: HTTP {e.code}")
+ return None
+
+ except URLError as e:
+ print(f" [!] Network error for {member_id}: {e}")
+ return None
+
+
+def sanitise_filename(name):
+ # Remove characters that aren't valid/useful in filenames.
+ name = re.sub(r'[<>:"/\\|?*\x00-\x1f]', '_', name)
+
+ # Avoid accidental leading/trailing whitespace.
+ name = name.strip()
+
+ # Avoid Windows-reserved names too, just in case.
+ if name.upper() in {
+ "CON", "PRN", "AUX", "NUL",
+ "COM1", "COM2", "COM3", "COM4", "COM5",
+ "COM6", "COM7", "COM8", "COM9",
+ "LPT1", "LPT2", "LPT3", "LPT4", "LPT5",
+ "LPT6", "LPT7", "LPT8", "LPT9",
+ }:
+ name = "_" + name
+
+ return name or "unknown"
+
+
+def main():
+ directory = Path.cwd()
+
+ files = sorted(
+ p for p in directory.iterdir()
+ if p.is_file()
+ and p.suffix.lower() in IMAGE_EXTENSIONS
+ and p.name.startswith("avatar-")
+ )
+
+ if not files:
+ print("No avatar files found.")
+ return
+
+ print(f"Found {len(files)} avatar(s).\n")
+
+ planned = []
+
+ for index, file in enumerate(files):
+ # avatar-abbxvw.webp -> abbxvw
+ member_id = file.stem.removeprefix("avatar-")
+
+ print(f"{file.name}")
+ print(f" Member ID: {member_id}")
+
+ member = get_member(member_id)
+
+ if member is None:
+ print(" -> SKIPPED\n")
+ continue
+
+ name = member.get("name")
+
+ if not name:
+ print(" -> Member has no name, skipped\n")
+ continue
+
+ name = sanitise_filename(name)
+
+ destination = directory / f"{name}{file.suffix.lower()}"
+
+ # Deal with duplicate member names.
+ if destination.exists() and destination != file:
+ counter = 2
+
+ while True:
+ candidate = directory / f"{name} ({counter}){file.suffix.lower()}"
+
+ if not candidate.exists():
+ destination = candidate
+ break
+
+ counter += 1
+
+ print(f" Name: {name}")
+ print(f" Rename: {file.name} -> {destination.name}")
+
+ planned.append((file, destination))
+
+ print()
+
+ # PluralKit currently allows 10 GET requests/sec.
+ # 0.12 gives us a little breathing room.
+ time.sleep(0.12)
+
+ print("=" * 60)
+
+ if not planned:
+ print("Nothing to rename.")
+ return
+
+ if not RENAME:
+ print("DRY RUN — no files were changed.")
+ print()
+ print("If everything looks correct, change:")
+ print()
+ print(" RENAME = False")
+ print()
+ print("to:")
+ print()
+ print(" RENAME = True")
+ return
+
+ print("Renaming files...\n")
+
+ for source, destination in planned:
+ try:
+ source.rename(destination)
+ print(f"[OK] {source.name} -> {destination.name}")
+ except OSError as e:
+ print(f"[!] Failed to rename {source.name}: {e}")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/scripts/requirements.txt b/scripts/requirements.txt
new file mode 100644
index 0000000..0b32a9d
--- /dev/null
+++ b/scripts/requirements.txt
@@ -0,0 +1,3 @@
+pymeshio==3.0.1
+pygltflib>=1.16
+Pillow>=10.0
diff --git a/scripts/update_avatars.py b/scripts/update_avatars.py
new file mode 100644
index 0000000..c0de426
--- /dev/null
+++ b/scripts/update_avatars.py
@@ -0,0 +1,135 @@
+#!/usr/bin/env python3
+"""
+Update PluralKit member avatar_urls to point at the CDN copies in pk/avatars.
+
+Matches each <name>.png file in pk/avatars/ to a system member by name
+(exact match, case-insensitive; falls back to fuzzy matching with a
+confirmation prompt), then PATCHes that member's avatar_url to:
+
+ https://m.doughmination.gay/pk/avatars/<name>.png
+
+Run from anywhere; it always looks at pk/avatars/ next to the repo root
+(one level up from this script's scripts/ folder).
+Requires the `requests` package.
+"""
+
+import difflib
+import getpass
+import sys
+from pathlib import Path
+
+import requests
+
+API_BASE = "https://api.pluralkit.me/v2"
+CDN_BASE = "https://m.doughmination.gay/pk/avatars"
+AVATARS_DIR = Path(__file__).resolve().parent.parent / "pk" / "avatars"
+FUZZY_CUTOFF = 0.6 # difflib similarity threshold for suggesting a fuzzy match
+
+
+def get_members(token: str) -> list[dict]:
+ resp = requests.get(
+ f"{API_BASE}/systems/@me/members",
+ headers={"Authorization": token},
+ timeout=30,
+ )
+ resp.raise_for_status()
+ return resp.json()
+
+
+def find_match(stem: str, members: list[dict], by_name: dict[str, dict]) -> dict | None:
+ lower = stem.lower()
+
+ # exact match on name or display_name (case-insensitive)
+ if lower in by_name:
+ return by_name[lower]
+
+ # fuzzy fallback, confirmed interactively
+ candidates = difflib.get_close_matches(lower, by_name.keys(), n=3, cutoff=FUZZY_CUTOFF)
+ if not candidates:
+ return None
+
+ print(f"\n No exact match for '{stem}'. Closest candidates:")
+ options = [by_name[c] for c in candidates]
+ for i, m in enumerate(options, start=1):
+ label = m["name"]
+ if m.get("display_name") and m["display_name"].lower() != m["name"].lower():
+ label += f" (display: {m['display_name']})"
+ print(f" {i}. {label} [{m['id']}]")
+ print(" 0. skip")
+
+ choice = input(" Pick a match [0]: ").strip()
+ if not choice or choice == "0":
+ return None
+ try:
+ idx = int(choice)
+ if 1 <= idx <= len(options):
+ return options[idx - 1]
+ except ValueError:
+ pass
+ print(" Invalid choice, skipping.")
+ return None
+
+
+def main() -> int:
+ token = getpass.getpass("PluralKit authorization token: ").strip()
+ if not token:
+ print("No token given, aborting.")
+ return 1
+
+ try:
+ members = get_members(token)
+ except requests.HTTPError as e:
+ print(f"Failed to fetch members: {e}")
+ return 1
+
+ by_name: dict[str, dict] = {}
+ for m in members:
+ by_name.setdefault(m["name"].lower(), m)
+ if m.get("display_name"):
+ by_name.setdefault(m["display_name"].lower(), m)
+
+ png_files = sorted(AVATARS_DIR.glob("*.png"))
+ if not png_files:
+ print("No .png files found here.")
+ return 1
+
+ updated, skipped = [], []
+
+ for path in png_files:
+ stem = path.stem
+ member = find_match(stem, members, by_name)
+ if member is None:
+ print(f"[skip] {path.name} -> no member match")
+ skipped.append(path.name)
+ continue
+
+ url = f"{CDN_BASE}/{path.name}"
+ confirm = input(
+ f"[match] {path.name} -> {member['name']} [{member['id']}] set avatar_url? [Y/n] "
+ ).strip().lower()
+ if confirm == "n":
+ print(" skipped by user")
+ skipped.append(path.name)
+ continue
+
+ resp = requests.patch(
+ f"{API_BASE}/members/{member['id']}",
+ headers={"Authorization": token},
+ json={"avatar_url": url},
+ timeout=30,
+ )
+ if resp.status_code == 200:
+ print(f" updated -> {url}")
+ updated.append(path.name)
+ else:
+ print(f" FAILED ({resp.status_code}): {resp.text}")
+ skipped.append(path.name)
+
+ print(f"\nDone. Updated {len(updated)}, skipped {len(skipped)}.")
+ if skipped:
+ print("Skipped:", ", ".join(skipped))
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/src/auth.ts b/src/auth.ts
new file mode 100644
index 0000000..d41271f
--- /dev/null
+++ b/src/auth.ts
@@ -0,0 +1,191 @@
+// Sign-in through the Doughmination SSO (auth-server/, an OpenID Connect
+// provider). Standard authorization-code flow with PKCE, run server-side as a
+// confidential client:
+//
+// /login → sets a short-lived signed cookie (state, nonce, PKCE
+// verifier) and redirects to <issuer>/authorize
+// /auth/callback → checks state, redeems the code at <issuer>/token,
+// verifies the id_token against the issuer's JWKS, and
+// sets the session cookie
+// /logout → drops the session cookie (the SSO session stays)
+//
+// Both cookies are HS256 JWTs signed with SESSION_SECRET, so nothing is stored
+// server-side. Who may sign in at all is the SSO's call (the client's allowed
+// groups), so any valid session here may upload.
+
+import { Hono } from "hono";
+import { deleteCookie, getCookie, setCookie } from "hono/cookie";
+import { createRemoteJWKSet, jwtVerify, SignJWT } from "jose";
+import { issuer, type AppContext, type AppEnv, type Env, type Session } from "./env";
+import { messagePage } from "./views";
+
+const SESSION_COOKIE = "cdn_session";
+const LOGIN_COOKIE = "cdn_login";
+const SESSION_TTL = 60 * 60 * 12;
+const LOGIN_TTL = 60 * 10;
+const SCOPES = "openid profile";
+
+const enc = new TextEncoder();
+const key = (env: Env) => enc.encode(env.SESSION_SECRET);
+
+// One JWKS fetcher per issuer, kept for the life of the isolate (jose caches
+// the keys and refetches on an unknown kid).
+const jwksCache = new Map<string, ReturnType<typeof createRemoteJWKSet>>();
+function jwks(iss: string) {
+ let set = jwksCache.get(iss);
+ if (!set) {
+ set = createRemoteJWKSet(new URL(`${iss}/.well-known/jwks.json`));
+ jwksCache.set(iss, set);
+ }
+ return set;
+}
+
+function randomToken(bytes = 32): string {
+ const buf = crypto.getRandomValues(new Uint8Array(bytes));
+ return btoa(String.fromCharCode(...buf)).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
+}
+
+async function pkceChallenge(verifier: string): Promise<string> {
+ const digest = new Uint8Array(await crypto.subtle.digest("SHA-256", enc.encode(verifier)));
+ return btoa(String.fromCharCode(...digest)).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
+}
+
+async function sign(env: Env, claims: Record<string, unknown>, ttl: number): Promise<string> {
+ return new SignJWT(claims)
+ .setProtectedHeader({ alg: "HS256" })
+ .setIssuedAt()
+ .setExpirationTime(`${ttl}s`)
+ .sign(key(env));
+}
+
+const cookieOpts = (maxAge: number) =>
+ ({ path: "/", secure: true, httpOnly: true, sameSite: "Lax", maxAge, prefix: "host" }) as const;
+
+/** Only same-site paths, so /login can't be used as an open redirect. */
+function safeNext(raw: string | undefined): string {
+ return raw && raw.startsWith("/") && !raw.startsWith("//") && !raw.startsWith("/\\") ? raw : "/upload";
+}
+
+function redirectUri(c: AppContext): string {
+ return `${new URL(c.req.url).origin}/auth/callback`;
+}
+
+export async function getSession(c: AppContext): Promise<Session | null> {
+ const token = getCookie(c, SESSION_COOKIE, "host");
+ if (!token) return null;
+ try {
+ const { payload } = await jwtVerify(token, key(c.env), { algorithms: ["HS256"] });
+ if (typeof payload.sub !== "string") return null;
+ return {
+ sub: payload.sub,
+ username: typeof payload.username === "string" ? payload.username : payload.sub,
+ };
+ } catch {
+ return null;
+ }
+}
+
+function failPage(c: AppContext, message: string, status: 400 | 403 | 502 = 400) {
+ return messagePage(
+ c,
+ "Sign-in failed",
+ `<p>${message}</p><p><a href="/login">Try again</a> · <a href="/">Back home</a></p>`,
+ status,
+ );
+}
+
+export const auth = new Hono<AppEnv>();
+
+auth.get("/login", async (c) => {
+ const state = randomToken();
+ const nonce = randomToken();
+ const verifier = randomToken(48);
+ const next = safeNext(c.req.query("next"));
+
+ setCookie(c, LOGIN_COOKIE, await sign(c.env, { state, nonce, verifier, next }, LOGIN_TTL), cookieOpts(LOGIN_TTL));
+
+ const url = new URL(`${issuer(c.env)}/authorize`);
+ url.search = new URLSearchParams({
+ response_type: "code",
+ client_id: c.env.OIDC_CLIENT_ID,
+ redirect_uri: redirectUri(c),
+ scope: SCOPES,
+ state,
+ nonce,
+ code_challenge: await pkceChallenge(verifier),
+ code_challenge_method: "S256",
+ }).toString();
+ return c.redirect(url.toString());
+});
+
+auth.get("/auth/callback", async (c) => {
+ const iss = issuer(c.env);
+ const loginToken = getCookie(c, LOGIN_COOKIE, "host");
+ deleteCookie(c, LOGIN_COOKIE, { path: "/", secure: true, prefix: "host" });
+
+ let login: { state: string; nonce: string; verifier: string; next: string };
+ try {
+ if (!loginToken) throw new Error("missing");
+ const { payload } = await jwtVerify(loginToken, key(c.env), { algorithms: ["HS256"] });
+ login = payload as unknown as typeof login;
+ } catch {
+ return failPage(c, "Your sign-in attempt expired. Start again.");
+ }
+
+ const q = c.req.query();
+ if (!q.state || q.state !== login.state) return failPage(c, "The sign-in response didn't match this browser.");
+ // RFC 9207: the SSO server names itself, which rules out mix-up attacks.
+ if (q.iss !== undefined && q.iss !== iss) return failPage(c, "The sign-in response came from the wrong server.");
+ if (q.error) {
+ const denied = q.error === "access_denied";
+ return failPage(c, denied ? "Your account isn't allowed to upload here." : "The sign-in server refused the request.", 403);
+ }
+ if (!q.code) return failPage(c, "The sign-in response had no code.");
+
+ const tokenRes = await fetch(`${iss}/token`, {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/x-www-form-urlencoded",
+ Authorization: "Basic " + btoa(`${encodeURIComponent(c.env.OIDC_CLIENT_ID)}:${encodeURIComponent(c.env.OIDC_CLIENT_SECRET)}`),
+ },
+ body: new URLSearchParams({
+ grant_type: "authorization_code",
+ code: q.code,
+ redirect_uri: redirectUri(c),
+ code_verifier: login.verifier,
+ }),
+ });
+ if (!tokenRes.ok) {
+ console.error("[auth] token exchange failed", tokenRes.status, await tokenRes.text());
+ return failPage(c, "Couldn't finish signing in with the SSO server.", 502);
+ }
+ const tokens = (await tokenRes.json()) as { id_token?: string };
+ if (!tokens.id_token) return failPage(c, "The SSO server didn't return an ID token.", 502);
+
+ let claims;
+ try {
+ ({ payload: claims } = await jwtVerify(tokens.id_token, jwks(iss), {
+ issuer: iss,
+ audience: c.env.OIDC_CLIENT_ID,
+ algorithms: ["RS256"],
+ }));
+ } catch (err) {
+ console.error("[auth] id_token rejected", err);
+ return failPage(c, "The SSO server's ID token didn't verify.", 502);
+ }
+ if (claims.nonce !== login.nonce || typeof claims.sub !== "string") {
+ return failPage(c, "The ID token wasn't issued for this sign-in.");
+ }
+
+ const session = {
+ sub: claims.sub,
+ username: typeof claims.preferred_username === "string" ? claims.preferred_username : claims.sub,
+ };
+ setCookie(c, SESSION_COOKIE, await sign(c.env, session, SESSION_TTL), cookieOpts(SESSION_TTL));
+ return c.redirect(safeNext(login.next));
+});
+
+auth.get("/logout", (c) => {
+ deleteCookie(c, SESSION_COOKIE, { path: "/", secure: true, prefix: "host" });
+ return c.redirect("/");
+});
diff --git a/src/cors.ts b/src/cors.ts
new file mode 100644
index 0000000..ed0bbcc
--- /dev/null
+++ b/src/cors.ts
@@ -0,0 +1,90 @@
+// CORS allowlist for the CDN.
+//
+// `Access-Control-Allow-Origin` can only be ONE origin (or "*"), so to allow a
+// set of domains we inspect the request's Origin and echo it back if it's on
+// the list. Apex domains and any subdomain (e.g. assets.example.com) match.
+
+import type { MiddlewareHandler } from "hono";
+import type { AppEnv } from "./env";
+
+const ALLOWED: string[] = [
+ // Mine
+ "clovelib.win",
+ "clove-portfolio.win",
+ "cuddle-blahaj.win",
+ "doughmination.co.uk",
+ "doughmination.gay",
+ "doughmination.info",
+ "doughmination.me",
+ "doughmination.net",
+ "doughmination.online",
+ "doughmination.org",
+ "doughmination.site",
+ "doughmination.systems",
+ "doughmination.tech",
+ "doughmination.uk",
+ "doughmination.win",
+ "doughmination.xyz",
+ "imlesbian.fyi",
+ "transgamers.org",
+ "yuri-lover.win",
+
+ // gf
+ "ariare.es",
+ "ari.rip",
+ "gaybot.site",
+ "girlsnetwork.dev",
+ "kib.lol",
+ "stupid.cat",
+ "thesafespawn.net",
+
+ // Friends — add domains here
+];
+
+// Exact origins for local development (scheme + host + port must match)
+const DEV_ORIGINS: string[] = [
+ "http://localhost:3000",
+ "http://127.0.0.1:3000",
+];
+
+function isAllowed(origin: string): boolean {
+ if (DEV_ORIGINS.includes(origin)) return true;
+
+ let host: string;
+ try {
+ host = new URL(origin).hostname.toLowerCase();
+ } catch {
+ return false;
+ }
+ return ALLOWED.some(
+ (domain) => host === domain || host.endsWith("." + domain),
+ );
+}
+
+/** Hono middleware: answers preflights and echoes allowed Origins back. */
+export const cors: MiddlewareHandler<AppEnv> = async (c, next) => {
+ const origin = c.req.header("Origin") ?? null;
+ const allow = origin !== null && isAllowed(origin);
+
+ // Preflight: answer directly, don't hit the asset.
+ if (c.req.method === "OPTIONS") {
+ const headers = new Headers({
+ "Access-Control-Allow-Methods": "GET, HEAD, OPTIONS",
+ "Access-Control-Max-Age": "86400",
+ Vary: "Origin",
+ });
+ if (allow) headers.set("Access-Control-Allow-Origin", origin);
+ return new Response(null, { status: 204, headers });
+ }
+
+ await next();
+
+ // Normal request: attach CORS if the origin is allowed. Responses built
+ // from fetch() (static assets) have immutable headers, so copy first.
+ // Vary goes on every response so caches never reuse one origin's reply for another.
+ c.res = new Response(c.res.body, c.res);
+ c.res.headers.append("Vary", "Origin");
+ if (allow) {
+ c.res.headers.set("Access-Control-Allow-Origin", origin);
+ }
+};
diff --git a/src/env.ts b/src/env.ts
new file mode 100644
index 0000000..2210bb8
--- /dev/null
+++ b/src/env.ts
@@ -0,0 +1,24 @@
+// Bindings and vars. See wrangler.jsonc for what each one is.
+
+import type { Context } from "hono";
+
+export interface Env {
+ ASSETS: Fetcher;
+ BUCKET: R2Bucket;
+ AUTH_ISSUER: string;
+ OIDC_CLIENT_ID: string;
+ OIDC_CLIENT_SECRET: string;
+ SESSION_SECRET: string;
+}
+
+export interface Session {
+ sub: string;
+ username: string;
+}
+
+export type AppEnv = { Bindings: Env };
+export type AppContext = Context<AppEnv>;
+
+export function issuer(env: Env): string {
+ return env.AUTH_ISSUER.replace(/\/+$/, "");
+}
diff --git a/src/files.ts b/src/files.ts
new file mode 100644
index 0000000..c948780
--- /dev/null
+++ b/src/files.ts
@@ -0,0 +1,155 @@
+// Everything backed by the R2 bucket: serving files, listing them for the
+// browser, and uploads.
+
+import type { AppContext } from "./env";
+
+/** Browser cache for served files. URLs can change any time, so nothing longer. */
+const FILE_CACHE = "public, max-age=86400";
+const MAX_KEY_BYTES = 1024;
+
+// Paths the worker itself answers, so an object stored there could never be served.
+const RESERVED = ["api/", "auth/", "login", "logout", "upload", "genshin/", "LICENCE.md", ".well-known/"];
+
+// Known extensions always get these, since browsers often send nothing useful
+// (.glb, fonts, .mov and friends). Anything else keeps what the uploader sent.
+const TYPES: Record<string, string> = {
+ avif: "image/avif",
+ gif: "image/gif",
+ glb: "model/gltf-binary",
+ gltf: "model/gltf+json",
+ ico: "image/x-icon",
+ jpeg: "image/jpeg",
+ jpg: "image/jpeg",
+ js: "text/javascript; charset=utf-8",
+ json: "application/json",
+ md: "text/plain; charset=utf-8",
+ mov: "video/quicktime",
+ mp3: "audio/mpeg",
+ mp4: "video/mp4",
+ ogg: "audio/ogg",
+ otf: "font/otf",
+ pdf: "application/pdf",
+ png: "image/png",
+ ps1: "text/plain; charset=utf-8",
+ sh: "text/plain; charset=utf-8",
+ svg: "image/svg+xml",
+ ttf: "font/ttf",
+ txt: "text/plain; charset=utf-8",
+ wav: "audio/wav",
+ webm: "video/webm",
+ webp: "image/webp",
+ woff: "font/woff",
+ woff2: "font/woff2",
+};
+
+function knownType(key: string): string | undefined {
+ const dot = key.lastIndexOf(".");
+ return dot > key.lastIndexOf("/") ? TYPES[key.slice(dot + 1).toLowerCase()] : undefined;
+}
+
+/** Returns an error message, or null if the key is fine to store. */
+export function checkKey(key: string): string | null {
+ if (!key) return "No file path given.";
+ if (new TextEncoder().encode(key).length > MAX_KEY_BYTES) return "That path is too long.";
+ if (/[\u0000-\u001f\u007f\\]/.test(key)) return "That path has characters that aren't allowed.";
+ const segs = key.split("/");
+ if (segs.some((s) => s === "" || s === "." || s === ".." || s.startsWith("."))) {
+ return "Path segments can't be empty or start with a dot.";
+ }
+ if (RESERVED.some((r) => (r.endsWith("/") ? key.startsWith(r) : key === r))) {
+ return "That path is used by the site itself.";
+ }
+ return null;
+}
+
+/** GET/HEAD /<key> straight out of R2, with conditional and range support. */
+export async function serveFile(c: AppContext, key: string): Promise<Response | null> {
+ const bucket = c.env.BUCKET;
+ const req = c.req.raw;
+
+ if (req.method === "HEAD") {
+ const head = await bucket.head(key);
+ if (!head) return null;
+ const headers = fileHeaders(head);
+ headers.set("Content-Length", String(head.size));
+ return new Response(null, { headers });
+ }
+
+ const obj = await bucket.get(key, { onlyIf: req.headers, range: req.headers });
+ if (!obj) return null;
+ const headers = fileHeaders(obj);
+
+ // A failed precondition comes back as an object without a body.
+ if (!("body" in obj)) {
+ const conditionalGet = req.headers.has("If-None-Match") || req.headers.has("If-Modified-Since");
+ return new Response(null, { status: conditionalGet ? 304 : 412, headers });
+ }
+
+ if (req.headers.has("Range") && obj.range) {
+ const r = obj.range as { offset?: number; length?: number; suffix?: number };
+ const offset = r.suffix !== undefined ? obj.size - r.suffix : (r.offset ?? 0);
+ const length = r.suffix !== undefined ? r.suffix : (r.length ?? obj.size - offset);
+ headers.set("Content-Range", `bytes ${offset}-${offset + length - 1}/${obj.size}`);
+ headers.set("Content-Length", String(length));
+ return new Response(obj.body, { status: 206, headers });
+ }
+
+ headers.set("Content-Length", String(obj.size));
+ return new Response(obj.body, { headers });
+}
+
+function fileHeaders(obj: R2Object): Headers {
+ const headers = new Headers();
+ obj.writeHttpMetadata(headers);
+ if (!headers.has("Content-Type")) headers.set("Content-Type", knownType(obj.key) ?? "application/octet-stream");
+ headers.set("ETag", obj.httpEtag);
+ headers.set("Last-Modified", obj.uploaded.toUTCString());
+ headers.set("Accept-Ranges", "bytes");
+ headers.set("Cache-Control", FILE_CACHE);
+ return headers;
+}
+
+/** GET /api/list — flat list of every object, for the browser. */
+export async function listFiles(c: AppContext): Promise<Response> {
+ const files: { path: string; size: number }[] = [];
+ let cursor: string | undefined;
+ do {
+ const page = await c.env.BUCKET.list({ cursor, limit: 1000 });
+ for (const o of page.objects) files.push({ path: o.key, size: o.size });
+ cursor = page.truncated ? page.cursor : undefined;
+ } while (cursor);
+
+ c.header("Cache-Control", "public, max-age=60");
+ return c.json({ count: files.length, files });
+}
+
+/** PUT /api/files/<key> — raw request body becomes the object. */
+export async function uploadFile(c: AppContext, key: string, uploader: string): Promise<Response> {
+ const bad = checkKey(key);
+ if (bad) return c.json({ error: bad }, 400);
+
+ const length = Number(c.req.header("Content-Length"));
+ const body = c.req.raw.body;
+ if (!body || !Number.isFinite(length)) return c.json({ error: "Send the file as the request body." }, 411);
+
+ // A static site file at the same path would always win, hiding the upload.
+ const shadow = await c.env.ASSETS.fetch(new Request(new URL(`/${key}`, c.req.url), { method: "HEAD" }));
+ if (shadow.ok) return c.json({ error: "That path is used by the site itself." }, 409);
+
+ if (c.req.query("overwrite") !== "1" && (await c.env.BUCKET.head(key))) {
+ return c.json({ error: "A file already exists at that path." }, 409);
+ }
+
+ const sent = c.req.header("Content-Type")?.trim();
+ const contentType = knownType(key) ?? (sent && !sent.startsWith("application/x-www-form-urlencoded") ? sent : "application/octet-stream");
+
+ const obj = await c.env.BUCKET.put(key, body, {
+ httpMetadata: { contentType },
+ customMetadata: { uploadedBy: uploader },
+ });
+ return c.json({ path: obj.key, size: obj.size, url: new URL(`/${encodeKey(obj.key)}`, c.req.url).toString() }, 201);
+}
+
+export function encodeKey(key: string): string {
+ return key.split("/").map(encodeURIComponent).join("/");
+}
diff --git a/src/genshin.ts b/src/genshin.ts
new file mode 100644
index 0000000..1106c96
--- /dev/null
+++ b/src/genshin.ts
@@ -0,0 +1,60 @@
+// Proxy + edge-cache for enka.network/ui/* Genshin game assets.
+//
+// GET /genshin/ui/UI_Gacha_AvatarImg_Neuvillette.png
+// -> https://enka.network/ui/UI_Gacha_AvatarImg_Neuvillette.png
+//
+// The Discord bot's Genshin character card pulls a lot of icons per render
+// (splash art, weapon, five artifacts, stat glyphs). Routing them through
+// here means Enka is hit at most once per asset per Cloudflare PoP and then
+// it's served from cache, so card rendering can't get us rate-limited
+// upstream. Enka's asset filenames are content-stable, so the cache is long
+// and immutable.
+
+import type { Handler } from "hono";
+import type { AppEnv } from "./env";
+
+const UPSTREAM = "https://enka.network/ui/";
+const ALLOWED = /^[A-Za-z0-9][A-Za-z0-9_-]*\.(png|webp|jpg|jpeg)$/;
+const CACHE_TTL = 60 * 60 * 24 * 30; // 30 days
+
+export const genshinUi: Handler<AppEnv> = async (c) => {
+ const request = c.req.raw;
+ const name = c.req.param("name") ?? "";
+
+ if (!name || name.includes("..") || !ALLOWED.test(name)) {
+ return new Response("Not found", { status: 404 });
+ }
+
+ const cache = caches.default;
+ const cacheKey = new Request(new URL(request.url).toString());
+ const cached = await cache.match(cacheKey);
+ if (cached) return cached;
+
+ let upstream: Response;
+ try {
+ upstream = await fetch(UPSTREAM + name, {
+ headers: {
+ "User-Agent": "doughmination-cdn/1.0 (+https://m.doughmination.gay)",
+ Accept: "image/avif,image/webp,image/png,*/*",
+ },
+ cf: { cacheEverything: true, cacheTtl: CACHE_TTL },
+ });
+ } catch {
+ return new Response("Upstream fetch failed", { status: 502 });
+ }
+
+ if (!upstream.ok) {
+ return new Response("Upstream error", {
+ status: upstream.status === 404 ? 404 : 502,
+ });
+ }
+
+ const headers = new Headers();
+ headers.set("Content-Type", upstream.headers.get("Content-Type") ?? "image/png");
+ headers.set("Cache-Control", `public, max-age=${CACHE_TTL}, immutable`);
+ headers.set("X-Proxied-From", "enka.network");
+
+ const response = new Response(upstream.body, { status: 200, headers });
+ c.executionCtx.waitUntil(cache.put(cacheKey, response.clone()));
+ return response;
+};
diff --git a/src/main.ts b/src/main.ts
new file mode 100644
index 0000000..c9c8378
--- /dev/null
+++ b/src/main.ts
@@ -0,0 +1,98 @@
+// CDN worker. Order of business for a request:
+//
+// 1. CORS (allowlisted origins get Access-Control-Allow-Origin)
+// 2. Worker routes: sign-in, the upload page + API, the Genshin proxy
+// 3. Static site files from ./public (browser, styles, .well-known, …)
+// 4. Otherwise the path is an R2 key: /img/foo.png → object "img/foo.png"
+
+import { Hono } from "hono";
+import licence from "../LICENCE.md";
+import { auth, getSession } from "./auth";
+import { cors } from "./cors";
+import { issuer, type AppContext, type AppEnv } from "./env";
+import { listFiles, serveFile, uploadFile } from "./files";
+import { genshinUi } from "./genshin";
+
+const app = new Hono<AppEnv>();
+
+app.use("*", cors);
+app.use("*", async (c, next) => {
+ await next();
+ c.res = new Response(c.res.body, c.res);
+ c.res.headers.set("X-Content-Type-Options", "nosniff");
+});
+
+app.route("/", auth);
+
+// --- upload -------------------------------------------------------------------------
+
+app.get("/upload", async (c) => {
+ const session = await getSession(c);
+ if (!session) return c.redirect("/login?next=/upload");
+ const page = await c.env.ASSETS.fetch(new Request(new URL("/upload", c.req.url)));
+ const res = new Response(page.body, page);
+ res.headers.set("Cache-Control", "no-store");
+ return res;
+});
+
+app.get("/api/me", async (c) => {
+ const session = await getSession(c);
+ c.header("Cache-Control", "no-store");
+ return c.json(session ? { username: session.username } : null);
+});
+
+app.get("/api/list", listFiles);
+
+app.put("/api/files/*", async (c) => {
+ // CSRF: the cookie is SameSite=Lax already, and uploads must come from this page.
+ if (c.req.header("Origin") !== new URL(c.req.url).origin) return c.json({ error: "Cross-site upload refused." }, 403);
+ const session = await getSession(c);
+ if (!session) return c.json({ error: "Signed out. Reload the page to sign in again." }, 401);
+ const key = decodeURIComponent(new URL(c.req.url).pathname.slice("/api/files/".length));
+ return uploadFile(c, key, session.username);
+});
+
+app.all("/api/*", (c) => c.json({ error: "Not found" }, 404));
+
+// --- misc ---------------------------------------------------------------------------
+
+app.get("/genshin/ui/:name", genshinUi);
+
+app.get("/LICENCE.md", (c) => {
+ c.header("Content-Type", "text/plain; charset=utf-8");
+ return c.body(licence);
+});
+
+// Points password managers at the SSO account page.
+app.get("/.well-known/change-password", (c) => c.redirect(`${issuer(c.env)}/account`, 302));
+
+// --- static site, then R2 -----------------------------------------------------------
+
+app.get("*", async (c) => {
+ const asset = await c.env.ASSETS.fetch(c.req.raw);
+ if (asset.status !== 404) return asset;
+
+ const path = new URL(c.req.url).pathname;
+ let key: string;
+ try {
+ key = decodeURIComponent(path.slice(1));
+ } catch {
+ return notFound(c);
+ }
+ if (!key || key.endsWith("/")) return notFound(c);
+ return (await serveFile(c, key)) ?? notFound(c);
+});
+
+async function notFound(c: AppContext): Promise<Response> {
+ const page = await c.env.ASSETS.fetch(new Request(new URL("/404", c.req.url)));
+ return new Response(page.body, { status: 404, headers: { "Content-Type": "text/html; charset=utf-8" } });
+}
+
+app.notFound((c) => notFound(c));
+
+app.onError((err, c) => {
+ console.error("[error]", c.req.method, new URL(c.req.url).pathname, err);
+ return c.text("Something went wrong on our side. Please try again.", 500);
+});
+
+export default app;
diff --git a/src/modules.d.ts b/src/modules.d.ts
new file mode 100644
index 0000000..30a2bf0
--- /dev/null
+++ b/src/modules.d.ts
@@ -0,0 +1,5 @@
+// Text-module imports (see "rules" in wrangler.jsonc).
+declare module "*.md" {
+ const text: string;
+ export default text;
+}
diff --git a/src/views.ts b/src/views.ts
new file mode 100644
index 0000000..7f1b6f7
--- /dev/null
+++ b/src/views.ts
@@ -0,0 +1,19 @@
+// Tiny server-rendered pages, in the site's own style.
+
+import type { AppContext } from "./env";
+
+const escape = (s: string) =>
+ s.replace(/[&<>"']/g, (ch) => `&#${ch.charCodeAt(0)};`);
+
+/** `body` is trusted HTML; `title` is escaped. */
+export function messagePage(c: AppContext, title: string, body: string, status: 400 | 403 | 502 = 400) {
+ return c.html(
+ `<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8">` +
+ `<meta name="viewport" content="width=device-width, initial-scale=1.0">` +
+ `<title>${escape(title)}</title><meta name="robots" content="noindex">` +
+ `<link rel="stylesheet" href="/style.css"></head>` +
+ `<body><main><div class="flag-stripe"></div><h1 class="trans-title">${escape(title)}</h1>` +
+ `${body}</main></body></html>`,
+ status,
+ );
+}
diff --git a/tsconfig.json b/tsconfig.json
new file mode 100644
index 0000000..f68f30d
--- /dev/null
+++ b/tsconfig.json
@@ -0,0 +1,17 @@
+{
+ "compilerOptions": {
+ "target": "ES2024",
+ "lib": ["ES2024"],
+ "module": "ESNext",
+ "moduleResolution": "bundler",
+ "moduleDetection": "force",
+ "types": ["@cloudflare/workers-types"],
+ "verbatimModuleSyntax": true,
+ "noEmit": true,
+ "strict": true,
+ "skipLibCheck": true,
+ "noFallthroughCasesInSwitch": true,
+ "noUncheckedIndexedAccess": true
+ },
+ "include": ["src"]
+}
diff --git a/wrangler.jsonc b/wrangler.jsonc
new file mode 100644
index 0000000..38fdb1a
--- /dev/null
+++ b/wrangler.jsonc
@@ -0,0 +1,46 @@
+{
+ "$schema": "node_modules/wrangler/config-schema.json",
+ "name": "cdn",
+ "main": "src/main.ts",
+ "compatibility_date": "2026-09-01",
+ "observability": {
+ "logs": {
+ "enabled": true
+ }
+ },
+ // The site itself (browser, upload page, licence, .well-known). Uploaded
+ // files live in R2, not here. The worker runs first on every request so it
+ // can add CORS headers and fall through to R2 when no static file matches.
+ "assets": {
+ "directory": "./public",
+ "binding": "ASSETS",
+ "not_found_handling": "none",
+ "run_worker_first": true
+ },
+ "r2_buckets": [
+ {
+ "binding": "BUCKET",
+ "bucket_name": "cdn"
+ }
+ ],
+ // Lets src/main.ts serve the repo-root LICENCE.md without a copy in public/.
+ "rules": [
+ { "type": "Text", "globs": ["**/*.md"], "fallthrough": true }
+ ],
+ // "routes": [{ "pattern": "m.doughmination.gay", "custom_domain": true }],
+ "dev": {
+ // The auth server's `wrangler dev` already owns 8787.
+ "port": 8788
+ },
+ "vars": {
+ // The SSO server (auth-server/). Must match its ISSUER exactly.
+ "AUTH_ISSUER": "https://auth.doughmination.gay",
+ // Client registered at <AUTH_ISSUER>/admin with redirect URI
+ // https://m.doughmination.gay/auth/callback. Its allowed groups decide
+ // who can sign in, and anyone signed in can upload.
+ "OIDC_CLIENT_ID": "cdn"
+ }
+ // Secrets (wrangler secret put <NAME>):
+ // OIDC_CLIENT_SECRET the client secret shown once when the client was created
+ // SESSION_SECRET signs the login cookie (openssl rand -base64 32)
+}