commit
Move to css and make a dedicated new repo page
diff --git a/.dockerignore b/.dockerignore
index 1e6779a..25b8428 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,6 +1,4 @@
node_modules
-dist
-public/style.css
.git
.env
data
diff --git a/.gitignore b/.gitignore
index 5955812..36f2b78 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,5 @@
node_modules/
dist/
-public/style.css
data/
.env
*.db
diff --git a/Dockerfile b/Dockerfile
index 897ab9b..ead5ddb 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,27 +1,8 @@
# syntax=docker/dockerfile:1
-# --- build stage -------------------------------------------------------------
-# Compiles Vanilla Extract (.css.ts) + bundles the server with esbuild.
-# Uses npm because the VE build tooling is Node-based.
-FROM node:26-bookworm-slim AS build
-WORKDIR /app
-
-COPY package.json package-lock.json* ./
-RUN npm ci
-
-COPY tsconfig.json ./
-COPY src ./src
-COPY scripts ./scripts
-# Hand-written static assets (app.js). The build writes the generated
-# style.css into this same directory — .dockerignore keeps the local copy of
-# that one out, so the image always gets a freshly compiled stylesheet.
-COPY public ./public
-RUN npm run build
-
-# --- runtime stage -----------------------------------------------------------
-# Slim Node image + git (the app shells out to git upload-pack / receive-pack
-# and git log for the viewer).
-FROM node:26-bookworm-slim AS runtime
+# Node runs the TypeScript sources directly, so there is no build stage.
+# git is needed for upload-pack / receive-pack, the viewer, and imports.
+FROM node:26-bookworm-slim
WORKDIR /app
ENV NODE_ENV=production
@@ -29,13 +10,11 @@ RUN apt-get update \
&& apt-get install -y --no-install-recommends git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
-# Production dependencies only.
COPY package.json package-lock.json* ./
RUN npm ci --omit=dev
-# Compiled server + stylesheet.
-COPY --from=build /app/dist ./dist
-COPY --from=build /app/public ./public
+COPY src ./src
+COPY public ./public
# Sensible in-container defaults; secrets come from the environment / .env.
ENV MINIGIT_HOST=0.0.0.0 \
@@ -47,4 +26,4 @@ EXPOSE 4010
VOLUME ["/srv/git"]
# --experimental-sqlite enables the built-in node:sqlite used by the token store.
-CMD ["node", "--experimental-sqlite", "--disable-warning=ExperimentalWarning", "dist/server.js"]
+CMD ["node", "--experimental-sqlite", "--disable-warning=ExperimentalWarning", "src/server.ts"]
diff --git a/package-lock.json b/package-lock.json
index 2a640d4..939f810 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -15,807 +15,19 @@
},
"devDependencies": {
"@types/node": "^26.6.2",
- "@vanilla-extract/css": "^1.21.2",
- "@vanilla-extract/esbuild-plugin": "^2.3.22",
- "esbuild": "^0.28.2",
"typescript": "^7.0.2"
}
},
- "node_modules/@babel/code-frame": {
- "version": "7.29.7",
- "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz",
- "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@babel/helper-validator-identifier": "^7.29.7",
- "js-tokens": "^4.0.0",
- "picocolors": "^1.1.1"
- },
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/compat-data": {
- "version": "7.29.7",
- "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.7.tgz",
- "integrity": "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==",
- "dev": true,
- "license": "MIT",
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/core": {
- "version": "7.29.7",
- "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.7.tgz",
- "integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@babel/code-frame": "^7.29.7",
- "@babel/generator": "^7.29.7",
- "@babel/helper-compilation-targets": "^7.29.7",
- "@babel/helper-module-transforms": "^7.29.7",
- "@babel/helpers": "^7.29.7",
- "@babel/parser": "^7.29.7",
- "@babel/template": "^7.29.7",
- "@babel/traverse": "^7.29.7",
- "@babel/types": "^7.29.7",
- "@jridgewell/remapping": "^2.3.5",
- "convert-source-map": "^2.0.0",
- "debug": "^4.1.0",
- "gensync": "^1.0.0-beta.2",
- "json5": "^2.2.3",
- "semver": "^6.3.1"
- },
- "engines": {
- "node": ">=6.9.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/babel"
- }
- },
- "node_modules/@babel/generator": {
- "version": "7.29.8",
- "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.8.tgz",
- "integrity": "sha512-gZbepsdh3WDtgZKWL+vTPh71LSBrm/Y4/QDZBVCcYfmeTEEuoOYwlSy+G1StfJg+/Zy550u/3TATbm7qDbbMtg==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@babel/parser": "^7.29.8",
- "@babel/types": "^7.29.8",
- "@jridgewell/gen-mapping": "^0.3.12",
- "@jridgewell/trace-mapping": "^0.3.28",
- "jsesc": "^3.0.2"
- },
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/helper-compilation-targets": {
- "version": "7.29.7",
- "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.29.7.tgz",
- "integrity": "sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@babel/compat-data": "^7.29.7",
- "@babel/helper-validator-option": "^7.29.7",
- "browserslist": "^4.24.0",
- "lru-cache": "^5.1.1",
- "semver": "^6.3.1"
- },
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/helper-compilation-targets/node_modules/lru-cache": {
- "version": "5.1.1",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
- "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
- "dev": true,
- "license": "ISC",
- "dependencies": {
- "yallist": "^3.0.2"
- }
- },
- "node_modules/@babel/helper-globals": {
- "version": "7.29.7",
- "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.29.7.tgz",
- "integrity": "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==",
- "dev": true,
- "license": "MIT",
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/helper-module-imports": {
- "version": "7.29.7",
- "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.29.7.tgz",
- "integrity": "sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@babel/traverse": "^7.29.7",
- "@babel/types": "^7.29.7"
- },
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/helper-module-transforms": {
- "version": "7.29.7",
- "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.29.7.tgz",
- "integrity": "sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@babel/helper-module-imports": "^7.29.7",
- "@babel/helper-validator-identifier": "^7.29.7",
- "@babel/traverse": "^7.29.7"
- },
- "engines": {
- "node": ">=6.9.0"
- },
- "peerDependencies": {
- "@babel/core": "^7.0.0"
- }
- },
- "node_modules/@babel/helper-plugin-utils": {
- "version": "7.29.7",
- "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.29.7.tgz",
- "integrity": "sha512-G7sHYigPY17oO5SYWnfD/0MTBwVR781S/JI643e/JhUYgVgWE/61SoW3NH9KWUKyKq5LVh3npif99Wkt6j86Jw==",
- "dev": true,
- "license": "MIT",
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/helper-string-parser": {
- "version": "7.29.7",
- "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz",
- "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==",
- "dev": true,
- "license": "MIT",
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/helper-validator-identifier": {
- "version": "7.29.7",
- "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz",
- "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==",
- "dev": true,
- "license": "MIT",
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/helper-validator-option": {
- "version": "7.29.7",
- "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.29.7.tgz",
- "integrity": "sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==",
- "dev": true,
- "license": "MIT",
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/helpers": {
- "version": "7.29.7",
- "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.7.tgz",
- "integrity": "sha512-1k2lAGRMfHTcwuNYcCNUmaUffmQv8KWMfh2iJUUeRlwlwH4FdNG7mfPI10NPfLHJFThE4Tyr4mv7kTNZOiPuBg==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@babel/template": "^7.29.7",
- "@babel/types": "^7.29.7"
- },
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/parser": {
- "version": "7.29.9",
- "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.9.tgz",
- "integrity": "sha512-CjXrNHTnvqBVqHgdBysY3vk2T8tpJHb5/RMeHJBTyVa9xgugCB0CJTx/3oO8RV2QRQP391RWpB7D6hLjm8V9uA==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@babel/types": "^7.29.8"
- },
- "bin": {
- "parser": "bin/babel-parser.js"
- },
- "engines": {
- "node": ">=6.0.0"
- }
- },
- "node_modules/@babel/plugin-syntax-typescript": {
- "version": "7.29.7",
- "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.29.7.tgz",
- "integrity": "sha512-ngr+82Sh0xMz25TPCZi+nC2iTzjfCdWS2ONXTp/PtSCHCgaCNBpdMqgvJ2ccdLlClVZ7sisIgB914j/JFe+RZA==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@babel/helper-plugin-utils": "^7.29.7"
- },
- "engines": {
- "node": ">=6.9.0"
- },
- "peerDependencies": {
- "@babel/core": "^7.0.0-0"
- }
- },
- "node_modules/@babel/runtime": {
- "version": "7.29.7",
- "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.7.tgz",
- "integrity": "sha512-Nq8OhGWiZIZGV6hLHoyAKLLcJihP/xFeBMGJoUrxTX2psI8dCifzLhZISFb+VWS3wFMRDmCGw5R+dOySCqPLhw==",
- "dev": true,
- "license": "MIT",
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/template": {
- "version": "7.29.7",
- "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.29.7.tgz",
- "integrity": "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@babel/code-frame": "^7.29.7",
- "@babel/parser": "^7.29.7",
- "@babel/types": "^7.29.7"
- },
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/traverse": {
- "version": "7.29.8",
- "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.8.tgz",
- "integrity": "sha512-I5z7H3bf/41ktsNVLtpN0wAa336HkqIHQ5BuPLEhTkt1jVSyZpeNKIzTgEWmlxjdg81R0IgUCcaE+Ok3NvrfZg==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@babel/code-frame": "^7.29.7",
- "@babel/generator": "^7.29.8",
- "@babel/helper-globals": "^7.29.7",
- "@babel/parser": "^7.29.8",
- "@babel/template": "^7.29.7",
- "@babel/types": "^7.29.8",
- "debug": "^4.3.1"
- },
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/types": {
- "version": "7.29.8",
- "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.8.tgz",
- "integrity": "sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@babel/helper-string-parser": "^7.29.7",
- "@babel/helper-validator-identifier": "^7.29.7"
- },
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@emotion/hash": {
- "version": "0.9.2",
- "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.9.2.tgz",
- "integrity": "sha512-MyqliTZGuOm3+5ZRSaaBGP3USLw6+EGykkwZns2EPC5g8jJ4z9OrdZY9apkl3+UP9+sdz76YYkwCKP5gh8iY3g==",
- "dev": true,
- "license": "MIT"
- },
- "node_modules/@esbuild/aix-ppc64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz",
- "integrity": "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==",
- "cpu": [
- "ppc64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "aix"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/android-arm": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.2.tgz",
- "integrity": "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==",
- "cpu": [
- "arm"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "android"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/android-arm64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz",
- "integrity": "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==",
- "cpu": [
- "arm64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "android"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/android-x64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.2.tgz",
- "integrity": "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==",
- "cpu": [
- "x64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "android"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/darwin-arm64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz",
- "integrity": "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==",
- "cpu": [
- "arm64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "darwin"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/darwin-x64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz",
- "integrity": "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==",
- "cpu": [
- "x64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "darwin"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/freebsd-arm64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz",
- "integrity": "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==",
- "cpu": [
- "arm64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "freebsd"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/freebsd-x64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz",
- "integrity": "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==",
- "cpu": [
- "x64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "freebsd"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/linux-arm": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz",
- "integrity": "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==",
- "cpu": [
- "arm"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/linux-arm64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz",
- "integrity": "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==",
- "cpu": [
- "arm64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/linux-ia32": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz",
- "integrity": "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==",
- "cpu": [
- "ia32"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/linux-loong64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz",
- "integrity": "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==",
- "cpu": [
- "loong64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/linux-mips64el": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz",
- "integrity": "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==",
- "cpu": [
- "mips64el"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/linux-ppc64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz",
- "integrity": "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==",
- "cpu": [
- "ppc64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/linux-riscv64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz",
- "integrity": "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==",
- "cpu": [
- "riscv64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/linux-s390x": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz",
- "integrity": "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==",
- "cpu": [
- "s390x"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/linux-x64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz",
- "integrity": "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==",
- "cpu": [
- "x64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/netbsd-arm64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz",
- "integrity": "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==",
- "cpu": [
- "arm64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "netbsd"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/netbsd-x64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz",
- "integrity": "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==",
- "cpu": [
- "x64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "netbsd"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/openbsd-arm64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz",
- "integrity": "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==",
- "cpu": [
- "arm64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "openbsd"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/openbsd-x64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz",
- "integrity": "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==",
- "cpu": [
- "x64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "openbsd"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/openharmony-arm64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz",
- "integrity": "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==",
- "cpu": [
- "arm64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "openharmony"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/sunos-x64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz",
- "integrity": "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==",
- "cpu": [
- "x64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "sunos"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/win32-arm64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz",
- "integrity": "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==",
- "cpu": [
- "arm64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/win32-ia32": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz",
- "integrity": "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==",
- "cpu": [
- "ia32"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/win32-x64": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz",
- "integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==",
- "cpu": [
- "x64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">=18"
- }
- },
"node_modules/@hono/node-server": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.1.1.tgz",
- "integrity": "sha512-ELuehkj5VCBdgEw9zs+ivkKwyzzUCSQuE96YmiPvn1ECBoZCczbFXJLeEGMTYjphP6gydh4pHMqEYPVMYUVgQg==",
- "license": "MIT",
- "engines": {
- "node": ">=20"
- },
- "peerDependencies": {
- "hono": "^4"
- }
- },
- "node_modules/@jridgewell/gen-mapping": {
- "version": "0.3.13",
- "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
- "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@jridgewell/sourcemap-codec": "^1.5.0",
- "@jridgewell/trace-mapping": "^0.3.24"
- }
- },
- "node_modules/@jridgewell/remapping": {
- "version": "2.3.5",
- "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz",
- "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@jridgewell/gen-mapping": "^0.3.5",
- "@jridgewell/trace-mapping": "^0.3.24"
- }
- },
- "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,
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.1.1.tgz",
+ "integrity": "sha512-ELuehkj5VCBdgEw9zs+ivkKwyzzUCSQuE96YmiPvn1ECBoZCczbFXJLeEGMTYjphP6gydh4pHMqEYPVMYUVgQg==",
"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.31",
- "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz",
- "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@jridgewell/resolve-uri": "^3.1.0",
- "@jridgewell/sourcemap-codec": "^1.4.14"
+ "node": ">=20"
+ },
+ "peerDependencies": {
+ "hono": "^4"
}
},
"node_modules/@phosphor-icons/core": {
@@ -1174,344 +386,6 @@
"node": ">=16.20.0"
}
},
- "node_modules/@vanilla-extract/babel-plugin-debug-ids": {
- "version": "1.2.2",
- "resolved": "https://registry.npmjs.org/@vanilla-extract/babel-plugin-debug-ids/-/babel-plugin-debug-ids-1.2.2.tgz",
- "integrity": "sha512-MeDWGICAF9zA/OZLOKwhoRlsUW+fiMwnfuOAqFVohL31Agj7Q/RBWAYweqjHLgFBCsdnr6XIfwjJnmb2znEWxw==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@babel/core": "^7.23.9"
- }
- },
- "node_modules/@vanilla-extract/css": {
- "version": "1.21.2",
- "resolved": "https://registry.npmjs.org/@vanilla-extract/css/-/css-1.21.2.tgz",
- "integrity": "sha512-ehF/tmv2MxQwOJB1DicALUqnjZTnmY9Y7J2ccKB578JzZpYeL6sLAUqbaXo1taw1Erp0qBq0I4Kejs0uU/pBfg==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@emotion/hash": "^0.9.0",
- "@vanilla-extract/private": "^1.0.9",
- "css-what": "^6.1.0",
- "csstype": "^3.2.3",
- "dedent": "^1.5.3",
- "deep-object-diff": "^1.1.9",
- "deepmerge": "^4.2.2",
- "lru-cache": "^10.4.3",
- "media-query-parser": "^2.0.2",
- "modern-ahocorasick": "^1.0.0",
- "picocolors": "^1.0.0"
- }
- },
- "node_modules/@vanilla-extract/esbuild-plugin": {
- "version": "2.3.22",
- "resolved": "https://registry.npmjs.org/@vanilla-extract/esbuild-plugin/-/esbuild-plugin-2.3.22.tgz",
- "integrity": "sha512-unxruCeuGR2BpmEuSV49++V4whdX7uPWADIiPwAe6zEOXwPrXQK+VtXjjZ/yN40vGfE7OJP/4WSDM5RuYX4LoQ==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@vanilla-extract/integration": "^8.0.8"
- },
- "peerDependencies": {
- "esbuild": ">=0.17.6"
- },
- "peerDependenciesMeta": {
- "esbuild": {
- "optional": true
- }
- }
- },
- "node_modules/@vanilla-extract/integration": {
- "version": "8.0.10",
- "resolved": "https://registry.npmjs.org/@vanilla-extract/integration/-/integration-8.0.10.tgz",
- "integrity": "sha512-01IB5gbrgTe8IIrtfRXXTmACl5D8Enzqp2cKbCWaMKXmnoilXXVCPbJoA96q88PXkNDXsXepCxUugMvEmL3c7A==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@babel/core": "^7.23.9",
- "@babel/plugin-syntax-typescript": "^7.23.3",
- "@vanilla-extract/babel-plugin-debug-ids": "^1.2.2",
- "@vanilla-extract/css": "^1.20.1",
- "dedent": "^1.5.3",
- "esbuild": "npm:esbuild@>=0.17.6 <0.29.0",
- "eval": "0.1.8",
- "find-up": "^5.0.0",
- "javascript-stringify": "^2.0.1",
- "mlly": "^1.4.2"
- }
- },
- "node_modules/@vanilla-extract/private": {
- "version": "1.0.9",
- "resolved": "https://registry.npmjs.org/@vanilla-extract/private/-/private-1.0.9.tgz",
- "integrity": "sha512-gT2jbfZuaaCLrAxwXbRgIhGhcXbRZCG3v4TTUnjw0EJ7ArdBRxkq4msNJkbuRkCgfIK5ATmprB5t9ljvLeFDEA==",
- "dev": true,
- "license": "MIT"
- },
- "node_modules/acorn": {
- "version": "8.18.0",
- "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.18.0.tgz",
- "integrity": "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ==",
- "dev": true,
- "license": "MIT",
- "bin": {
- "acorn": "bin/acorn"
- },
- "engines": {
- "node": ">=0.4.0"
- }
- },
- "node_modules/baseline-browser-mapping": {
- "version": "2.11.25",
- "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.25.tgz",
- "integrity": "sha512-gMmEShwwq7FJqMwvfRwvCl00v4kN+KOfJqXn+f4nrufak5gNHJOksd/60Dvjuz7sI8Y5WiSFBa8FEYr+zoyqCw==",
- "dev": true,
- "license": "Apache-2.0",
- "bin": {
- "baseline-browser-mapping": "dist/cli.cjs"
- },
- "engines": {
- "node": ">=6.0.0"
- }
- },
- "node_modules/browserslist": {
- "version": "4.29.0",
- "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.29.0.tgz",
- "integrity": "sha512-3GSvyjvDI4Dur1Meg2BekJquu5uF+9R9a1+5M1Mde192eZoXbeXjzgOsgqPS2V8D5wrrip0gR5Hf/GhWQ9ZzaA==",
- "dev": true,
- "funding": [
- {
- "type": "opencollective",
- "url": "https://opencollective.com/browserslist"
- },
- {
- "type": "tidelift",
- "url": "https://tidelift.com/funding/github/npm/browserslist"
- },
- {
- "type": "github",
- "url": "https://github.com/sponsors/ai"
- }
- ],
- "license": "MIT",
- "dependencies": {
- "baseline-browser-mapping": "^2.11.23",
- "caniuse-lite": "^1.0.30001810",
- "electron-to-chromium": "^1.5.427",
- "node-releases": "^2.0.55",
- "update-browserslist-db": "^1.3.3"
- },
- "bin": {
- "browserslist": "cli.js"
- },
- "engines": {
- "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
- }
- },
- "node_modules/caniuse-lite": {
- "version": "1.0.30001810",
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001810.tgz",
- "integrity": "sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg==",
- "dev": true,
- "funding": [
- {
- "type": "opencollective",
- "url": "https://opencollective.com/browserslist"
- },
- {
- "type": "tidelift",
- "url": "https://tidelift.com/funding/github/npm/caniuse-lite"
- },
- {
- "type": "github",
- "url": "https://github.com/sponsors/ai"
- }
- ],
- "license": "CC-BY-4.0"
- },
- "node_modules/confbox": {
- "version": "0.1.8",
- "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.8.tgz",
- "integrity": "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==",
- "dev": true,
- "license": "MIT"
- },
- "node_modules/convert-source-map": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
- "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==",
- "dev": true,
- "license": "MIT"
- },
- "node_modules/css-what": {
- "version": "6.2.2",
- "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.2.2.tgz",
- "integrity": "sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA==",
- "dev": true,
- "license": "BSD-2-Clause",
- "engines": {
- "node": ">= 6"
- },
- "funding": {
- "url": "https://github.com/sponsors/fb55"
- }
- },
- "node_modules/csstype": {
- "version": "3.2.3",
- "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
- "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",
- "dev": true,
- "license": "MIT"
- },
- "node_modules/debug": {
- "version": "4.4.3",
- "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
- "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "ms": "^2.1.3"
- },
- "engines": {
- "node": ">=6.0"
- },
- "peerDependenciesMeta": {
- "supports-color": {
- "optional": true
- }
- }
- },
- "node_modules/dedent": {
- "version": "1.7.2",
- "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.7.2.tgz",
- "integrity": "sha512-WzMx3mW98SN+zn3hgemf4OzdmyNhhhKz5Ay0pUfQiMQ3e1g+xmTJWp/pKdwKVXhdSkAEGIIzqeuWrL3mV/AXbA==",
- "dev": true,
- "license": "MIT",
- "peerDependencies": {
- "babel-plugin-macros": "^3.1.0"
- },
- "peerDependenciesMeta": {
- "babel-plugin-macros": {
- "optional": true
- }
- }
- },
- "node_modules/deep-object-diff": {
- "version": "1.1.9",
- "resolved": "https://registry.npmjs.org/deep-object-diff/-/deep-object-diff-1.1.9.tgz",
- "integrity": "sha512-Rn+RuwkmkDwCi2/oXOFS9Gsr5lJZu/yTGpK7wAaAIE75CC+LCGEZHpY6VQJa/RoJcrmaA/docWJZvYohlNkWPA==",
- "dev": true,
- "license": "MIT"
- },
- "node_modules/deepmerge": {
- "version": "4.3.1",
- "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz",
- "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==",
- "dev": true,
- "license": "MIT",
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/electron-to-chromium": {
- "version": "1.5.438",
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.438.tgz",
- "integrity": "sha512-AN9xMU1hJiT65LkCUPL1DZm5TCbOPb2Qsm5pYwFLEXp6/qj9SdT4yMiqs7Qqstwvkn1zF7l36SRGt+s6XcJ0FA==",
- "dev": true,
- "license": "ISC"
- },
- "node_modules/esbuild": {
- "version": "0.28.2",
- "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz",
- "integrity": "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==",
- "dev": true,
- "hasInstallScript": true,
- "license": "MIT",
- "bin": {
- "esbuild": "bin/esbuild"
- },
- "engines": {
- "node": ">=18"
- },
- "optionalDependencies": {
- "@esbuild/aix-ppc64": "0.28.2",
- "@esbuild/android-arm": "0.28.2",
- "@esbuild/android-arm64": "0.28.2",
- "@esbuild/android-x64": "0.28.2",
- "@esbuild/darwin-arm64": "0.28.2",
- "@esbuild/darwin-x64": "0.28.2",
- "@esbuild/freebsd-arm64": "0.28.2",
- "@esbuild/freebsd-x64": "0.28.2",
- "@esbuild/linux-arm": "0.28.2",
- "@esbuild/linux-arm64": "0.28.2",
- "@esbuild/linux-ia32": "0.28.2",
- "@esbuild/linux-loong64": "0.28.2",
- "@esbuild/linux-mips64el": "0.28.2",
- "@esbuild/linux-ppc64": "0.28.2",
- "@esbuild/linux-riscv64": "0.28.2",
- "@esbuild/linux-s390x": "0.28.2",
- "@esbuild/linux-x64": "0.28.2",
- "@esbuild/netbsd-arm64": "0.28.2",
- "@esbuild/netbsd-x64": "0.28.2",
- "@esbuild/openbsd-arm64": "0.28.2",
- "@esbuild/openbsd-x64": "0.28.2",
- "@esbuild/openharmony-arm64": "0.28.2",
- "@esbuild/sunos-x64": "0.28.2",
- "@esbuild/win32-arm64": "0.28.2",
- "@esbuild/win32-ia32": "0.28.2",
- "@esbuild/win32-x64": "0.28.2"
- }
- },
- "node_modules/escalade": {
- "version": "3.2.0",
- "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",
- "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
- "dev": true,
- "license": "MIT",
- "engines": {
- "node": ">=6"
- }
- },
- "node_modules/eval": {
- "version": "0.1.8",
- "resolved": "https://registry.npmjs.org/eval/-/eval-0.1.8.tgz",
- "integrity": "sha512-EzV94NYKoO09GLXGjXj9JIlXijVck4ONSr5wiCWDvhsvj5jxSrzTmRU/9C1DyB6uToszLs8aifA6NQ7lEQdvFw==",
- "dev": true,
- "dependencies": {
- "@types/node": "*",
- "require-like": ">= 0.1.1"
- },
- "engines": {
- "node": ">= 0.8"
- }
- },
- "node_modules/find-up": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
- "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "locate-path": "^6.0.0",
- "path-exists": "^4.0.0"
- },
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
- "node_modules/gensync": {
- "version": "1.0.0-beta.2",
- "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz",
- "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==",
- "dev": true,
- "license": "MIT",
- "engines": {
- "node": ">=6.9.0"
- }
- },
"node_modules/hono": {
"version": "4.13.8",
"resolved": "https://registry.npmjs.org/hono/-/hono-4.13.8.tgz",
@@ -1521,13 +395,6 @@
"node": ">=16.9.0"
}
},
- "node_modules/javascript-stringify": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/javascript-stringify/-/javascript-stringify-2.1.0.tgz",
- "integrity": "sha512-JVAfqNPTvNq3sB/VHQJAFxN/sPgKnsKrCwyRt15zwNCdrMMJDdcEOdubuy+DuJYYdm0ox1J4uzEuYKkN+9yhVg==",
- "dev": true,
- "license": "MIT"
- },
"node_modules/jose": {
"version": "6.2.12",
"resolved": "https://registry.npmjs.org/jose/-/jose-6.2.12.tgz",
@@ -1537,109 +404,6 @@
"url": "https://github.com/sponsors/panva"
}
},
- "node_modules/js-tokens": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
- "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
- "dev": true,
- "license": "MIT"
- },
- "node_modules/jsesc": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz",
- "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==",
- "dev": true,
- "license": "MIT",
- "bin": {
- "jsesc": "bin/jsesc"
- },
- "engines": {
- "node": ">=6"
- }
- },
- "node_modules/json5": {
- "version": "2.2.3",
- "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
- "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
- "dev": true,
- "license": "MIT",
- "bin": {
- "json5": "lib/cli.js"
- },
- "engines": {
- "node": ">=6"
- }
- },
- "node_modules/locate-path": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
- "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "p-locate": "^5.0.0"
- },
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
- "node_modules/lru-cache": {
- "version": "10.4.3",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz",
- "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==",
- "dev": true,
- "license": "ISC"
- },
- "node_modules/media-query-parser": {
- "version": "2.0.2",
- "resolved": "https://registry.npmjs.org/media-query-parser/-/media-query-parser-2.0.2.tgz",
- "integrity": "sha512-1N4qp+jE0pL5Xv4uEcwVUhIkwdUO3S/9gML90nqKA7v7FcOS5vUtatfzok9S9U1EJU8dHWlcv95WLnKmmxZI9w==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@babel/runtime": "^7.12.5"
- }
- },
- "node_modules/mlly": {
- "version": "1.8.2",
- "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.8.2.tgz",
- "integrity": "sha512-d+ObxMQFmbt10sretNDytwt85VrbkhhUA/JBGm1MPaWJ65Cl4wOgLaB1NYvJSZ0Ef03MMEU/0xpPMXUIQ29UfA==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "acorn": "^8.16.0",
- "pathe": "^2.0.3",
- "pkg-types": "^1.3.1",
- "ufo": "^1.6.3"
- }
- },
- "node_modules/modern-ahocorasick": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/modern-ahocorasick/-/modern-ahocorasick-1.1.0.tgz",
- "integrity": "sha512-sEKPVl2rM+MNVkGQt3ChdmD8YsigmXdn5NifZn6jiwn9LRJpWm8F3guhaqrJT/JOat6pwpbXEk6kv+b9DMIjsQ==",
- "dev": true,
- "license": "MIT"
- },
- "node_modules/ms": {
- "version": "2.1.3",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
- "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
- "dev": true,
- "license": "MIT"
- },
- "node_modules/node-releases": {
- "version": "2.0.57",
- "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.57.tgz",
- "integrity": "sha512-kQK9LGGFiHtrWiNhZtA7Qbw17AQz+dmsEKODRIVTXA9+e5MS/2gZEBhYJt13GrAz5/IOZKddH/0Z3TP/Zgo+yw==",
- "dev": true,
- "license": "MIT",
- "engines": {
- "node": ">=18"
- }
- },
"node_modules/oauth4webapi": {
"version": "3.8.8",
"resolved": "https://registry.npmjs.org/oauth4webapi/-/oauth4webapi-3.8.8.tgz",
@@ -1662,93 +426,6 @@
"url": "https://github.com/sponsors/panva"
}
},
- "node_modules/p-limit": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
- "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "yocto-queue": "^0.1.0"
- },
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
- "node_modules/p-locate": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
- "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "p-limit": "^3.0.2"
- },
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
- "node_modules/path-exists": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
- "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
- "dev": true,
- "license": "MIT",
- "engines": {
- "node": ">=8"
- }
- },
- "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/picocolors": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
- "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
- "dev": true,
- "license": "ISC"
- },
- "node_modules/pkg-types": {
- "version": "1.3.1",
- "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.3.1.tgz",
- "integrity": "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "confbox": "^0.1.8",
- "mlly": "^1.7.4",
- "pathe": "^2.0.1"
- }
- },
- "node_modules/require-like": {
- "version": "0.1.2",
- "resolved": "https://registry.npmjs.org/require-like/-/require-like-0.1.2.tgz",
- "integrity": "sha512-oyrU88skkMtDdauHDuKVrgR+zuItqr6/c//FXzvmxRGMexSDc6hNvJInGW3LL46n+8b50RykrvwSUIIQH2LQ5A==",
- "dev": true,
- "engines": {
- "node": "*"
- }
- },
- "node_modules/semver": {
- "version": "6.3.1",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
- "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
- "dev": true,
- "license": "ISC",
- "bin": {
- "semver": "bin/semver.js"
- }
- },
"node_modules/typescript": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-7.0.2.tgz",
@@ -1784,70 +461,12 @@
"@typescript/typescript-win32-x64": "7.0.2"
}
},
- "node_modules/ufo": {
- "version": "1.6.4",
- "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.4.tgz",
- "integrity": "sha512-JFNbkD1Svwe0KvGi8GOeLcP4kAWQ609twvCdcHxq1oSL8svv39ZuSvajcD8B+5D0eL4+s1Is2D/O6KN3qcTeRA==",
- "dev": true,
- "license": "MIT"
- },
"node_modules/undici-types": {
"version": "8.9.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.9.0.tgz",
"integrity": "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==",
"dev": true,
"license": "MIT"
- },
- "node_modules/update-browserslist-db": {
- "version": "1.3.3",
- "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.3.tgz",
- "integrity": "sha512-pJ2sYawQS0R/WI928Gj5GlPhTGzbMelq0+4INtSYNDV9ErKJcX6xjGWkoG/VnB3dpUm00zALaqkrUD77pO5TDQ==",
- "dev": true,
- "funding": [
- {
- "type": "opencollective",
- "url": "https://opencollective.com/browserslist"
- },
- {
- "type": "tidelift",
- "url": "https://tidelift.com/funding/github/npm/browserslist"
- },
- {
- "type": "github",
- "url": "https://github.com/sponsors/ai"
- }
- ],
- "license": "MIT",
- "dependencies": {
- "escalade": "^3.2.0",
- "picocolors": "^1.1.1"
- },
- "bin": {
- "update-browserslist-db": "cli.js"
- },
- "peerDependencies": {
- "browserslist": ">= 4.21.0"
- }
- },
- "node_modules/yallist": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
- "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
- "dev": true,
- "license": "ISC"
- },
- "node_modules/yocto-queue": {
- "version": "0.1.0",
- "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
- "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
- "dev": true,
- "license": "MIT",
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
}
}
}
diff --git a/package.json b/package.json
index 0c7798a..47f677a 100644
--- a/package.json
+++ b/package.json
@@ -1,13 +1,12 @@
{
"name": "dough-git",
"version": "1.0.0",
- "description": "A minimal self-hosted git mirror: HTTP clone/pull/push + cgit-style viewer, gated by PocketID (OIDC). Styled with Vanilla Extract.",
+ "description": "A minimal self-hosted git mirror: HTTP clone/pull/push + cgit-style viewer, gated by OIDC SSO.",
"type": "module",
"private": true,
"scripts": {
- "build": "node scripts/build.mjs",
- "start": "node --experimental-sqlite --disable-warning=ExperimentalWarning dist/server.js",
- "dev": "npm run build && npm start",
+ "start": "node --experimental-sqlite --disable-warning=ExperimentalWarning src/server.ts",
+ "dev": "node --experimental-sqlite --disable-warning=ExperimentalWarning --watch src/server.ts",
"typecheck": "tsc --noEmit",
"test": "node --experimental-sqlite --disable-warning=ExperimentalWarning --experimental-strip-types --test test/*.test.mjs"
},
@@ -19,12 +18,6 @@
},
"devDependencies": {
"@types/node": "^26.6.2",
- "@vanilla-extract/css": "^1.21.2",
- "@vanilla-extract/esbuild-plugin": "^2.3.22",
- "esbuild": "^0.28.2",
"typescript": "^7.0.2"
- },
- "allowScripts": {
- "esbuild": true
}
}
diff --git a/public/style.css b/public/style.css
new file mode 100644
index 0000000..bceae5b
--- /dev/null
+++ b/public/style.css
@@ -0,0 +1,743 @@
+/* public/style.css
+ * LICENCED DASL-1.0 (c) Clove Twilight
+ */
+
+:root {
+ color-scheme: dark;
+
+ --accent: #c22a44;
+ --gilt: #d8b775;
+ --danger: #ff4d5e;
+ --success: #5f9e78;
+
+ --bg-deep: #030207;
+ --bg-raised: #100a10;
+ --bg: #07050a;
+ --surface: #1a1016;
+ --surface-hi: #241318;
+ --border: #34141c;
+
+ --text-faint: #6b4a53;
+ --text-dim: #82616a;
+ --text-muted: #9c848c;
+ --text-soft: #c7b6ba;
+ --text: #ece3e6;
+
+ --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
+ --display: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
+ --mono: ui-monospace, "Cascadia Code", Menlo, monospace;
+ --radius: 8px;
+
+ --cursor-normal: url("https://m.doughmination.gay/cursors/sandrone/Normal.png") 0 0, default;
+ --cursor-link: url("https://m.doughmination.gay/cursors/sandrone/Link.png") 4 0, pointer;
+ --cursor-text: url("https://m.doughmination.gay/cursors/sandrone/Text.png") 4 9, text;
+ --cursor-no: url("https://m.doughmination.gay/cursors/sandrone/Unavailable.png") 0 0, not-allowed;
+}
+
+/* Base */
+
+* {
+ box-sizing: border-box;
+}
+
+html {
+ min-height: 100%;
+ background: linear-gradient(135deg, var(--bg) 0%, var(--bg-raised) 60%, var(--bg-deep) 100%);
+}
+
+body {
+ margin: 0;
+ min-height: 100vh;
+ font-family: var(--font);
+ font-size: 15px;
+ line-height: 1.5;
+ color: var(--text);
+ cursor: var(--cursor-normal);
+}
+
+a {
+ color: var(--accent);
+ text-decoration: none;
+}
+
+a:hover {
+ text-decoration: underline;
+}
+
+a,
+button,
+label:has(input[type="checkbox"]) {
+ cursor: var(--cursor-link);
+}
+
+h1,
+h2,
+h3 {
+ font-weight: 600;
+ line-height: 1.25;
+}
+
+table {
+ width: 100%;
+ border-collapse: collapse;
+}
+
+th,
+td {
+ text-align: left;
+ padding: 0.4rem 0.6rem;
+ border-bottom: 1px solid var(--border);
+ vertical-align: top;
+}
+
+th {
+ color: var(--text-muted);
+ font-weight: 600;
+ font-size: 0.85em;
+}
+
+code,
+pre {
+ font-family: var(--mono);
+}
+
+pre {
+ margin: 0;
+ overflow-x: auto;
+}
+
+/* Form controls */
+
+button,
+input[type="text"],
+input[type="url"],
+select {
+ font: inherit;
+ line-height: 1.5;
+ padding: 0.2rem 0.7rem;
+ border: 1px solid var(--border);
+ border-radius: var(--radius);
+}
+
+button {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.35rem;
+ background: var(--surface-hi);
+ color: var(--text-soft);
+}
+
+button:hover {
+ border-color: var(--accent);
+ color: var(--text);
+}
+
+button:active {
+ background: var(--surface);
+}
+
+input[type="text"],
+input[type="url"],
+select {
+ min-width: 0;
+ background: var(--bg-deep);
+ color: var(--text);
+ cursor: var(--cursor-text);
+}
+
+input::placeholder {
+ color: var(--text-faint);
+}
+
+input:hover,
+select:hover {
+ border-color: var(--text-faint);
+}
+
+button:focus-visible,
+input:focus-visible,
+select:focus-visible {
+ outline: 1px solid var(--accent);
+ outline-offset: 1px;
+ border-color: var(--accent);
+}
+
+button:disabled {
+ opacity: 0.5;
+ cursor: var(--cursor-no);
+}
+
+input[type="checkbox"] {
+ accent-color: var(--accent);
+ vertical-align: -0.1em;
+ margin: 0 0.35rem 0 0;
+}
+
+.icon {
+ display: inline-block;
+ vertical-align: middle;
+ flex-shrink: 0;
+ fill: currentColor;
+ shape-rendering: crispEdges;
+}
+
+/* Site chrome */
+
+.site-header {
+ display: grid;
+ grid-template-columns: 1fr auto 1fr;
+ align-items: center;
+ gap: 1rem;
+ padding: 0.75rem 1.25rem;
+ border-bottom: 1px solid var(--border);
+ background: var(--bg-raised);
+}
+
+.site-title {
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+ font-weight: 700;
+ font-size: 1.1rem;
+ color: var(--text);
+}
+
+.site-logo {
+ width: 1.5rem;
+ height: 1.5rem;
+ object-fit: cover;
+}
+
+.site-who {
+ display: flex;
+ justify-content: center;
+ min-width: 0;
+}
+
+.site-nav {
+ display: flex;
+ align-items: center;
+ justify-content: flex-end;
+ gap: 0.75rem;
+}
+
+.nav-link {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.35rem;
+ color: var(--accent);
+}
+
+.nav-form {
+ display: inline;
+ margin: 0;
+}
+
+/* A form button that looks like the nav links beside it */
+.nav-link.nav-button,
+.nav-link.nav-button:hover,
+.nav-link.nav-button:active {
+ padding: 0;
+ border: 0;
+ background: none;
+ color: var(--accent);
+}
+
+.nav-link.nav-button:hover {
+ text-decoration: underline;
+}
+
+.user {
+ display: flex;
+ align-items: center;
+ gap: 0.4rem;
+ min-width: 0;
+ color: var(--text-muted);
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+.content {
+ max-width: 960px;
+ margin: 0 auto;
+ padding: 1.25rem;
+}
+
+.site-footer {
+ color: var(--text-dim);
+ text-align: center;
+ padding: 2rem 0;
+ font-size: 0.85em;
+}
+
+/* Avatars and profiles */
+
+.avatar {
+ position: relative;
+ flex-shrink: 0;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ background: var(--surface-hi);
+ color: var(--text-soft);
+ font-weight: 600;
+ line-height: 1;
+ overflow: hidden;
+ user-select: none;
+}
+
+.avatar-sm {
+ width: 25px;
+ height: 25px;
+ font-size: 13px;
+}
+
+.avatar-lg {
+ width: 60px;
+ height: 60px;
+ font-size: 30px;
+}
+
+.avatar img {
+ position: absolute;
+ inset: 0;
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+}
+
+.profile-head {
+ display: flex;
+ align-items: center;
+ gap: 1rem;
+ margin: 0.5rem 0 1.5rem;
+}
+
+/* Headings */
+
+.page-title {
+ font-size: 1.4rem;
+ margin: 0.25rem 0 1rem;
+}
+
+.repo-title,
+.profile-name {
+ font-family: var(--display);
+ color: var(--gilt);
+ font-weight: 500;
+ letter-spacing: 0.01em;
+ margin: 0.25rem 0 1rem;
+}
+
+.repo-title {
+ font-size: 1.55rem;
+}
+
+.profile-name {
+ font-size: 1.6rem;
+ margin: 0;
+}
+
+.section-title {
+ display: flex;
+ align-items: center;
+ gap: 0.4rem;
+ font-size: 1.05rem;
+ margin: 1.5rem 0 0.5rem;
+ color: var(--text-soft);
+}
+
+/* Text helpers */
+
+.with-icon {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.4rem;
+}
+
+.muted {
+ color: var(--text-muted);
+}
+
+.empty {
+ color: var(--text-dim);
+}
+
+.mono {
+ font-family: var(--mono);
+ font-size: 0.85em;
+ color: var(--text-dim);
+ white-space: nowrap;
+}
+
+.repo-name {
+ font-family: var(--display);
+ color: var(--gilt);
+ font-size: 1.05em;
+ font-weight: 500;
+}
+
+.right {
+ text-align: right;
+}
+
+.good {
+ color: var(--success);
+}
+
+.warn {
+ color: var(--accent);
+}
+
+.bad {
+ color: var(--danger);
+}
+
+.badge {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.25rem;
+ padding: 0.05rem 0.4rem;
+ margin-left: 0.4rem;
+ border: 1px solid var(--border);
+ background: var(--surface-hi);
+ font-family: var(--mono);
+ font-size: 0.75em;
+ color: var(--text-muted);
+ vertical-align: middle;
+}
+
+/* Boxes, rows, tabs */
+
+.box {
+ margin: 1rem 0;
+ padding: 0.6rem 0.9rem;
+ background: var(--surface);
+ border: 1px solid var(--border);
+ border-radius: var(--radius);
+}
+
+.label {
+ color: var(--text-muted);
+ margin-right: 0.5rem;
+}
+
+.row {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ gap: 0.5rem;
+}
+
+.grow {
+ flex: 1 1 12rem;
+ min-width: 0;
+}
+
+.tabs {
+ display: flex;
+ gap: 0.5rem;
+ margin: 0.75rem 0;
+}
+
+.tab {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.4rem;
+ padding: 0.2rem 0.7rem;
+ border: 1px solid var(--border);
+ border-radius: var(--radius);
+ color: var(--text-soft);
+}
+
+.tab.active {
+ background: var(--surface-hi);
+ color: var(--text);
+ font-weight: 600;
+}
+
+.rev-picker {
+ margin: 0.75rem 0;
+}
+
+.code {
+ display: block;
+ padding: 0.75rem 1rem;
+ background: var(--surface);
+ border: 1px solid var(--border);
+ border-radius: var(--radius);
+ font-size: 0.85rem;
+ color: var(--text-soft);
+}
+
+.commit-meta {
+ display: grid;
+ grid-template-columns: max-content 1fr;
+ gap: 0.2rem 1rem;
+ margin: 0.75rem 0;
+}
+
+.mirror-row {
+ display: grid;
+ grid-template-columns: minmax(5rem, auto) minmax(9rem, auto) auto 1fr;
+ gap: 0.5rem 1rem;
+ align-items: baseline;
+ padding: 0.3rem 0;
+}
+
+.mirror-kind {
+ color: var(--text-soft);
+ font-weight: 600;
+}
+
+@media screen and (max-width: 40rem) {
+ .mirror-row {
+ grid-template-columns: 1fr;
+ gap: 0.1rem;
+ padding-bottom: 0.6rem;
+ }
+}
+
+/* Rendered README */
+
+.readme {
+ margin: 1rem 0;
+ padding: 1rem 1.25rem;
+ background: var(--surface);
+ border: 1px solid var(--border);
+ border-radius: var(--radius);
+ overflow-wrap: break-word;
+}
+
+.readme > :first-child,
+.readme .md-alert > :first-child {
+ margin-top: 0;
+}
+
+.readme > :last-child,
+.readme .md-alert > :last-child {
+ margin-bottom: 0;
+}
+
+.readme :is(h1, h2, h3, h4, h5, h6) {
+ font-family: var(--display);
+ font-weight: 600;
+ line-height: 1.25;
+ letter-spacing: 0.01em;
+ margin: 1.5rem 0 0.75rem;
+}
+
+.readme h1 {
+ font-size: 1.5rem;
+}
+
+.readme h2 {
+ font-size: 1.25rem;
+}
+
+.readme h3 {
+ font-size: 1.05rem;
+}
+
+.readme :is(h4, h5, h6) {
+ font-size: 0.95rem;
+ color: var(--text-soft);
+}
+
+.readme :is(h1, h2) {
+ padding-bottom: 0.3rem;
+ border-bottom: 1px solid var(--border);
+}
+
+.readme :is(p, ul, ol, pre, blockquote, table) {
+ margin: 0.75rem 0;
+}
+
+.readme code {
+ background: var(--surface-hi);
+ padding: 0.12em 0.35em;
+ font-size: 0.9em;
+}
+
+.readme pre {
+ padding: 0.75rem 1rem;
+ background: var(--bg-deep);
+ border: 1px solid var(--border);
+ border-radius: var(--radius);
+}
+
+.readme pre code {
+ background: none;
+ padding: 0;
+ font-size: 0.85rem;
+ color: var(--text-soft);
+}
+
+.readme blockquote {
+ padding: 0.1rem 0 0.1rem 1rem;
+ border-left: 3px solid var(--border);
+ color: var(--text-muted);
+}
+
+.readme :is(ul, ol) {
+ padding-left: 1.5rem;
+}
+
+.readme li {
+ margin: 0.25rem 0;
+}
+
+.readme hr {
+ border: 0;
+ border-top: 1px solid var(--border);
+ margin: 1.5rem 0;
+}
+
+.readme img {
+ max-width: 100%;
+ vertical-align: middle;
+}
+
+.readme table {
+ display: block;
+ width: max-content;
+ max-width: 100%;
+ overflow-x: auto;
+}
+
+.readme [data-align="center"] {
+ text-align: center;
+}
+
+.readme [data-align="right"] {
+ text-align: right;
+}
+
+.readme del {
+ color: var(--text-dim);
+}
+
+/* README alerts: > [!NOTE] and friends */
+
+.readme .md-alert {
+ --alert: var(--border);
+ margin: 0.75rem 0;
+ padding: 0.5rem 1rem;
+ border-left: 3px solid var(--alert);
+ border-radius: var(--radius);
+ color: var(--text-soft);
+}
+
+.readme .md-alert-title {
+ display: flex;
+ align-items: center;
+ gap: 0.4rem;
+ margin: 0 0 0.5rem;
+ font-weight: 600;
+ color: var(--alert);
+}
+
+.readme .md-alert-note {
+ --alert: #47b6ee;
+}
+
+.readme .md-alert-tip {
+ --alert: #96d94f;
+}
+
+.readme .md-alert-important {
+ --alert: #b58fe0;
+}
+
+.readme .md-alert-warning {
+ --alert: #f2b23c;
+}
+
+.readme .md-alert-caution {
+ --alert: #ef6144;
+}
+
+.readme .md-alert-frozen {
+ --alert: #b8dfe8;
+ background: rgba(184, 223, 232, 0.05);
+}
+
+.readme .md-alert-aside {
+ --alert: #74c2a8;
+ border-left-width: 2px;
+ color: var(--text-muted);
+}
+
+.readme .md-alert-aside .md-alert-title {
+ font-weight: 400;
+}
+
+/* README pride text: gradient-filled words */
+
+.readme .md-pride {
+ font-weight: 600;
+ color: var(--text);
+}
+
+@supports (background-clip: text) or (-webkit-background-clip: text) {
+ .readme .md-pride {
+ -webkit-background-clip: text;
+ background-clip: text;
+ color: transparent;
+ }
+}
+
+@media (prefers-contrast: more) {
+ .readme .md-pride {
+ background-image: none !important;
+ color: var(--text);
+ -webkit-text-fill-color: var(--text);
+ }
+}
+
+.readme .md-pride a {
+ color: inherit;
+ text-decoration: underline;
+}
+
+.readme .md-pride code {
+ color: var(--text-soft);
+ -webkit-text-fill-color: var(--text-soft);
+}
+
+.readme .md-pride-gay {
+ background-image: linear-gradient(96deg, #13a888, #26ceaa, #98e8c1, #7bade2, #918cdf);
+}
+
+.readme .md-pride-lesbian {
+ background-image: linear-gradient(96deg, #ec7151, #e8782e, #ee9d67, #f2f7fb, #d675af, #ee63b5);
+}
+
+.readme .md-pride-bisexual {
+ background-image: linear-gradient(96deg, #ee64ab, #bf80ba, #6894ee);
+}
+
+.readme .md-pride-transgender {
+ background-image: linear-gradient(96deg, #67c9ee, #f5a9b8, #f2f7fb, #f5a9b8, #67c9ee);
+}
+
+.readme .md-pride-pansexual {
+ background-image: linear-gradient(96deg, #ee65a7, #e6c619, #37aae9);
+}
+
+.readme .md-pride-asexual {
+ background-image: linear-gradient(96deg, #8fa4bc, #c3d3e2, #f2f7fb, #ec54ec);
+}
+
+.readme .md-pride-aromantic {
+ background-image: linear-gradient(96deg, #3fab44, #a7d379, #f2f7fb, #c3d3e2, #8fa4bc);
+}
+
+.readme .md-pride-nonbinary {
+ background-image: linear-gradient(96deg, #eae446, #f2f7fb, #b480dc, #8fa4bc);
+}
+
+.readme .md-pride-queer {
+ background-image: linear-gradient(96deg, #ef6d6d, #e68a19, #e6d719, #13ac41, #7994dd, #c578d5);
+}
diff --git a/scripts/build.mjs b/scripts/build.mjs
deleted file mode 100644
index a1dcacf..0000000
--- a/scripts/build.mjs
+++ /dev/null
@@ -1,29 +0,0 @@
-/* scripts/build.mjs
- * LICENCED DASL-1.0 (c) Clove Twilight
- */
-
-import { build } from "esbuild";
-import { vanillaExtractPlugin } from "@vanilla-extract/esbuild-plugin";
-import { mkdirSync, copyFileSync, existsSync } from "node:fs";
-
-await build({
- entryPoints: { server: "src/server.ts" },
- bundle: true,
- platform: "node",
- format: "esm",
- target: "node22",
- packages: "external",
- external: ["/static/*"],
- outdir: "dist",
- minify: true,
- logLevel: "info",
- plugins: [vanillaExtractPlugin()],
-});
-
-mkdirSync("public", { recursive: true });
-if (existsSync("dist/server.css")) {
- copyFileSync("dist/server.css", "public/style.css");
- console.log("build: wrote public/style.css");
-} else {
- throw new Error("build: expected dist/server.css was not emitted");
-}
diff --git a/src/auth.ts b/src/auth.ts
index f4ecc72..23a6fb7 100644
--- a/src/auth.ts
+++ b/src/auth.ts
@@ -26,13 +26,13 @@ function sign(payload: string): string {
.digest("base64url");
}
-export function signValue(data: object, ttlSeconds: number): string {
+function signValue(data: object, ttlSeconds: number): string {
const body = { ...data, exp: Math.floor(Date.now() / 1000) + ttlSeconds };
const payload = b64url(JSON.stringify(body));
return `${payload}.${sign(payload)}`;
}
-export function verifyValue<T>(token: string | undefined): T | null {
+function verifyValue<T>(token: string | undefined): T | null {
if (!token) return null;
const dot = token.lastIndexOf(".");
if (dot === -1) return null;
@@ -103,7 +103,7 @@ export function authenticateGit(header: string | undefined): GitAuth {
kind: "rejected",
message:
"this token predates per-user ownership and can't be attributed — " +
- "sign in to the web UI once to adopt it, or mint a new one at /tokens",
+ "sign in to the web UI once to adopt it, or mint a new one at /settings/tokens",
};
}
@@ -312,5 +312,3 @@ export async function logout(token: string | undefined): Promise<string> {
return home;
}
}
-
-export { oidcEnabled };
diff --git a/src/git.ts b/src/git.ts
index e5da8eb..18c13c2 100644
--- a/src/git.ts
+++ b/src/git.ts
@@ -86,15 +86,19 @@ export function ownerSlug(raw: string): string {
return slug || "user";
}
-export async function repoExists(ref: RepoRef): Promise<boolean> {
+async function pathExists(path: string): Promise<boolean> {
try {
- await access(join(refDir(ref), "HEAD"));
+ await access(path);
return true;
} catch {
return false;
}
}
+export function repoExists(ref: RepoRef): Promise<boolean> {
+ return pathExists(join(refDir(ref), "HEAD"));
+}
+
export async function initBareRepo(ref: RepoRef): Promise<void> {
const dir = refDir(ref);
await mkdir(dir, { recursive: true });
@@ -110,10 +114,7 @@ export interface CreateResult {
reserved?: boolean;
}
-export async function createRepo(
- owner: string,
- nameRaw: string,
-): Promise<CreateResult> {
+async function claimName(owner: string, nameRaw: string): Promise<CreateResult> {
const ref = safeRef(owner, nameRaw);
if (!ref) {
return { ok: false, error: "invalid name — use letters, digits, . _ -" };
@@ -130,10 +131,15 @@ export async function createRepo(
reserved: true,
};
}
- await initBareRepo(ref);
return { ok: true, ref };
}
+export async function createRepo(owner: string, nameRaw: string): Promise<CreateResult> {
+ const claim = await claimName(owner, nameRaw);
+ if (claim.ref) await initBareRepo(claim.ref);
+ return claim;
+}
+
async function pruneEmptyDir(dir: string): Promise<void> {
try {
if ((await readdir(dir)).length === 0) {
@@ -143,15 +149,6 @@ async function pruneEmptyDir(dir: string): Promise<void> {
}
}
-async function pathExists(p: string): Promise<boolean> {
- try {
- await access(p);
- return true;
- } catch {
- return false;
- }
-}
-
const TRASH_DIR = ".trash";
export const DELETED_META = "dough-deleted.json";
@@ -368,13 +365,8 @@ export async function purgeAllExpired(): Promise<TrashEntry[]> {
return purged;
}
-export async function isRepoPublic(ref: RepoRef): Promise<boolean> {
- try {
- await access(join(refDir(ref), config.publicMarker));
- return true;
- } catch {
- return false;
- }
+export function isRepoPublic(ref: RepoRef): Promise<boolean> {
+ return pathExists(join(refDir(ref), config.publicMarker));
}
export async function setRepoPublic(ref: RepoRef, isPublic: boolean): Promise<void> {
@@ -570,6 +562,62 @@ export async function lsRemote(url: string): Promise<LsRemoteResult> {
}
}
+const IMPORT_TIMEOUT_MS = 10 * 60_000;
+
+// Any public https forge, but never a host on this machine or a raw IP
+const IMPORT_URL = /^https:\/\/[A-Za-z0-9.-]+\.[A-Za-z]{2,}\/[A-Za-z0-9._~\/-]+$/;
+
+export function importUrl(raw: string): string | null {
+ const value = raw.trim().replace(/\/+$/, "");
+ if (value.length > 400 || !IMPORT_URL.test(value) || value.includes("..")) return null;
+ return value;
+}
+
+// "https://codeberg.org/someone/thing.git" -> "thing"
+export function nameFromUrl(url: string): string {
+ return (url.split("/").pop() ?? "").replace(/\.git$/, "");
+}
+
+export async function importRepo(
+ owner: string,
+ nameRaw: string,
+ urlRaw: string,
+): Promise<CreateResult> {
+ const url = importUrl(urlRaw);
+ if (!url) {
+ return {
+ ok: false,
+ error: "give a public https clone URL, like https://codeberg.org/owner/repo.git",
+ };
+ }
+
+ const claim = await claimName(owner, nameRaw.trim() || nameFromUrl(url));
+ if (!claim.ref) return claim;
+
+ const dir = refDir(claim.ref);
+ await mkdir(join(config.reposRoot, owner), { recursive: true });
+ try {
+ await exec(
+ "git",
+ [...REMOTE_HARDENING, "clone", "--bare", "--quiet", "--", url, dir],
+ {
+ timeout: IMPORT_TIMEOUT_MS,
+ killSignal: "SIGKILL",
+ encoding: "utf8",
+ env: REMOTE_ENV,
+ windowsHide: true,
+ },
+ );
+ await git(dir, ["remote", "remove", "origin"]);
+ return claim;
+ } catch (err) {
+ await rm(dir, { recursive: true, force: true });
+ const e = err as { stderr?: string; killed?: boolean; message?: string };
+ const { message } = classifyRemoteError(e.stderr ?? e.message ?? "", e.killed === true);
+ return { ok: false, error: `could not import ${url}: ${message}` };
+ }
+}
+
export async function localMirrorRefs(ref: RepoRef): Promise<Map<string, string>> {
const out = new Map<string, string>();
try {
@@ -683,6 +731,11 @@ export async function setLinks(ref: RepoRef, links: MirrorLink[]): Promise<void>
await writeFile(path, serialiseLinks(valid) + "\n");
}
+// "refs/heads/main" -> "main", "refs/tags/v1" -> "tag v1"
+export function shortRef(name: string): string {
+ return name.replace(/^refs\/heads\//, "").replace(/^refs\/tags\//, "tag ");
+}
+
export interface RefList {
branches: string[];
tags: string[];
@@ -726,17 +779,7 @@ export async function resolveRev(
if (!wanted) return fallback;
if (refs.branches.includes(wanted) || refs.tags.includes(wanted)) return wanted;
- const sha = safeObjectId(wanted);
- if (sha) {
- try {
- await git(refDir(ref), ["cat-file", "-e", `${sha}^{commit}`]);
- return sha;
- } catch {
- return fallback;
- }
- }
-
- return fallback;
+ return (await hasCommit(ref, wanted)) ? wanted : fallback;
}
async function lastCommitTime(dir: string): Promise<number | null> {
@@ -756,18 +799,12 @@ export interface Commit {
subject: string;
}
-export async function log(ref: RepoRef, refspec: string, limit = 50): Promise<Commit[]> {
- const dir = refDir(ref);
- const format = ["%H", "%an", "%ae", "%at", "%s"].join(FNUL);
+const COMMIT_FORMAT = ["%H", "%an", "%ae", "%at", "%s"].join(FNUL) + FREC;
+
+async function readCommits(ref: RepoRef, args: string[]): Promise<Commit[]> {
let out: string;
try {
- out = await git(dir, [
- "log",
- `--max-count=${limit}`,
- `--format=${format}${FREC}`,
- refspec,
- "--",
- ]);
+ out = await git(refDir(ref), ["log", `--format=${COMMIT_FORMAT}`, ...args, "--"]);
} catch {
return [];
}
@@ -787,6 +824,10 @@ export async function log(ref: RepoRef, refspec: string, limit = 50): Promise<Co
});
}
+export function log(ref: RepoRef, refspec: string, limit = 50): Promise<Commit[]> {
+ return readCommits(ref, [`--max-count=${limit}`, refspec]);
+}
+
export async function logRange(
ref: RepoRef,
from: string | null,
@@ -794,38 +835,13 @@ export async function logRange(
limit: number,
): Promise<Commit[]> {
const toId = safeObjectId(to);
- if (!toId) return [];
const fromId = from ? safeObjectId(from) : null;
- if (from && !fromId) return [];
+ if (!toId || (from && !fromId)) return [];
- const dir = refDir(ref);
- const format = ["%H", "%an", "%ae", "%at", "%s"].join(FNUL);
- let out: string;
- try {
- out = await git(dir, [
- "log",
- `--max-count=${Math.max(1, Math.floor(limit))}`,
- `--format=${format}${FREC}`,
- ...(fromId ? [`${fromId}..${toId}`] : [toId]),
- "--",
- ]);
- } catch {
- return [];
- }
- return out
- .split(REC)
- .map((row) => row.replace(/^\n/, ""))
- .filter((row) => row.trim().length > 0)
- .map((row) => {
- const [hash, author, email, time, subject] = row.split(NUL);
- return {
- hash: hash ?? "",
- author: author ?? "",
- email: email ?? "",
- time: Number(time ?? 0),
- subject: subject ?? "",
- };
- });
+ return readCommits(ref, [
+ `--max-count=${Math.max(1, Math.floor(limit))}`,
+ fromId ? `${fromId}..${toId}` : toId,
+ ]);
}
export interface TreeEntry {
diff --git a/src/mirror.ts b/src/mirror.ts
index afb33d7..78566c5 100644
--- a/src/mirror.ts
+++ b/src/mirror.ts
@@ -8,7 +8,9 @@ import {
localMirrorRefs,
hasCommit,
isAncestor,
+ listRefs,
refSlug,
+ shortRef,
type RepoRef,
type MirrorLink,
} from "./git.ts";
@@ -341,10 +343,6 @@ export function mismatchReasons(
];
}
-function shortRef(name: string): string {
- return name.replace(/^refs\/heads\//, "").replace(/^refs\/tags\//, "tag ");
-}
-
export function describeMismatch(cmp: Comparison): string {
const base = `${cmp.matched}/${cmp.total} refs`;
const parts = [
@@ -362,7 +360,6 @@ async function defaultBranchRef(
ref: RepoRef,
local: Map<string, string>,
): Promise<string | null> {
- const { listRefs } = await import("./git.ts");
try {
const refs = await listRefs(ref);
const head = `refs/heads/${refs.head}`;
diff --git a/src/notify.ts b/src/notify.ts
index 15adb6d..8fad751 100644
--- a/src/notify.ts
+++ b/src/notify.ts
@@ -6,6 +6,7 @@ import {
refSlug,
logRange,
isAncestor,
+ shortRef,
type Commit,
type RepoRef,
} from "./git.ts";
@@ -65,10 +66,6 @@ export interface Embed {
color: number;
}
-function shortRef(ref: string): string {
- return ref.replace(/^refs\/heads\//, "").replace(/^refs\/tags\//, "tag ");
-}
-
function repoUrl(repo: RepoRef): string {
return `${config.baseUrl}/${repo.owner}/${repo.name}`;
}
diff --git a/src/server.ts b/src/server.ts
index 65d225f..06e6a61 100644
--- a/src/server.ts
+++ b/src/server.ts
@@ -19,6 +19,7 @@ import {
oidcIssuer,
authenticateGit,
gitActor,
+ sessionSlug,
type SessionUser,
} from "./auth.ts";
import { SESSION_TTL, purgeExpiredSessions } from "./sessions.ts";
@@ -63,6 +64,8 @@ import {
repoExists,
initBareRepo,
createRepo,
+ importRepo,
+ type CreateResult,
trashRepo,
listTrash,
restoreFromTrash,
@@ -103,6 +106,20 @@ const app = new Hono<Env>({ strict: false });
const SITE_ORIGIN = new URL(config.baseUrl).origin;
+function fail(
+ c: Context<Env>,
+ title: string,
+ message: string,
+ status: 400 | 403 | 404 | 409 | 501 = 400,
+) {
+ return c.html(view.messagePage({ title, message, user: c.get("user") }), status);
+}
+
+// The signed-in user, on routes behind the login guard
+function me(c: Context<Env>): SessionUser {
+ return c.get("user")!;
+}
+
const GIT_RPC = /\/(?:git-upload-pack|git-receive-pack)$/;
app.use("*", async (c, next) => {
@@ -211,14 +228,7 @@ app.get("/static/*", (c) => {
app.get("/auth/login", async (c) => {
if (!oidcEnabled) {
- return c.html(
- view.messagePage({
- title: "login unavailable",
- message: "Single sign-on (OIDC) is not configured on this instance.",
- user: null,
- }),
- 501,
- );
+ return fail(c, "login unavailable", "Single sign-on (OIDC) is not configured on this instance.", 501);
}
const { redirectUrl, txCookie } = await startLogin();
setCookie(c, OAUTH_COOKIE, txCookie, {
@@ -268,17 +278,11 @@ app.get("/auth/callback", async (c) => {
);
}
if (!session) {
- return c.html(
- view.messagePage({
- title: "login failed",
- message:
- idpError === "access_denied"
- ? "Your SSO account isn't allowed to use this instance. Ask an SSO admin to add you to its allowed groups."
- : "Could not complete sign-in. Please try again.",
- user: null,
- }),
- 403,
- );
+ const message =
+ idpError === "access_denied"
+ ? "Your SSO account isn't allowed to use this instance. Ask an SSO admin to add you to its allowed groups."
+ : "Could not complete sign-in. Please try again.";
+ return fail(c, "login failed", message, 403);
}
setCookie(c, SESSION_COOKIE, session, {
httpOnly: true,
@@ -300,51 +304,46 @@ app.post("/auth/logout", async (c) => {
app.get("/auth/logout", (c) => c.redirect("/"));
+// Settings and repo creation need a signed-in user
+for (const path of ["/settings", "/settings/*", "/new", "/new/*"]) {
+ app.use(path, async (c, next) => {
+ if (c.get("user")) return next();
+ return c.req.method === "GET" ? c.redirect("/auth/login") : c.text("forbidden\n", 403);
+ });
+}
+
app.get("/settings", (c) => {
- const user = c.get("user");
- if (!user) return c.redirect("/auth/login");
+ const user = me(c);
return c.html(
view.settingsPage({
user,
- settings: getSettings(view.ownerOf(user)),
- saved: c.req.query("saved") ? "saved." : null,
+ settings: getSettings(sessionSlug(user)),
+ saved: Boolean(c.req.query("saved")),
}),
);
});
app.post("/settings/discord", async (c) => {
- const user = c.get("user");
- if (!user) return c.text("forbidden\n", 403);
- const owner = view.ownerOf(user);
const form = await c.req.formData();
const raw = String(form.get("url") ?? "").trim();
- if (!raw) {
- setDiscordWebhook(owner, null);
- return c.redirect("/settings?saved=1");
- }
- const url = discordWebhookUrl(raw);
- if (!url) {
- return c.html(
- view.messagePage({
- title: "not a discord webhook",
- message:
- "That doesn't look like a Discord webhook URL. It should start with " +
- "https://discord.com/api/webhooks/ — nothing else is accepted.",
- user,
- }),
- 400,
+ // Blank clears the webhook; anything else must be a real Discord one
+ const url = raw ? discordWebhookUrl(raw) : null;
+ if (raw && !url) {
+ return fail(
+ c,
+ "not a discord webhook",
+ "That doesn't look like a Discord webhook URL. It should start with " +
+ "https://discord.com/api/webhooks/ — nothing else is accepted.",
);
}
- setDiscordWebhook(owner, url);
+ setDiscordWebhook(sessionSlug(me(c)), url);
return c.redirect("/settings?saved=1");
});
app.post("/settings/prefs", async (c) => {
- const user = c.get("user");
- if (!user) return c.text("forbidden\n", 403);
const form = await c.req.formData();
- setPrefs(view.ownerOf(user), {
+ setPrefs(sessionSlug(me(c)), {
defaultPrivate: form.get("default_private") != null,
discordPrivate: form.get("discord_private") != null,
mirrorAuto: form.get("mirror_auto") != null,
@@ -353,36 +352,39 @@ app.post("/settings/prefs", async (c) => {
});
app.get("/settings/tokens", (c) => {
- const user = c.get("user");
- if (!user) return c.redirect("/auth/login");
- const owner = view.ownerOf(user);
- return c.html(view.tokensPage({ tokens: listTokens(owner), user }));
+ const user = me(c);
+ return c.html(
+ view.tokensPage({
+ tokens: listTokens(sessionSlug(user)),
+ user,
+ }),
+ );
});
app.post("/settings/tokens", async (c) => {
- const user = c.get("user");
- if (!user) return c.text("forbidden\n", 403);
- const owner = view.ownerOf(user);
+ const user = me(c);
+ const owner = sessionSlug(user);
const form = await c.req.formData();
- const plaintext = createToken(String(form.get("label") ?? ""), owner, user.sub);
+ const newToken = createToken(String(form.get("label") ?? ""), owner, user.sub);
return c.html(
- view.tokensPage({ tokens: listTokens(owner), user, newToken: plaintext }),
+ view.tokensPage({
+ tokens: listTokens(owner),
+ user,
+ newToken,
+ }),
);
});
app.post("/settings/tokens/:id/revoke", (c) => {
- const user = c.get("user");
- if (!user) return c.text("forbidden\n", 403);
- revokeToken(c.req.param("id"), view.ownerOf(user));
+ revokeToken(c.req.param("id"), sessionSlug(me(c)));
return c.redirect("/settings/tokens");
});
app.get("/tokens", (c) => c.redirect("/settings/tokens", 301));
app.get("/settings/deleted", async (c) => {
- const user = c.get("user");
- if (!user) return c.redirect("/auth/login");
- const owner = view.ownerOf(user);
+ const user = me(c);
+ const owner = sessionSlug(user);
for (const gone of await purgeExpired(owner)) {
clearRepoMetadata({ owner, name: gone.name });
@@ -399,30 +401,19 @@ app.get("/settings/deleted", async (c) => {
});
app.post("/settings/deleted/restore", async (c) => {
- const user = c.get("user");
- if (!user) return c.text("forbidden\n", 403);
- const owner = view.ownerOf(user);
+ const owner = sessionSlug(me(c));
const form = await c.req.formData();
const result = await restoreFromTrash(owner, String(form.get("entry") ?? ""));
if (!result.ok || !result.meta) {
- return c.html(
- view.messagePage({
- title: "could not restore",
- message: result.error ?? "unknown error",
- user,
- }),
- 400,
- );
+ return fail(c, "could not restore", result.error ?? "unknown error");
}
const ref = { owner, name: result.meta.name };
for (const grant of result.meta.grants) {
if (!isLevel(grant.level)) continue;
if (!findUserBySlug(grant.slug)) {
- console.warn(
- `[trash] restoring ${refSlug(ref)}: dropping grant for unknown user ${grant.slug}`,
- );
+ console.warn(`[trash] restoring ${refSlug(ref)}: dropping grant for unknown user ${grant.slug}`);
continue;
}
setCollaborator(ref, grant.slug, grant.level);
@@ -433,9 +424,7 @@ app.post("/settings/deleted/restore", async (c) => {
});
app.post("/settings/deleted/purge", async (c) => {
- const user = c.get("user");
- if (!user) return c.text("forbidden\n", 403);
- const owner = view.ownerOf(user);
+ const owner = sessionSlug(me(c));
const form = await c.req.formData();
const entry = String(form.get("entry") ?? "");
@@ -447,29 +436,36 @@ app.post("/settings/deleted/purge", async (c) => {
return c.redirect("/settings/deleted");
});
-app.post("/new", async (c) => {
- const user = c.get("user");
- if (!user) return c.text("forbidden\n", 403);
- const form = await c.req.formData();
- const owner = view.ownerOf(user);
- const result = await createRepo(owner, String(form.get("name") ?? ""));
+app.get("/new", (c) => c.html(view.newRepoPage(me(c))));
+
+// Shared tail of "create empty" and "import": metadata, visibility, notify
+async function finishCreate(c: Context<Env>, result: CreateResult, verb: string) {
if (!result.ok || !result.ref) {
- return c.html(
- view.messagePage({
- title: result.reserved ? "that name is still reserved" : "could not create repo",
- message: result.error ?? "unknown error",
- user,
- }),
- result.reserved ? 409 : 400,
- );
+ const title = result.reserved ? "that name is still reserved" : `could not ${verb} repo`;
+ return fail(c, title, result.error ?? "unknown error", result.reserved ? 409 : 400);
}
+
+ const owner = sessionSlug(me(c));
clearRepoMetadata(result.ref);
const startsPublic = !getSettings(owner).defaultPrivate;
- if (startsPublic) {
- await setRepoPublic(result.ref, true);
- }
+ if (startsPublic) await setRepoPublic(result.ref, true);
notifyRepoCreated(result.ref, owner, startsPublic);
return c.redirect(`/${result.ref.owner}/${result.ref.name}/`);
+}
+
+app.post("/new", async (c) => {
+ const form = await c.req.formData();
+ const result = await createRepo(sessionSlug(me(c)), String(form.get("name") ?? ""));
+ return finishCreate(c, result, "create");
+});
+
+app.post("/new/import", async (c) => {
+ const form = await c.req.formData();
+ const url = String(form.get("url") ?? "");
+ const name = String(form.get("name") ?? "");
+ const result = await importRepo(sessionSlug(me(c)), name, url);
+ if (result.ref) console.log(`[import] ${refSlug(result.ref)} from ${url}`);
+ return finishCreate(c, result, "import");
});
function refFromPath(c: Context<Env>, nameParam: "name" | "repo"): RepoRef | null {
@@ -614,7 +610,7 @@ app.post("/:owner/:repo/git-receive-pack", (c) => rpcHandler(c, "git-receive-pac
function viewerOf(c: { get: (k: "user") => SessionUser | null }): string | null {
const user = c.get("user");
- return user ? view.ownerOf(user) : null;
+ return user ? sessionSlug(user) : null;
}
function readable(all: RepoSummary[], viewer: string | null): RepoSummary[] {
@@ -632,22 +628,11 @@ app.get("/", async (c) => {
const viewer = viewerOf(c);
const all = (await listRepos()).filter((r) => !isProfileRepo(r.name));
const shared = viewer ? new Set(sharedWith(viewer).map((r) => `${r.owner}/${r.name}`)) : null;
- return c.html(
- view.repoListPage(readable(all, viewer), user, {
- sharedSlugs: shared,
- }),
- );
+ return c.html(view.repoListPage(readable(all, viewer), user, shared));
});
function notFound(c: Context<Env>) {
- return c.html(
- view.messagePage({
- title: "not found",
- message: "No such repository, or you don't have access.",
- user: c.get("user"),
- }),
- 404,
- );
+ return fail(c, "not found", "No such repository, or you don't have access.", 404);
}
interface ViewableRepo {
@@ -745,7 +730,7 @@ async function ownedRef(c: Context<Env>): Promise<RepoRef | null> {
const user = c.get("user");
if (!user) return null;
const ref = refFromPath(c, "name");
- if (!ref || ref.owner !== view.ownerOf(user)) return null;
+ if (!ref || ref.owner !== sessionSlug(user)) return null;
return (await repoExists(ref)) ? ref : null;
}
@@ -780,25 +765,16 @@ app.post("/:owner/:name/delete", async (c) => {
const result = await trashRepo(ref, {
deletedAt: Math.floor(Date.now() / 1000),
- deletedBy: view.ownerOf(user),
+ deletedBy: sessionSlug(user),
grants: listCollaborators(ref).map((g) => ({
slug: g.slug,
level: g.level,
})),
});
- if (!result.ok) {
- return c.html(
- view.messagePage({
- title: "could not delete",
- message: result.error ?? "unknown error",
- user,
- }),
- 400,
- );
- }
+ if (!result.ok) return fail(c, "could not delete", result.error ?? "unknown error");
clearRepoMetadata(ref);
- notifyRepoDeleted(ref, view.ownerOf(user), wasPublic);
+ notifyRepoDeleted(ref, sessionSlug(user), wasPublic);
return c.redirect("/settings/deleted");
});
@@ -813,26 +789,15 @@ app.post("/:owner/:name/collaborators", async (c) => {
const invited = findUserBySlug(slug);
if (!invited) {
- return c.html(
- view.messagePage({
- title: "no such user",
- message:
- `Nobody on this instance goes by "${slug}". They have to sign in ` +
- `to this instance once before they can be added.`,
- user: c.get("user"),
- }),
- 400,
+ return fail(
+ c,
+ "no such user",
+ `Nobody on this instance goes by "${slug}". They have to sign in ` +
+ `to this instance once before they can be added.`,
);
}
if (invited.slug === ref.owner) {
- return c.html(
- view.messagePage({
- title: "already the owner",
- message: "You can't add yourself as a collaborator on your own repo.",
- user: c.get("user"),
- }),
- 400,
- );
+ return fail(c, "already the owner", "You can't add yourself as a collaborator on your own repo.");
}
setCollaborator(ref, invited.slug, level);
@@ -924,7 +889,7 @@ app.get("/:owner/:name", async (c) => {
const readmeFile = commits.length ? await readme(ref, rev) : null;
const user = c.get("user");
- const isOwner = user != null && view.ownerOf(user) === ref.owner;
+ const isOwner = user != null && sessionSlug(user) === ref.owner;
const canPush = access === "write";
const statuses = getStatuses(ref);
@@ -990,16 +955,12 @@ app.post("/:owner/:name/mirrors", async (c) => {
}
if (rejected.length > 0) {
- return c.html(
- view.messagePage({
- title: "that isn't a mirror URL",
- message:
- `The ${rejected.join(" and ")} link was refused. Give the repository as ` +
- `owner/repo — for example doughmination/dough-git — and it is looked up on ` +
- `${mirrorHost(rejected[0] as MirrorKind)}.`,
- user: c.get("user"),
- }),
- 400,
+ return fail(
+ c,
+ "that isn't a mirror URL",
+ `The ${rejected.join(" and ")} link was refused. Give the repository as ` +
+ `owner/repo — for example doughmination/dough-git — and it is looked up on ` +
+ `${mirrorHost(rejected[0] as MirrorKind)}.`,
);
}
diff --git a/src/settings.ts b/src/settings.ts
index fb173b7..a062d00 100644
--- a/src/settings.ts
+++ b/src/settings.ts
@@ -106,7 +106,3 @@ export function recordWebhookResult(owner: string, error: string | null): void {
`UPDATE user_settings SET webhook_error = ?, webhook_error_at = ? WHERE owner = ?`,
).run(error ? error.slice(0, 200) : null, error ? now() : null, owner);
}
-
-export function dropSettings(owner: string): void {
- db.prepare("DELETE FROM user_settings WHERE owner = ?").run(owner);
-}
diff --git a/src/styles/app.css.ts b/src/styles/app.css.ts
deleted file mode 100644
index 9a3ecc6..0000000
--- a/src/styles/app.css.ts
+++ /dev/null
@@ -1,583 +0,0 @@
-/* src/styles/app.ts
- * LICENCED DASL-1.0 (c) Clove Twilight
- */
-
-import { globalStyle, style } from "@vanilla-extract/css";
-import { vars } from "./theme.css";
-
-const readme = style({
- margin: "1rem 0",
- padding: "1rem 1.25rem",
- background: vars.surface,
- border: `1px solid ${vars.border}`,
- borderRadius: vars.radius,
- overflowWrap: "break-word",
-});
-
-export const classes = {
- readme,
-
- withIcon: style({
- display: "inline-flex",
- alignItems: "center",
- gap: "0.4rem",
- }),
-
- siteHeader: style({
- display: "grid",
- gridTemplateColumns: "1fr auto 1fr",
- alignItems: "center",
- gap: "1rem",
- padding: "0.75rem 1.25rem",
- borderBottom: `1px solid ${vars.border}`,
- background: vars.bgRaised,
- }),
-
- siteTitle: style({
- display: "flex",
- alignItems: "center",
- gap: "0.5rem",
- fontWeight: 700,
- fontSize: "1.1rem",
- color: vars.text,
- }),
-
- siteLogo: style({
- width: "1.5rem",
- height: "1.5rem",
- borderRadius: 0,
- objectFit: "cover",
- }),
-
- siteWho: style({
- display: "flex",
- justifyContent: "center",
- minWidth: 0,
- }),
-
- siteNav: style({
- display: "flex",
- alignItems: "center",
- justifyContent: "flex-end",
- gap: "0.75rem",
- }),
-
- navLink: style({
- display: "inline-flex",
- alignItems: "center",
- gap: "0.35rem",
- color: vars.accent,
- }),
-
- navForm: style({
- display: "inline",
- margin: 0,
- }),
-
- // A form button that looks exactly like the nav links beside it.
- navButton: style({
- padding: 0,
- border: 0,
- background: "none",
- font: "inherit",
- selectors: {
- "&:hover, &:active": {
- color: vars.accent,
- background: "none",
- textDecoration: "underline",
- },
- },
- }),
-
- user: style({
- display: "flex",
- alignItems: "center",
- gap: "0.4rem",
- minWidth: 0,
- color: vars.textMuted,
- whiteSpace: "nowrap",
- overflow: "hidden",
- textOverflow: "ellipsis",
- }),
-
- avatar: style({
- position: "relative",
- flexShrink: 0,
- display: "inline-flex",
- alignItems: "center",
- justifyContent: "center",
- borderRadius: 0,
- background: vars.surfaceHi,
- color: vars.textSoft,
- fontWeight: 600,
- lineHeight: 1,
- overflow: "hidden",
- userSelect: "none",
- }),
-
- avatarSm: style({
- width: "25px",
- minWidth: "25px",
- maxWidth: "25px",
- height: "25px",
- minHeight: "25px",
- maxHeight: "25px",
- fontSize: "13px",
- }),
-
- avatarLg: style({
- width: "60px",
- minWidth: "60px",
- maxWidth: "60px",
- height: "60px",
- minHeight: "60px",
- maxHeight: "60px",
- fontSize: "30px",
- }),
-
- avatarImg: style({
- position: "absolute",
- inset: 0,
- width: "100%",
- height: "100%",
- objectFit: "cover",
- }),
-
- profileHead: style({
- display: "flex",
- alignItems: "center",
- gap: "1rem",
- margin: "0.5rem 0 1.5rem",
- }),
-
- profileName: style({
- fontFamily: vars.display,
- color: vars.gilt,
- fontSize: "1.6rem",
- letterSpacing: "0.01em",
- margin: 0,
- }),
-
- ownerLink: style({ color: vars.textMuted }),
-
- content: style({
- maxWidth: "960px",
- margin: "0 auto",
- padding: "1.25rem",
- }),
-
- pageTitle: style({
- fontSize: "1.4rem",
- margin: "0.25rem 0 1rem",
- }),
-
- repoTitle: style({
- fontFamily: vars.display,
- color: vars.gilt,
- fontSize: "1.55rem",
- fontWeight: 500,
- letterSpacing: "0.01em",
- margin: "0.25rem 0 1rem",
- }),
-
- sectionTitle: style({
- fontSize: "1.05rem",
- margin: "1.5rem 0 0.5rem",
- color: vars.textSoft,
- }),
-
- repoList: style({}),
-
- repoRow: style({}),
-
- repoName: style({
- fontFamily: vars.display,
- color: vars.gilt,
- fontSize: "1.05em",
- fontWeight: 500,
- }),
-
- repoDesc: style({ color: vars.textMuted }),
-
- repoVis: style({
- fontFamily: vars.mono,
- fontSize: "0.85em",
- color: vars.textDim,
- }),
-
- repoIdle: style({
- fontFamily: vars.mono,
- fontSize: "0.85em",
- color: vars.textDim,
- whiteSpace: "nowrap",
- }),
-
- repoTabs: style({
- display: "flex",
- gap: "0.5rem",
- margin: "0.75rem 0",
- }),
-
- tab: style({
- display: "inline-flex",
- alignItems: "center",
- gap: "0.4rem",
- padding: "0.2rem 0.7rem",
- border: `1px solid ${vars.border}`,
- borderRadius: vars.radius,
- color: vars.textSoft,
- }),
-
- tabActive: style({
- background: vars.surfaceHi,
- color: vars.text,
- fontWeight: 600,
- }),
-
- cloneBox: style({
- margin: "1rem 0",
- padding: "0.6rem 0.9rem",
- background: vars.surface,
- border: `1px solid ${vars.border}`,
- borderRadius: vars.radius,
- }),
-
- cloneLabel: style({
- color: vars.textMuted,
- marginRight: "0.5rem",
- }),
-
- commitList: style({}),
-
- commitDate: style({
- fontFamily: vars.mono,
- fontSize: "0.85em",
- color: vars.textDim,
- whiteSpace: "nowrap",
- }),
-
- commitSubject: style({}),
-
- commitAuthor: style({ color: vars.textMuted }),
-
- commitHash: style({
- fontFamily: vars.mono,
- fontSize: "0.85em",
- color: vars.textDim,
- }),
-
- treeList: style({}),
-
- treeMode: style({
- fontFamily: vars.mono,
- fontSize: "0.85em",
- color: vars.textDim,
- }),
-
- treeName: style({}),
-
- treeSize: style({
- fontFamily: vars.mono,
- fontSize: "0.85em",
- color: vars.textDim,
- textAlign: "right",
- }),
-
- code: style({
- display: "block",
- padding: "0.75rem 1rem",
- background: vars.surface,
- border: `1px solid ${vars.border}`,
- borderRadius: vars.radius,
- fontSize: "0.85rem",
- color: vars.textSoft,
- }),
-
- commitMeta: style({
- display: "grid",
- gridTemplateColumns: "max-content 1fr",
- gap: "0.2rem 1rem",
- margin: "0.75rem 0",
- }),
-
- binaryNotice: style({ color: vars.textMuted }),
-
- message: style({ color: vars.textMuted }),
-
- badge: style({
- display: "inline-flex",
- alignItems: "center",
- gap: "0.25rem",
- padding: "0.05rem 0.4rem",
- marginLeft: "0.4rem",
- borderRadius: 0,
- border: `1px solid ${vars.border}`,
- background: vars.surfaceHi,
- fontFamily: vars.mono,
- fontSize: "0.75em",
- color: vars.textMuted,
- verticalAlign: "middle",
- }),
-
- formRow: style({
- display: "flex",
- flexWrap: "wrap",
- alignItems: "center",
- gap: "0.5rem",
- }),
-
- grow: style({
- flex: "1 1 12rem",
- minWidth: 0,
- }),
-
- revPicker: style({
- display: "flex",
- flexWrap: "wrap",
- alignItems: "center",
- gap: "0.5rem",
- margin: "0.75rem 0",
- }),
-
- empty: style({ color: vars.textDim }),
-
- statusGood: style({ color: vars.success }),
- statusWarn: style({ color: vars.accent }),
- statusBad: style({ color: vars.danger }),
- statusMuted: style({ color: vars.textDim }),
-
- mirrorRow: style({
- display: "grid",
- gridTemplateColumns: "minmax(5rem, auto) minmax(9rem, auto) auto 1fr",
- gap: "0.5rem 1rem",
- alignItems: "baseline",
- padding: "0.3rem 0",
- "@media": {
- "screen and (max-width: 40rem)": {
- gridTemplateColumns: "1fr",
- gap: "0.1rem",
- paddingBottom: "0.6rem",
- },
- },
- }),
-
- mirrorKind: style({ color: vars.textSoft, fontWeight: 600 }),
-
- siteFooter: style({
- color: vars.textDim,
- textAlign: "center",
- padding: "2rem 0",
- fontSize: "0.85em",
- }),
-} as const;
-
-globalStyle(`${readme} > :first-child`, { marginTop: 0 });
-globalStyle(`${readme} > :last-child`, { marginBottom: 0 });
-
-globalStyle(
- `${readme} h1, ${readme} h2, ${readme} h3, ${readme} h4, ${readme} h5, ${readme} h6`,
- {
- fontFamily: vars.display,
- fontWeight: 600,
- lineHeight: 1.25,
- letterSpacing: "0.01em",
- margin: "1.5rem 0 0.75rem",
- },
-);
-
-globalStyle(`${readme} h1`, { fontSize: "1.5rem" });
-globalStyle(`${readme} h2`, { fontSize: "1.25rem" });
-globalStyle(`${readme} h3`, { fontSize: "1.05rem" });
-globalStyle(`${readme} h4, ${readme} h5, ${readme} h6`, {
- fontSize: "0.95rem",
- color: vars.textSoft,
-});
-
-globalStyle(`${readme} h1, ${readme} h2`, {
- paddingBottom: "0.3rem",
- borderBottom: `1px solid ${vars.border}`,
-});
-
-globalStyle(`${readme} p`, { margin: "0.75rem 0" });
-
-globalStyle(`${readme} code`, {
- background: vars.surfaceHi,
- padding: "0.12em 0.35em",
- borderRadius: 0,
- fontSize: "0.9em",
-});
-
-globalStyle(`${readme} pre`, {
- margin: "0.75rem 0",
- padding: "0.75rem 1rem",
- background: vars.bgDeep,
- border: `1px solid ${vars.border}`,
- borderRadius: vars.radius,
- overflowX: "auto",
-});
-
-globalStyle(`${readme} pre code`, {
- background: "none",
- padding: 0,
- borderRadius: 0,
- fontSize: "0.85rem",
- color: vars.textSoft,
-});
-
-globalStyle(`${readme} blockquote`, {
- margin: "0.75rem 0",
- padding: "0.1rem 0 0.1rem 1rem",
- borderLeft: `3px solid ${vars.border}`,
- color: vars.textMuted,
-});
-
-const alertColor = {
- note: "#47b6ee",
- tip: "#96d94f",
- important: "#b58fe0",
- warning: "#f2b23c",
- caution: "#ef6144",
- frozen: "#b8dfe8",
- aside: "#74c2a8",
-};
-
-const prideFlag: Record<string, string[]> = {
- gay: ["#13a888", "#26ceaa", "#98e8c1", "#7bade2", "#918cdf"],
- lesbian: ["#ec7151", "#e8782e", "#ee9d67", "#f2f7fb", "#d675af", "#ee63b5"],
- bisexual: ["#ee64ab", "#bf80ba", "#6894ee"],
- transgender: ["#67c9ee", "#f5a9b8", "#f2f7fb", "#f5a9b8", "#67c9ee"],
- pansexual: ["#ee65a7", "#e6c619", "#37aae9"],
- asexual: ["#8fa4bc", "#c3d3e2", "#f2f7fb", "#ec54ec"],
- aromantic: ["#3fab44", "#a7d379", "#f2f7fb", "#c3d3e2", "#8fa4bc"],
- nonbinary: ["#eae446", "#f2f7fb", "#b480dc", "#8fa4bc"],
- queer: ["#ef6d6d", "#e68a19", "#e6d719", "#13ac41", "#7994dd", "#c578d5"],
-};
-
-globalStyle(`${readme} .md-alert`, {
- margin: "0.75rem 0",
- padding: "0.5rem 1rem",
- borderLeft: `3px solid ${vars.border}`,
- borderRadius: vars.radius,
- color: vars.textSoft,
-});
-
-globalStyle(`${readme} .md-alert > :first-child`, { marginTop: 0 });
-
-globalStyle(`${readme} .md-alert > :last-child`, { marginBottom: 0 });
-
-globalStyle(`${readme} .md-alert-title`, {
- display: "flex",
- alignItems: "center",
- gap: "0.4rem",
- margin: "0 0 0.5rem",
- fontWeight: 600,
-});
-
-for (const [kind, color] of Object.entries(alertColor)) {
- globalStyle(`${readme} .md-alert-${kind}`, {
- borderLeftColor: color,
- });
-
- globalStyle(`${readme} .md-alert-${kind} .md-alert-title`, {
- color,
- });
-}
-
-globalStyle(`${readme} .md-alert-frozen`, {
- background: "rgba(184, 223, 232, 0.05)",
-});
-
-globalStyle(`${readme} .md-alert-aside`, {
- borderLeftWidth: "2px",
- color: vars.textMuted,
-});
-
-globalStyle(`${readme} .md-alert-aside .md-alert-title`, {
- fontWeight: 400,
-});
-
-globalStyle(`${readme} .md-pride`, {
- fontWeight: 600,
- color: vars.text,
- "@supports": {
- "(-webkit-background-clip: text) or (background-clip: text)": {
- WebkitBackgroundClip: "text",
- backgroundClip: "text",
- color: "transparent",
- backgroundSize: "100% 100%",
- },
- },
- "@media": {
- "(prefers-contrast: more)": {
- backgroundImage: "none",
- color: vars.text,
- WebkitTextFillColor: vars.text,
- },
- },
-});
-
-globalStyle(`${readme} .md-pride a`, {
- color: "inherit",
- textDecoration: "underline",
-});
-
-globalStyle(`${readme} .md-pride code`, {
- WebkitTextFillColor: vars.textSoft,
- color: vars.textSoft,
-});
-
-for (const [flag, stops] of Object.entries(prideFlag)) {
- globalStyle(`${readme} .md-pride-${flag}`, {
- backgroundImage: `linear-gradient(96deg, ${stops.join(", ")})`,
- });
-}
-
-globalStyle(`${readme} ul, ${readme} ol`, {
- margin: "0.75rem 0",
- paddingLeft: "1.5rem",
-});
-
-globalStyle(`${readme} li`, { margin: "0.25rem 0" });
-
-globalStyle(`${readme} li > input[type="checkbox"]`, {
- marginRight: "0.35rem",
-});
-
-globalStyle(`${readme} hr`, {
- border: 0,
- borderTop: `1px solid ${vars.border}`,
- margin: "1.5rem 0",
-});
-
-globalStyle(`${readme} img`, {
- maxWidth: "100%",
- verticalAlign: "middle",
-});
-
-globalStyle(`${readme} table`, {
- display: "block",
- width: "max-content",
- maxWidth: "100%",
- overflowX: "auto",
- margin: "0.75rem 0",
-});
-
-globalStyle(`${readme} th[data-align="center"], ${readme} td[data-align="center"]`, {
- textAlign: "center",
-});
-
-globalStyle(`${readme} th[data-align="right"], ${readme} td[data-align="right"]`, {
- textAlign: "right",
-});
-
-globalStyle(`${readme} del`, { color: vars.textDim });
-
-globalStyle(".icon", {
- display: "inline-block",
- verticalAlign: "middle",
- flexShrink: 0,
- fill: "currentColor",
- shapeRendering: "crispEdges",
-});
-
-export type Classes = typeof classes;
diff --git a/src/styles/fonts.css.ts b/src/styles/fonts.css.ts
deleted file mode 100644
index bc2d75a..0000000
--- a/src/styles/fonts.css.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-/* src/styles/fonts.css.ts
- * LICENCED DASL-1.0 (c) Clove Twilight
- */
-
-// Styling matches auth-server: system UI fonts only, no custom webfonts.
-export const FONT_ORIGIN = "https://m.doughmination.gay";
diff --git a/src/styles/global.css.ts b/src/styles/global.css.ts
deleted file mode 100644
index eb1a3b4..0000000
--- a/src/styles/global.css.ts
+++ /dev/null
@@ -1,140 +0,0 @@
-/* src/styles/global.css.ts
- * LICENCED DASL-1.0 (c) Clove Twilight
- */
-
-import { globalStyle } from "@vanilla-extract/css";
-import { vars } from "./theme.css";
-
-const CURSORS = "https://m.doughmination.gay/cursors/sandrone";
-const cursor = (file: string, hotspot: string, fallback: string) =>
- `url('${CURSORS}/${file}.png') ${hotspot}, ${fallback}`;
-
-globalStyle("*", { boxSizing: "border-box" });
-
-globalStyle("html", {
- background: `linear-gradient(135deg, ${vars.bg} 0%, ${vars.bgRaised} 60%, ${vars.bgDeep} 100%)`,
- minHeight: "100%",
-});
-
-globalStyle("body", {
- margin: 0,
- minHeight: "100vh",
- fontFamily: vars.font,
- fontSize: "15px",
- lineHeight: 1.5,
- color: vars.text,
- cursor: cursor("Normal", "0 0", "default"),
-});
-
-globalStyle("a", {
- color: vars.accent,
- textDecoration: "none",
-});
-
-globalStyle("a:hover", { textDecoration: "underline" });
-
-globalStyle("a, button", {
- cursor: cursor("Link", "4 0", "pointer"),
-});
-
-globalStyle("h1, h2, h3", {
- fontWeight: 600,
- lineHeight: 1.25,
-});
-
-globalStyle("table", {
- width: "100%",
- borderCollapse: "collapse",
-});
-
-globalStyle("th, td", {
- textAlign: "left",
- padding: "0.4rem 0.6rem",
- borderBottom: `1px solid ${vars.border}`,
- verticalAlign: "top",
-});
-
-globalStyle("th", {
- color: vars.textMuted,
- fontWeight: 600,
- fontSize: "0.85em",
-});
-
-globalStyle("code, pre", { fontFamily: vars.mono });
-
-globalStyle("pre", {
- margin: 0,
- overflowX: "auto",
-});
-
-const FIELDS = [
- 'input[type="text"]',
- 'input[type="url"]',
- 'input[type="email"]',
- 'input[type="password"]',
- 'input[type="search"]',
- 'input[type="number"]',
- "select",
- "textarea",
-];
-
-const CONTROLS = ["button", ...FIELDS];
-
-const sel = (sels: string[], suffix = "") =>
- sels.map((s) => s + suffix).join(", ");
-
-globalStyle(sel(CONTROLS), {
- fontFamily: "inherit",
- fontSize: "inherit",
- lineHeight: 1.5,
- padding: "0.2rem 0.7rem",
- border: `1px solid ${vars.border}`,
- borderRadius: vars.radius,
-});
-
-globalStyle("button", {
- display: "inline-flex",
- alignItems: "center",
- gap: "0.35rem",
- background: vars.surfaceHi,
- color: vars.textSoft,
-});
-
-globalStyle("button:hover", {
- borderColor: vars.accent,
- color: vars.text,
-});
-
-globalStyle("button:active", { background: vars.surface });
-
-globalStyle(sel(FIELDS), {
- background: vars.bgDeep,
- color: vars.text,
- minWidth: 0,
- cursor: cursor("Text", "4 9", "text"),
-});
-
-globalStyle(sel(FIELDS, "::placeholder"), { color: vars.textFaint });
-
-globalStyle(sel(FIELDS, ":hover"), { borderColor: vars.textFaint });
-
-globalStyle(sel(CONTROLS, ":focus-visible"), {
- outline: `1px solid ${vars.accent}`,
- outlineOffset: "1px",
- borderColor: vars.accent,
-});
-
-globalStyle(sel(CONTROLS, ":disabled"), {
- opacity: 0.5,
- cursor: cursor("Unavailable", "0 0", "not-allowed"),
-});
-
-globalStyle('input[type="checkbox"]', {
- accentColor: vars.accent,
- verticalAlign: "-0.1em",
- margin: "0 0.35rem 0 0",
-});
-
-globalStyle('label:has(input[type="checkbox"])', {
- cursor: cursor("Link", "4 0", "pointer"),
-});
diff --git a/src/styles/index.ts b/src/styles/index.ts
deleted file mode 100644
index 8df3035..0000000
--- a/src/styles/index.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/* src/styles/index.ts
- * LICENCED DASL-1.0 (c) Clove Twilight
- */
-
-import "./fonts.css.ts";
-import "./theme.css.ts";
-import "./global.css.ts";
-
-export { FONT_ORIGIN } from "./fonts.css.ts";
-export { classes } from "./app.css.ts";
-export type { Classes } from "./app.css.ts";
diff --git a/src/styles/theme.css.ts b/src/styles/theme.css.ts
deleted file mode 100644
index 0445397..0000000
--- a/src/styles/theme.css.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-/* src/styles/theme.css.ts
- * LICENCED DASL-1.0 (c) Clove Twilight
- */
-
-import {
- createGlobalTheme,
- createGlobalThemeContract,
- globalStyle,
-} from "@vanilla-extract/css";
-
-export const vars = createGlobalThemeContract({
- accent: "accent",
- accentAlt: "accent-alt",
- gilt: "gilt",
- danger: "danger",
- success: "success",
-
- bgDeep: "bg-deep",
- bgRaised: "bg-raised",
- bg: "bg",
- surface: "surface",
- surfaceHi: "surface-hi",
- border: "border",
-
- textFaint: "text-faint",
- textDim: "text-dim",
- textMuted: "text-muted",
- textSoft: "text-soft",
- text: "text",
-
- font: "font",
- display: "display",
- mono: "mono",
- radius: "radius",
-});
-
-createGlobalTheme(":root", vars, {
- accent: "#c22a44",
- accentAlt: "#9c1f34",
- gilt: "#d8b775",
- danger: "#ff4d5e",
- success: "#5f9e78",
-
- bgDeep: "#030207",
- bgRaised: "#100a10",
- bg: "#07050a",
- surface: "#1a1016",
- surfaceHi: "#241318",
- border: "#34141c",
-
- textFaint: "#6b4a53",
- textDim: "#82616a",
- textMuted: "#9c848c",
- textSoft: "#c7b6ba",
- text: "#ece3e6",
-
- font: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
- display: "Georgia, 'Iowan Old Style', 'Palatino Linotype', serif",
- mono: "ui-monospace, 'Cascadia Code', Menlo, monospace",
- radius: "8px",
-});
-
-globalStyle(":root", { colorScheme: "dark" });
diff --git a/src/users.ts b/src/users.ts
index 8495a2a..f8cf42f 100644
--- a/src/users.ts
+++ b/src/users.ts
@@ -46,12 +46,6 @@ export function findUserBySub(sub: string): UserRow | null {
.get(sub) as unknown as UserRow) ?? null;
}
-export function listUsers(): UserRow[] {
- return db
- .prepare("SELECT * FROM users ORDER BY slug")
- .all() as unknown as UserRow[];
-}
-
function uniqueSlug(preferred: string, sub: string): string {
const taken = (slug: string) => {
const row = findUserBySlug(slug);
diff --git a/src/views.ts b/src/views.ts
index 521f5f1..6aa9e24 100644
--- a/src/views.ts
+++ b/src/views.ts
@@ -3,12 +3,10 @@
*/
import { config } from "./config.ts";
-import { classes as c } from "./styles/index.ts";
import { icon } from "./icons.ts";
-import { escapeHtml, renderMarkdown, plainSummary } from "./markdown.ts";
-import { accountUrl, sessionSlug } from "./auth.ts";
+import { escapeHtml as esc, renderMarkdown, plainSummary } from "./markdown.ts";
+import { accountUrl, sessionSlug, type SessionUser } from "./auth.ts";
import { maskWebhook, mirrorHost, mirrorSlug, MIRROR_KINDS, type MirrorKind } from "./urls.ts";
-import type { SessionUser } from "./auth.ts";
import type { CollaboratorRow } from "./access.ts";
import type { TokenRow } from "./tokens.ts";
import type { UserRow } from "./users.ts";
@@ -26,8 +24,6 @@ import type {
} from "./git.ts";
import type { MirrorStatus } from "./mirror.ts";
-export const esc = escapeHtml;
-
function fmtDate(unix: number | null): string {
if (!unix) return "";
return new Date(unix * 1000).toISOString().slice(0, 16).replace("T", " ");
@@ -45,18 +41,27 @@ function revQuery(rev: string, head: string): string {
return rev === head ? "" : `?h=${encodeURIComponent(rev)}`;
}
+function visibility(isPublic: boolean): string {
+ return `<span class="with-icon">${icon(isPublic ? "lock-open" : "lock", 13)}${isPublic ? "public" : "private"}</span>`;
+}
+
+// [id, label, icon, href] rows rendered as a tab strip
+function tabs(active: string, items: [string, string, string, string][]): string {
+ const links = items.map(
+ ([id, label, glyph, href]) =>
+ `<a class="tab${id === active ? " active" : ""}" href="${href}">${icon(glyph)}${label}</a>`,
+ );
+ return ` <nav class="tabs">${links.join("")}</nav>`;
+}
+
function revPicker(refs: RefList, rev: string): string {
const all = [...refs.branches, ...refs.tags];
- if (all.length < 2 && all.includes(rev)) return "";
- if (all.length === 0) return "";
+ if (all.length === 0 || (all.length < 2 && all.includes(rev))) return "";
const options = (names: string[], label: string): string => {
if (names.length === 0) return "";
const items = names
- .map(
- (name) =>
- `<option value="${esc(name)}"${name === rev ? " selected" : ""}>${esc(name)}</option>`,
- )
+ .map((name) => `<option value="${esc(name)}"${name === rev ? " selected" : ""}>${esc(name)}</option>`)
.join("");
return `<optgroup label="${label}">${items}</optgroup>`;
};
@@ -65,8 +70,8 @@ function revPicker(refs: RefList, rev: string): string {
? ""
: `<option value="${esc(rev)}" selected>${esc(rev.slice(0, 10))}</option>`;
- return `<form method="get" class="${c.revPicker}">
- <label class="${c.cloneLabel} ${c.withIcon}" for="rev-picker">${icon("git-branch")}revision</label>
+ return `<form method="get" class="row rev-picker">
+ <label class="label with-icon" for="rev-picker">${icon("git-branch")}revision</label>
<select id="rev-picker" name="h" data-autosubmit>
${detached}${options(refs.branches, "branches")}${options(refs.tags, "tags")}
</select>
@@ -87,17 +92,14 @@ interface Profile {
picture: string | null;
}
-export function displayName(p: Profile & { sub?: string }): string {
+function displayName(p: Profile & { sub?: string }): string {
return p.name ?? p.username ?? p.sub ?? "user";
}
function avatar(p: Profile, size: "sm" | "lg"): string {
const initial = esc(displayName(p).trim().slice(0, 1).toUpperCase() || "?");
- const box = size === "lg" ? c.avatarLg : c.avatarSm;
- const img = p.picture
- ? `<img class="${c.avatarImg}" src="${esc(p.picture)}" alt="" loading="lazy" data-avatar>`
- : "";
- return `<span class="${c.avatar} ${box}">${initial}${img}</span>`;
+ const img = p.picture ? `<img src="${esc(p.picture)}" alt="" loading="lazy" data-avatar>` : "";
+ return `<span class="avatar avatar-${size}">${initial}${img}</span>`;
}
function layout(opts: {
@@ -109,20 +111,21 @@ function layout(opts: {
noindex?: boolean;
}): string {
const whoami = opts.user
- ? `<a class="${c.user}" href="/${esc(ownerOf(opts.user))}">${avatar(opts.user, "sm")}${esc(displayName(opts.user))}</a>`
+ ? `<a class="user" href="/${esc(sessionSlug(opts.user))}">${avatar(opts.user, "sm")}${esc(displayName(opts.user))}</a>`
: "";
- const settings = opts.user
- ? `<a class="${c.navLink}" href="/settings">${icon("gear")}settings</a>
- <form method="post" action="/auth/logout" class="${c.navForm}">
- <button type="submit" class="${c.navLink} ${c.navButton}">${icon("sign-out")}logout</button>
+ const nav = opts.user
+ ? `<a class="nav-link" href="/new">${icon("plus")}new</a>
+ <a class="nav-link" href="/settings">${icon("gear")}settings</a>
+ <form method="post" action="/auth/logout" class="nav-form">
+ <button type="submit" class="nav-link nav-button">${icon("sign-out")}logout</button>
</form>`
- : `<a class="${c.navLink}" href="/auth/login">${icon("sign-in")}login</a>`;
+ : `<a class="nav-link" href="/auth/login">${icon("sign-in")}login</a>`;
const description = metaText(opts.description || config.description);
- const url = opts.path ? esc(config.baseUrl + opts.path) : esc(config.baseUrl);
+ const url = esc(config.baseUrl + (opts.path ?? ""));
const faviconUrl = esc(config.favicon);
const logo = config.favicon
- ? `<img class="${c.siteLogo}" src="${faviconUrl}" alt="" width="24" height="24">`
+ ? `<img class="site-logo" src="${faviconUrl}" alt="" width="24" height="24">`
: icon("git-branch", 20);
return `<!doctype html>
@@ -142,30 +145,41 @@ function layout(opts: {
<meta property="og:url" content="${url}">
<meta property="og:image" content="${faviconUrl}">
<meta name="twitter:card" content="summary">
- <meta name="twitter:title" content="${esc(opts.title)}">
- <meta name="twitter:description" content="${description}">
- <meta name="twitter:image" content="${faviconUrl}">
<link rel="icon" href="${faviconUrl}">
<link rel="apple-touch-icon" href="${faviconUrl}">
<link rel="stylesheet" href="/static/style.css">
<script src="/static/app.js" defer></script>
</head>
<body>
- <header class="${c.siteHeader}">
- <a class="${c.siteTitle}" href="/">${logo}${esc(config.title)}</a>
- <div class="${c.siteWho}">${whoami}</div>
- <nav class="${c.siteNav}">${settings}</nav>
+ <header class="site-header">
+ <a class="site-title" href="/">${logo}${esc(config.title)}</a>
+ <div class="site-who">${whoami}</div>
+ <nav class="site-nav">${nav}</nav>
</header>
- <main class="${c.content}">
+ <main class="content">
${opts.body}
</main>
- <footer class="${c.siteFooter}">
- <span class="${c.withIcon}">${icon("git-merge")}dough-git · a minimal git mirror</span>
+ <footer class="site-footer">
+ <span class="with-icon">${icon("git-merge")}dough-git · a minimal git mirror</span>
</footer>
</body>
</html>`;
}
+// A table with a header row, or one full-width "empty" cell
+function table(headers: string[], rows: string[], empty: string): string {
+ const head = headers.length
+ ? `<thead><tr>${headers.map((h) => `<th>${h}</th>`).join("")}</tr></thead>`
+ : "";
+ const span = Math.max(1, headers.length);
+ const body = rows.join("\n") || `<tr><td colspan="${span}" class="empty">${esc(empty)}</td></tr>`;
+ return `<table>${head}
+ <tbody>
+${body}
+ </tbody>
+ </table>`;
+}
+
function repoTable(
repos: RepoSummary[],
opts: {
@@ -174,55 +188,76 @@ function repoTable(
sharedSlugs?: Set<string> | null;
},
): string {
- const rows = repos
- .map((r) => {
- const owner = opts.showOwner
- ? `<a class="${c.ownerLink}" href="/${esc(r.owner)}">${esc(r.owner)}</a>/`
- : "";
- const shared = opts.sharedSlugs?.has(`${r.owner}/${r.name}`)
- ? `<span class="${c.badge}">${icon("users", 11)}shared</span>`
- : "";
- return ` <tr class="${c.repoRow}">
- <td class="${c.repoName}">${icon("git-branch")} ${owner}<a href="${base(r.owner, r.name)}/">${esc(r.name)}</a>${shared}</td>
- <td class="${c.repoDesc}">${esc(r.description)}</td>
- <td class="${c.repoVis}"><span class="${c.withIcon}">${icon(r.isPublic ? "lock-open" : "lock", 13)}${r.isPublic ? "public" : "private"}</span></td>
- <td class="${c.repoIdle}">${fmtDate(r.lastCommit)}</td>
+ const rows = repos.map((r) => {
+ const owner = opts.showOwner
+ ? `<a class="muted" href="/${esc(r.owner)}">${esc(r.owner)}</a>/`
+ : "";
+ const shared = opts.sharedSlugs?.has(`${r.owner}/${r.name}`)
+ ? `<span class="badge">${icon("users", 11)}shared</span>`
+ : "";
+ return ` <tr>
+ <td class="repo-name">${icon("git-branch")} ${owner}<a href="${base(r.owner, r.name)}/">${esc(r.name)}</a>${shared}</td>
+ <td class="muted">${esc(r.description)}</td>
+ <td class="mono">${visibility(r.isPublic)}</td>
+ <td class="mono">${fmtDate(r.lastCommit)}</td>
</tr>`;
- })
- .join("\n");
-
- return `<table class="${c.repoList}">
- <thead>
- <tr><th>repository</th><th>description</th><th>visibility</th><th>updated</th></tr>
- </thead>
- <tbody>
-${rows || ` <tr><td colspan="4" class="${c.empty}">${esc(opts.empty)}</td></tr>`}
- </tbody>
- </table>`;
+ });
+ return table(["repository", "description", "visibility", "updated"], rows, opts.empty);
}
export function repoListPage(
repos: RepoSummary[],
user: SessionUser | null,
- opts: { sharedSlugs?: Set<string> | null } = {},
+ sharedSlugs: Set<string> | null,
): string {
- const createForm = user
- ? ` <form method="post" action="/new" class="${c.cloneBox} ${c.formRow}">
- <label class="${c.cloneLabel} ${c.withIcon}">${icon("folder-plus")}new repo</label>
- <span class="${c.repoVis}">${esc(ownerOf(user))}/</span>
- <input type="text" name="name" placeholder="my-project" pattern="[A-Za-z0-9._-]+" required>
- <button type="submit">${icon("plus")}create</button>
- </form>`
- : "";
-
- const body = ` <h1 class="${c.pageTitle}">repositories</h1>
-${createForm}
+ const body = ` <h1 class="page-title">repositories</h1>
${repoTable(repos, {
showOwner: true,
empty: "no repositories visible",
- sharedSlugs: opts.sharedSlugs,
+ sharedSlugs,
})}`;
- return layout({ title: config.title, user, body, path: "/" });
+ return layout({
+ title: config.title,
+ user,
+ body,
+ path: "/",
+ });
+}
+
+export function newRepoPage(user: SessionUser): string {
+ const owner = esc(sessionSlug(user));
+ const body = ` <h1 class="page-title">new repository</h1>
+
+ <h2 class="section-title">${icon("folder-plus")}empty repository</h2>
+ <form method="post" action="/new" class="box row">
+ <span class="mono">${owner}/</span>
+ <input class="grow" type="text" name="name" placeholder="my-project" pattern="[A-Za-z0-9._-]+" required>
+ <button type="submit">${icon("plus")}create</button>
+ </form>
+
+ <h2 class="section-title">${icon("download")}import from another forge</h2>
+ <p class="muted">Copies every branch and tag from a public repository on GitHub, Codeberg,
+ GitLab, or any other forge. The import is a one-off copy, not a live mirror.</p>
+ <form method="post" action="/new/import" class="box">
+ <p class="row">
+ <label class="label with-icon" for="import-url">${icon("link")}clone url</label>
+ <input id="import-url" class="grow" type="url" name="url" required
+ placeholder="https://codeberg.org/owner/repo.git" autocapitalize="off" spellcheck="false">
+ </p>
+ <p class="row">
+ <label class="label with-icon" for="import-name">${icon("tag")}name</label>
+ <span class="mono">${owner}/</span>
+ <input id="import-name" class="grow" type="text" name="name" pattern="[A-Za-z0-9._-]+"
+ placeholder="leave blank to use the source name">
+ </p>
+ <button type="submit">${icon("download")}import</button>
+ </form>`;
+ return layout({
+ title: "new repository",
+ user,
+ body,
+ noindex: true,
+ });
}
const PROFILE_PREVIEW = 6;
@@ -233,30 +268,32 @@ function ownerName(owner: string, profile: UserRow | null): string {
function ownerHead(owner: string, profile: UserRow | null): string {
const handle =
- profile?.username && profile.username !== profile.slug
- ? profile.username
- : null;
+ profile?.username && profile.username !== profile.slug ? profile.username : null;
const known = profile
- ? `<p class="${c.repoDesc}">@${esc(profile.slug)}${handle ? ` · ${esc(handle)}` : ""} · joined ${fmtDate(profile.created_at).slice(0, 10)}</p>`
- : `<p class="${c.repoDesc}">@${esc(owner)} · no account on this instance</p>`;
+ ? `<p class="muted">@${esc(profile.slug)}${handle ? ` · ${esc(handle)}` : ""} · joined ${fmtDate(profile.created_at).slice(0, 10)}</p>`
+ : `<p class="muted">@${esc(owner)} · no account on this instance</p>`;
- return ` <section class="${c.profileHead}">
- ${avatar(profile ?? { name: owner, username: null, picture: null }, "lg")}
+ const fallback = {
+ name: owner,
+ username: null,
+ picture: null,
+ };
+
+ return ` <section class="profile-head">
+ ${avatar(profile ?? fallback, "lg")}
<div>
- <h1 class="${c.profileName}">${esc(ownerName(owner, profile))}</h1>
+ <h1 class="profile-name">${esc(ownerName(owner, profile))}</h1>
${known}
</div>
</section>`;
}
function ownerTabs(owner: string, active: "profile" | "repos"): string {
- const tab = (id: string, label: string, glyph: string, href: string) =>
- `<a class="${c.tab}${id === active ? " " + c.tabActive : ""}" href="${href}">${icon(glyph)}${label}</a>`;
- return ` <nav class="${c.repoTabs}">
- ${tab("profile", "profile", "user", `/${esc(owner)}`)}
- ${tab("repos", "repositories", "git-branch", `/${esc(owner)}/${PROFILE_REPOS_PATH}`)}
- </nav>`;
+ return tabs(active, [
+ ["profile", "profile", "user", `/${esc(owner)}`],
+ ["repos", "repositories", "git-branch", `/${esc(owner)}/${PROFILE_REPOS_PATH}`],
+ ]);
}
export function profilePage(opts: {
@@ -270,34 +307,36 @@ export function profilePage(opts: {
}): string {
const name = ownerName(opts.owner, opts.profile);
const preview = opts.repos.slice(0, PROFILE_PREVIEW);
- const more = opts.repos.length - preview.length;
const profileHref = `/${esc(opts.owner)}/${esc(PROFILE_REPO)}/`;
- const readmeSection = opts.readme
- ? ` <article class="${c.readme}">
+ let readmeSection = "";
+ if (opts.readme) {
+ readmeSection = ` <article class="readme">
${renderMarkdown(opts.readme.text)}
- </article>
-${opts.isOwn ? ` <p class="${c.repoDesc}"><a href="${profileHref}">${esc(PROFILE_REPO)}/${esc(opts.readme.path)}</a></p>` : ""}`
- : !opts.isOwn
- ? ""
- : opts.hasProfileRepo
- ? ` <p class="${c.cloneBox} ${c.repoDesc}">${icon("file")} <a href="${profileHref}">${esc(PROFILE_REPO)}</a> has no <code>README.md</code> yet. Push one and it shows up here.</p>`
- : ` <form method="post" action="/new" class="${c.cloneBox} ${c.formRow}">
+ </article>`;
+ if (opts.isOwn) {
+ readmeSection += `\n <p class="muted"><a href="${profileHref}">${esc(PROFILE_REPO)}/${esc(opts.readme.path)}</a></p>`;
+ }
+ } else if (opts.isOwn && opts.hasProfileRepo) {
+ readmeSection = ` <p class="box muted">${icon("file")} <a href="${profileHref}">${esc(PROFILE_REPO)}</a> has no <code>README.md</code> yet. Push one and it shows up here.</p>`;
+ } else if (opts.isOwn) {
+ readmeSection = ` <form method="post" action="/new" class="box row">
<input type="hidden" name="name" value="${esc(PROFILE_REPO)}">
- <label class="${c.cloneLabel} ${c.withIcon}">${icon("file")}profile readme</label>
- <span class="${c.repoDesc}">Create <code>${esc(PROFILE_REPO)}</code> and its README.md shows up here.</span>
+ <label class="label with-icon">${icon("file")}profile readme</label>
+ <span class="muted">Create <code>${esc(PROFILE_REPO)}</code> and its README.md shows up here.</span>
<button type="submit">${icon("plus")}create</button>
</form>`;
+ }
const moreLink =
- more > 0
- ? ` <p class="${c.repoDesc}"><a href="/${esc(opts.owner)}/${PROFILE_REPOS_PATH}">all ${opts.repos.length} repositories →</a></p>`
+ opts.repos.length > preview.length
+ ? ` <p class="muted"><a href="/${esc(opts.owner)}/${PROFILE_REPOS_PATH}">all ${opts.repos.length} repositories →</a></p>`
: "";
const body = `${ownerHead(opts.owner, opts.profile)}
${ownerTabs(opts.owner, "profile")}
${readmeSection}
- <h2 class="${c.sectionTitle}">repositories</h2>
+ <h2 class="section-title">repositories</h2>
${repoTable(preview, { showOwner: false, empty: "nothing here yet" })}
${moreLink}`;
@@ -323,7 +362,7 @@ export function reposPage(opts: {
const body = `${ownerHead(opts.owner, opts.profile)}
${ownerTabs(opts.owner, "repos")}
- <h2 class="${c.sectionTitle}">repositories</h2>
+ <h2 class="section-title">repositories</h2>
${repoTable(opts.repos, { showOwner: false, empty: "nothing here yet" })}`;
return layout({
@@ -336,48 +375,13 @@ ${ownerTabs(opts.owner, "repos")}
});
}
-export function ownerOf(user: SessionUser): string {
- return sessionSlug(user);
-}
-
-function repoNav(
- owner: string,
- name: string,
- active: string,
- q: string,
-): string {
- const b = base(owner, name);
- const tab = (id: string, label: string, glyph: string, href: string) =>
- `<a class="${c.tab}${id === active ? " " + c.tabActive : ""}" href="${href}">${icon(glyph)}${label}</a>`;
- return ` <nav class="${c.repoTabs}">
- ${tab("summary", "summary", "article", `${b}/${q}`)}
- ${tab("log", "log", "git-commit", `${b}/log${q}`)}
- ${tab("tree", "tree", "folder", `${b}/tree${q}`)}
- </nav>`;
-}
-
-function commitTable(
- owner: string,
- name: string,
- commits: Commit[],
- q: string,
-): string {
+function repoNav(owner: string, name: string, active: string, q: string): string {
const b = base(owner, name);
- const rows = commits
- .map(
- (cm) => ` <tr>
- <td class="${c.commitDate}">${fmtDate(cm.time)}</td>
- <td class="${c.commitSubject}">${icon("git-commit", 13)} <a href="${b}/commit/${esc(cm.hash)}${q}">${esc(cm.subject)}</a></td>
- <td class="${c.commitAuthor}">${esc(cm.author)}</td>
- <td class="${c.commitHash}">${esc(cm.hash.slice(0, 10))}</td>
- </tr>`,
- )
- .join("\n");
- return `<table class="${c.commitList}">
- <tbody>
-${rows || ` <tr><td class="${c.empty}">no commits</td></tr>`}
- </tbody>
- </table>`;
+ return tabs(active, [
+ ["summary", "summary", "article", `${b}/${q}`],
+ ["log", "log", "git-commit", `${b}/log${q}`],
+ ["tree", "tree", "folder", `${b}/tree${q}`],
+ ]);
}
export function summaryPage(opts: {
@@ -398,79 +402,76 @@ export function summaryPage(opts: {
localSha: string | null;
}): string {
const title = `${opts.owner}/${opts.name}`;
- const empty = opts.empty;
+ const b = base(opts.owner, opts.name);
const q = revQuery(opts.rev, opts.refs.head);
- const pusher = opts.user ? ownerOf(opts.user) : opts.owner;
- const pushHint =
- empty && opts.canPush
- ? ` <section class="${c.cloneBox}">
+ const pusher = opts.user ? sessionSlug(opts.user) : opts.owner;
+ const isOwner = opts.collaborators !== null;
+
+ let pushHint = "";
+ if (opts.empty && opts.canPush) {
+ pushHint = ` <section class="box">
<p><strong>This repository is empty.</strong> Push to get started:</p>
<code>git remote add mirror ${esc(cloneUrl(opts.owner, opts.name))}<br>git push --mirror mirror</code>
- <p class="${c.repoDesc}">When prompted, the <strong>username</strong> is <code>${esc(pusher)}</code> and the <strong>password</strong> is a token from <a href="/settings/tokens">settings</a>.</p>
- </section>`
- : empty
- ? ` <section class="${c.cloneBox}">
- <p class="${c.empty}">This repository is empty.</p>
- </section>`
- : "";
+ <p class="muted">When prompted, the <strong>username</strong> is <code>${esc(pusher)}</code> and the <strong>password</strong> is a token from <a href="/settings/tokens">settings</a>.</p>
+ </section>`;
+ } else if (opts.empty) {
+ pushHint = ` <p class="box empty">This repository is empty.</p>`;
+ }
- const readmeSection = empty
- ? ""
- : opts.readme
- ? ` <h2 class="${c.sectionTitle}">${icon("file-text")}${esc(opts.readme.path)}</h2>
- <article class="${c.readme}">
+ let readmeSection = "";
+ if (opts.readme) {
+ readmeSection = ` <h2 class="section-title">${icon("file-text")}${esc(opts.readme.path)}</h2>
+ <article class="readme">
${renderMarkdown(opts.readme.text)}
- </article>`
- : ` <h2 class="${c.sectionTitle}">${icon("file-text")}readme</h2>
- <p class="${c.empty}">No ReadMe was found, commit one to add a summary</p>`;
+ </article>`;
+ } else if (!opts.empty) {
+ readmeSection = ` <h2 class="section-title">${icon("file-text")}readme</h2>
+ <p class="empty">No ReadMe was found, commit one to add a summary</p>`;
+ }
- const isOwner = opts.collaborators !== null;
const manage = isOwner
- ? ` <h2 class="${c.sectionTitle}">${icon("gear")}manage</h2>
- <div class="${c.repoTabs}">
- <form method="post" action="${base(opts.owner, opts.name)}/visibility">
+ ? ` <h2 class="section-title">${icon("gear")}manage</h2>
+ <div class="tabs">
+ <form method="post" action="${b}/visibility">
<input type="hidden" name="public" value="${opts.isPublic ? "" : "on"}">
<button type="submit">${icon(opts.isPublic ? "lock" : "lock-open")}make ${opts.isPublic ? "private" : "public"}</button>
</form>
- <form method="post" action="${base(opts.owner, opts.name)}/delete" data-confirm="Delete ${esc(title)} permanently? This cannot be undone.">
+ <form method="post" action="${b}/delete" data-confirm="Delete ${esc(title)}? It moves to Recently Deleted.">
<button type="submit">${icon("trash")}delete repository</button>
</form>
</div>
-${collaboratorSection(opts.owner, opts.name, opts.collaborators ?? [])}`
+${collaboratorSection(b, opts.collaborators ?? [])}`
: "";
- const descriptionForm = opts.canPush
- ? ` <form method="post" action="${base(opts.owner, opts.name)}/description" class="${c.cloneBox} ${c.formRow}">
- <label class="${c.cloneLabel} ${c.withIcon}" for="repo-description">${icon("note")}description</label>
- <input id="repo-description" class="${c.grow}" type="text" name="description" maxlength="300"
+ let descriptionForm = "";
+ if (opts.canPush) {
+ descriptionForm = ` <form method="post" action="${b}/description" class="box row">
+ <label class="label with-icon" for="repo-description">${icon("note")}description</label>
+ <input id="repo-description" class="grow" type="text" name="description" maxlength="300"
value="${esc(opts.rawDescription)}" placeholder="what this repository is for">
<button type="submit">${icon("floppy-disk")}save</button>
- </form>`
- : opts.rawDescription
- ? ` <p class="${c.repoDesc}">${esc(opts.rawDescription)}</p>`
- : "";
+ </form>`;
+ } else if (opts.rawDescription) {
+ descriptionForm = ` <p class="muted">${esc(opts.rawDescription)}</p>`;
+ }
- const body = ` <h1 class="${c.repoTitle}"><a class="${c.ownerLink}" href="/${esc(opts.owner)}">${esc(opts.owner)}</a>/${esc(opts.name)}</h1>
- <p class="${c.repoDesc}"><span class="${c.withIcon}">${icon(opts.isPublic ? "lock-open" : "lock", 13)}${opts.isPublic ? "public" : "private"}</span>${opts.canPush && !isOwner ? `<span class="${c.badge}">${icon("upload", 11)}you can push</span>` : ""}</p>
+ const pushBadge =
+ opts.canPush && !isOwner ? `<span class="badge">${icon("upload", 11)}you can push</span>` : "";
+
+ const body = ` <h1 class="repo-title"><a class="muted" href="/${esc(opts.owner)}">${esc(opts.owner)}</a>/${esc(opts.name)}</h1>
+ <p class="muted">${visibility(opts.isPublic)}${pushBadge}</p>
${repoNav(opts.owner, opts.name, "summary", q)}
${descriptionForm}
${revPicker(opts.refs, opts.rev)}
- <section class="${c.cloneBox}">
- <span class="${c.cloneLabel} ${c.withIcon}">${icon("download")}clone</span>
+ <section class="box">
+ <span class="label with-icon">${icon("download")}clone</span>
<code>git clone ${esc(cloneUrl(opts.owner, opts.name))}</code>
</section>
${pushHint}
-${mirrorSection(
- opts.owner,
- opts.name,
- opts.links,
- opts.mirrorStatuses,
- opts.localSha,
- isOwner,
- opts.canPush,
-)}
+${mirrorSection(b, opts.links, opts.mirrorStatuses, opts.localSha, isOwner, opts.canPush)}
${readmeSection}
${manage}`;
+
return layout({
title,
user: opts.user,
@@ -481,9 +482,12 @@ ${manage}`;
});
}
+function kindIcon(kind: MirrorKind): string {
+ return icon(kind === "github" ? "github-logo" : "git-branch");
+}
+
function mirrorSection(
- owner: string,
- name: string,
+ b: string,
links: MirrorLink[],
statuses: Map<string, MirrorStatus>,
localSha: string | null,
@@ -494,49 +498,44 @@ function mirrorSection(
const nowSec = Math.floor(Date.now() / 1000);
- const rows = links
- .map((link) => {
- const status = statuses.get(link.kind) ?? null;
- const view = describeMirror(link, status, nowSec);
- return ` <div class="${c.mirrorRow}">
- <span class="${c.mirrorKind}"><a class="${c.withIcon}" href="${esc(link.url)}" rel="nofollow noopener noreferrer" title="${esc(link.kind)}">${icon(link.kind === "github" ? "github-logo" : "git-branch")}${esc(mirrorSlug(link.kind, link.url))}</a></span>
- <span class="${view.cls} ${c.withIcon}">${icon(view.glyph)}${esc(view.label)}</span>
- <span class="${c.commitHash}">${esc(view.sha)}</span>
- <span class="${c.repoDesc}">${esc(view.detail)}</span>
- </div>${view.note ? `\n <p class="${view.noteCls}">${esc(view.note)}</p>` : ""}`;
- })
- .join("\n");
-
- const local = localSha
- ? ` <div class="${c.mirrorRow}">
- <span class="${c.mirrorKind} ${c.withIcon}">${icon("house")}local</span>
- <span class="${c.statusMuted}">this repository</span>
- <span class="${c.commitHash}">${esc(localSha.slice(0, 7))}</span>
+ const rows = links.map((link) => {
+ const view = describeMirror(link, statuses.get(link.kind) ?? null, nowSec);
+ const note = view.note ? `\n <p class="${view.noteCls}">${esc(view.note)}</p>` : "";
+ return ` <div class="mirror-row">
+ <span class="mirror-kind"><a class="with-icon" href="${esc(link.url)}" rel="nofollow noopener noreferrer">${kindIcon(link.kind)}${esc(mirrorSlug(link.kind, link.url))}</a></span>
+ <span class="${view.cls} with-icon">${icon(view.glyph)}${esc(view.label)}</span>
+ <span class="mono">${esc(view.sha)}</span>
+ <span class="muted">${esc(view.detail)}</span>
+ </div>${note}`;
+ });
+
+ if (localSha) {
+ rows.push(` <div class="mirror-row">
+ <span class="mirror-kind with-icon">${icon("house")}local</span>
+ <span class="empty">this repository</span>
+ <span class="mono">${esc(localSha.slice(0, 7))}</span>
<span></span>
- </div>`
- : "";
+ </div>`);
+ }
- const checkButton =
- canCheck && links.some((l) => !l.isPrivate)
- ? ` <form method="post" action="${base(owner, name)}/mirrors/check">
+ if (canCheck && links.some((l) => !l.isPrivate)) {
+ rows.push(` <form method="post" action="${b}/mirrors/check">
<button type="submit">${icon("arrow-clockwise")}check now</button>
- </form>`
- : "";
+ </form>`);
+ }
- const body =
+ const list =
links.length > 0
- ? ` <section class="${c.cloneBox}">
-${rows}
-${local}
-${checkButton}
+ ? ` <section class="box">
+${rows.join("\n")}
</section>`
- : ` <p class="${c.empty}">No mirrors configured.</p>`;
+ : ` <p class="empty">No mirrors configured.</p>`;
const field = (kind: MirrorKind) => {
const existing = links.find((l) => l.kind === kind);
- return ` <div class="${c.formRow}">
- <label class="${c.cloneLabel} ${c.withIcon}" for="mirror-${kind}">${icon(kind === "github" ? "github-logo" : "git-branch")}${kind}</label>
- <input id="mirror-${kind}" class="${c.grow}" type="text" name="${kind}"
+ return ` <div class="row">
+ <label class="label with-icon" for="mirror-${kind}">${kindIcon(kind)}${kind}</label>
+ <input id="mirror-${kind}" class="grow" type="text" name="${kind}"
value="${esc(existing ? mirrorSlug(kind, existing.url) : "")}"
placeholder="user/repo" pattern="[^\\s/]+/[^\\s/]+/?" autocapitalize="off" spellcheck="false">
<label><input type="checkbox" name="${kind}_private"${existing?.isPrivate ? " checked" : ""}> private</label>
@@ -544,100 +543,94 @@ ${checkButton}
};
const form = isOwner
- ? ` <form method="post" action="${base(owner, name)}/mirrors" class="${c.cloneBox}">
+ ? ` <form method="post" action="${b}/mirrors" class="box">
${MIRROR_KINDS.map(field).join("\n")}
- <p class="${c.repoDesc}">Give the <code>user/repo</code> on ${esc(MIRROR_KINDS.map(mirrorHost).join(" or "))} — not a full URL.
+ <p class="muted">Give the <code>user/repo</code> on ${esc(MIRROR_KINDS.map(mirrorHost).join(" or "))} — not a full URL.
Mark a mirror <em>private</em> to skip status checks — they are anonymous, so a private
mirror would otherwise always look unreachable. Clear a field to remove it.</p>
<button type="submit">${icon("floppy-disk")}save mirrors</button>
</form>`
: "";
- return ` <h2 class="${c.sectionTitle}">${icon("hard-drives")}external mirrors</h2>
-${body}
+ return ` <h2 class="section-title">${icon("hard-drives")}external mirrors</h2>
+${list}
${form}`;
}
-function describeMirror(
- link: MirrorLink,
- status: MirrorStatus | null,
- nowSec: number,
-): {
- label: string;
- glyph: string;
- cls: string;
- sha: string;
- detail: string;
- note: string;
- noteCls: string;
-} {
- const blank = { note: "", noteCls: c.repoDesc };
+const MIRROR_LABELS: Record<string, { label: string; glyph: string; cls: string }> = {
+ synced: { label: "Up to date", glyph: "check", cls: "good" },
+ ahead: { label: "Mirror behind", glyph: "arrow-up", cls: "warn" },
+ behind: { label: "Local behind", glyph: "arrow-down", cls: "warn" },
+ diverged: { label: "Diverged", glyph: "warning-diamond", cls: "bad" },
+ out_of_sync: { label: "Out of sync", glyph: "warning-diamond", cls: "bad" },
+ denied: { label: "Private or missing", glyph: "lock", cls: "warn" },
+ missing: { label: "Repository missing", glyph: "x", cls: "bad" },
+};
+
+const UNKNOWN_STATE = {
+ label: "Unavailable",
+ glyph: "question",
+ cls: "bad",
+};
+
+// A verified state older than this is flagged as stale
+const STALE_AFTER = 24 * 3600;
+
+function describeMirror(link: MirrorLink, status: MirrorStatus | null, nowSec: number) {
+ const idle = {
+ glyph: "hourglass",
+ cls: "empty",
+ sha: "",
+ note: "",
+ noteCls: "muted",
+ };
if (link.isPrivate) {
return {
- ...blank,
+ ...idle,
label: "Not checked (private)",
glyph: "lock",
- cls: c.statusMuted,
- sha: "",
detail: "status checks are anonymous",
};
}
if (!status || (!status.state && !status.error)) {
return {
- ...blank,
+ ...idle,
label: "not checked yet",
- glyph: "hourglass",
- cls: c.statusMuted,
- sha: "",
detail: "",
};
}
- const LABELS: Record<string, { label: string; glyph: string; cls: string }> = {
- synced: { label: "Up to date", glyph: "check", cls: c.statusGood },
- ahead: { label: "Mirror behind", glyph: "arrow-up", cls: c.statusWarn },
- behind: { label: "Local behind", glyph: "arrow-down", cls: c.statusWarn },
- diverged: { label: "Diverged", glyph: "warning-diamond", cls: c.statusBad },
- out_of_sync: { label: "Out of sync", glyph: "warning-diamond", cls: c.statusBad },
- denied: { label: "Private or missing", glyph: "lock", cls: c.statusWarn },
- missing: { label: "Repository missing", glyph: "x", cls: c.statusBad },
- };
+ const known = (status.state && MIRROR_LABELS[status.state]) || UNKNOWN_STATE;
+ const sha = status.remoteSha ? status.remoteSha.slice(0, 7) : "";
+ const verifiedAgo = status.okAt !== null ? nowSec - status.okAt : null;
+ const stale = verifiedAgo !== null && verifiedAgo > STALE_AFTER;
if (status.error) {
- const known = status.state ? LABELS[status.state] : undefined;
- const stale = status.okAt !== null && nowSec - status.okAt > 24 * 3600;
+ let note = `${link.kind}: check failed ${ago(nowSec - status.checkedAt)} ago (${status.error})`;
+ if (verifiedAgo !== null) {
+ note += stale
+ ? ` — NOT VERIFIED for ${ago(verifiedAgo)}`
+ : ` — showing last verified state from ${ago(verifiedAgo)} ago`;
+ }
return {
- label: known ? known.label : "Unavailable",
- glyph: known ? known.glyph : "question",
- cls: known ? c.statusMuted : c.statusBad,
- sha: status.remoteSha ? status.remoteSha.slice(0, 7) : "",
- detail: status.okAt ? `last verified ${ago(nowSec - status.okAt)} ago` : "never verified",
- note:
- `${link.kind}: check failed ${ago(nowSec - status.checkedAt)} ago (${status.error})` +
- (status.okAt
- ? stale
- ? ` — NOT VERIFIED for ${ago(nowSec - status.okAt)}`
- : ` — showing last verified state from ${ago(nowSec - status.okAt)} ago`
- : ""),
- noteCls: stale || !status.okAt ? c.statusBad : c.statusWarn,
+ ...known,
+ cls: status.state ? "empty" : "bad",
+ sha,
+ detail: verifiedAgo !== null ? `last verified ${ago(verifiedAgo)} ago` : "never verified",
+ note,
+ noteCls: stale || verifiedAgo === null ? "bad" : "warn",
};
}
- const known = status.state ? LABELS[status.state] : undefined;
- const stale = status.okAt !== null && nowSec - status.okAt > 24 * 3600;
return {
- label: known?.label ?? "Unavailable",
- glyph: known?.glyph ?? "question",
- cls: known?.cls ?? c.statusBad,
- sha: status.remoteSha ? status.remoteSha.slice(0, 7) : "",
- detail: [status.detail, status.okAt ? `checked ${ago(nowSec - status.okAt)} ago` : ""]
+ ...known,
+ sha,
+ detail: [status.detail, verifiedAgo !== null ? `checked ${ago(verifiedAgo)} ago` : ""]
.filter(Boolean)
.join(" · "),
- note: stale
- ? `${link.kind}: not verified for ${ago(nowSec - (status.okAt ?? nowSec))}`
- : "",
- noteCls: c.statusBad,
+ note: stale ? `${link.kind}: not verified for ${ago(verifiedAgo!)}` : "",
+ noteCls: "bad",
};
}
@@ -648,19 +641,14 @@ function ago(seconds: number): string {
return `${Math.round(seconds / 86400)}d`;
}
-function collaboratorSection(
- owner: string,
- name: string,
- collaborators: CollaboratorRow[],
-): string {
- const action = `${base(owner, name)}/collaborators`;
+function collaboratorSection(b: string, collaborators: CollaboratorRow[]): string {
+ const action = `${b}/collaborators`;
- const rows = collaborators
- .map(
- (person) => ` <tr>
+ const rows = collaborators.map(
+ (person) => ` <tr>
<td>${icon("user", 13)} <a href="/${esc(person.slug)}">${esc(person.slug)}</a></td>
- <td class="${c.repoVis}">${esc(person.level)}</td>
- <td class="${c.commitDate}">${fmtDate(person.added_at)}</td>
+ <td class="mono">${esc(person.level)}</td>
+ <td class="mono">${fmtDate(person.added_at)}</td>
<td>
<form method="post" action="${action}/remove">
<input type="hidden" name="slug" value="${esc(person.slug)}">
@@ -668,14 +656,13 @@ function collaboratorSection(
</form>
</td>
</tr>`,
- )
- .join("\n");
+ );
- return ` <h2 class="${c.sectionTitle}">${icon("users")}collaborators</h2>
- <p class="${c.repoDesc}">People here can see this repository even while it is
+ return ` <h2 class="section-title">${icon("users")}collaborators</h2>
+ <p class="muted">People here can see this repository even while it is
private. <code>write</code> also lets them push to it.</p>
- <form method="post" action="${action}" class="${c.cloneBox} ${c.formRow}">
- <label class="${c.cloneLabel} ${c.withIcon}" for="collab-slug">${icon("user")}username</label>
+ <form method="post" action="${action}" class="box row">
+ <label class="label with-icon" for="collab-slug">${icon("user")}username</label>
<input id="collab-slug" type="text" name="slug" placeholder="their handle" pattern="[A-Za-z0-9._-]+" required>
<select name="level" aria-label="access level">
<option value="read">read</option>
@@ -683,14 +670,7 @@ function collaboratorSection(
</select>
<button type="submit">${icon("user-plus")}add</button>
</form>
- <table>
- <thead>
- <tr><th>user</th><th>access</th><th>added</th><th></th></tr>
- </thead>
- <tbody>
-${rows || ` <tr><td colspan="4" class="${c.empty}">nobody else has access</td></tr>`}
- </tbody>
- </table>`;
+ ${table(["user", "access", "added", ""], rows, "nobody else has access")}`;
}
export function repoDescription(opts: {
@@ -701,8 +681,7 @@ export function repoDescription(opts: {
}): string {
if (opts.description.trim()) return opts.description;
const fromReadme = opts.readme ? plainSummary(opts.readme.text) : "";
- if (fromReadme) return fromReadme;
- return `${opts.owner}/${opts.name} — a git repository on ${config.title}.`;
+ return fromReadme || `${opts.owner}/${opts.name} — a git repository on ${config.title}.`;
}
export function logPage(opts: {
@@ -714,11 +693,23 @@ export function logPage(opts: {
user: SessionUser | null;
}): string {
const title = `${opts.owner}/${opts.name}`;
+ const b = base(opts.owner, opts.name);
const q = revQuery(opts.rev, opts.refs.head);
- const body = ` <h1 class="${c.repoTitle}">${esc(title)} · log</h1>
+
+ const rows = opts.commits.map(
+ (cm) => ` <tr>
+ <td class="mono">${fmtDate(cm.time)}</td>
+ <td>${icon("git-commit", 13)} <a href="${b}/commit/${esc(cm.hash)}${q}">${esc(cm.subject)}</a></td>
+ <td class="muted">${esc(cm.author)}</td>
+ <td class="mono">${esc(cm.hash.slice(0, 10))}</td>
+ </tr>`,
+ );
+
+ const body = ` <h1 class="repo-title">${esc(title)} · log</h1>
${repoNav(opts.owner, opts.name, "log", q)}
${revPicker(opts.refs, opts.rev)}
- ${commitTable(opts.owner, opts.name, opts.commits, q)}`;
+ ${table([], rows, "no commits")}`;
+
return layout({
title: `${title} log`,
user: opts.user,
@@ -741,37 +732,35 @@ export function treePage(opts: {
const q = revQuery(opts.rev, opts.refs.head);
const crumb = opts.path ? ` /${esc(opts.path)}` : "";
- const parent = opts.path
- ? ` <tr class="${c.repoRow}">
- <td class="${c.treeMode}"></td>
- <td class="${c.treeName}">${icon("arrow-up", 13)} <a href="${b}/tree/${esc(opts.path.split("/").slice(0, -1).join("/"))}${q}">../</a></td>
- <td class="${c.treeSize}"></td>
- </tr>`
- : "";
-
- const rows = opts.entries
- .map((e) => {
- const childPath = opts.path ? `${opts.path}/${e.name}` : e.name;
- const href =
- e.type === "tree"
- ? `${b}/tree/${esc(childPath)}${q}`
- : `${b}/blob/${esc(childPath)}${q}`;
- return ` <tr class="${c.repoRow}">
- <td class="${c.treeMode}">${esc(e.mode)}</td>
- <td class="${c.treeName}">${icon(e.type === "tree" ? "folder" : "file-text", 13)} <a href="${href}">${esc(e.name)}${e.type === "tree" ? "/" : ""}</a></td>
- <td class="${c.treeSize}">${esc(e.size)}</td>
+ const row = (mode: string, glyph: string, href: string, label: string, size: string) =>
+ ` <tr>
+ <td class="mono">${esc(mode)}</td>
+ <td>${icon(glyph, 13)} <a href="${href}">${label}</a></td>
+ <td class="mono right">${esc(size)}</td>
</tr>`;
- })
- .join("\n");
- const body = ` <h1 class="${c.repoTitle}">${esc(opts.owner)}/${esc(opts.name)} · tree${crumb}</h1>
+ const rows = opts.entries.map((e) => {
+ const childPath = esc(opts.path ? `${opts.path}/${e.name}` : e.name);
+ const isDir = e.type === "tree";
+ return row(
+ e.mode,
+ isDir ? "folder" : "file-text",
+ `${b}/${isDir ? "tree" : "blob"}/${childPath}${q}`,
+ `${esc(e.name)}${isDir ? "/" : ""}`,
+ e.size,
+ );
+ });
+
+ if (opts.path) {
+ const up = esc(opts.path.split("/").slice(0, -1).join("/"));
+ rows.unshift(row("", "arrow-up", `${b}/tree/${up}${q}`, "../", ""));
+ }
+
+ const body = ` <h1 class="repo-title">${esc(opts.owner)}/${esc(opts.name)} · tree${crumb}</h1>
${repoNav(opts.owner, opts.name, "tree", q)}
${revPicker(opts.refs, opts.rev)}
- <table class="${c.treeList}">
- <tbody>
-${[parent, rows].filter(Boolean).join("\n") || ` <tr><td class="${c.empty}">empty</td></tr>`}
- </tbody>
- </table>`;
+ ${table([], rows, "empty")}`;
+
return layout({
title: `${opts.owner}/${opts.name} tree`,
user: opts.user,
@@ -799,24 +788,28 @@ export function blobPage(opts: {
rev: string;
user: SessionUser | null;
}): string {
+ const b = base(opts.owner, opts.name);
+ const size = esc(fmtBytes(opts.bytes));
const cut = opts.truncated
- ? `<p class="${c.binaryNotice}">Showing the first part of a ${esc(fmtBytes(opts.bytes))} file. Clone the repository to read all of it.</p>`
+ ? `<p class="muted">Showing the first part of a ${size} file. Clone the repository to read all of it.</p>`
: "";
const content = opts.binary
- ? `<p class="${c.binaryNotice}">binary file not shown (${esc(fmtBytes(opts.bytes))})</p>`
- : `${cut}<pre class="${c.code}"><code>${esc(opts.text)}</code></pre>`;
+ ? `<p class="muted">binary file not shown (${size})</p>`
+ : `${cut}<pre class="code"><code>${esc(opts.text)}</code></pre>`;
const q = revQuery(opts.rev, opts.refs.head);
const upPath = opts.path.split("/").slice(0, -1).join("/");
- const body = ` <h1 class="${c.repoTitle}">${esc(opts.owner)}/${esc(opts.name)} · ${esc(opts.path)}</h1>
+
+ const body = ` <h1 class="repo-title">${esc(opts.owner)}/${esc(opts.name)} · ${esc(opts.path)}</h1>
${repoNav(opts.owner, opts.name, "tree", q)}
- <p class="${c.repoDesc}"><a class="${c.withIcon}" href="${base(opts.owner, opts.name)}/tree/${esc(upPath)}${q}">${icon("arrow-left")}back to ${esc(upPath || "tree")}</a></p>
+ <p class="muted"><a class="with-icon" href="${b}/tree/${esc(upPath)}${q}">${icon("arrow-left")}back to ${esc(upPath || "tree")}</a></p>
${content}`;
+
return layout({
title: opts.path,
user: opts.user,
body,
description: `${opts.path} in ${opts.owner}/${opts.name}.`,
- path: `${base(opts.owner, opts.name)}/blob/${opts.path}`,
+ path: `${b}/blob/${opts.path}`,
});
}
@@ -829,16 +822,21 @@ export function commitPage(opts: {
}): string {
const cm = opts.commit;
const q = `?h=${encodeURIComponent(opts.rev)}`;
- const body = ` <h1 class="${c.pageTitle}">${esc(cm.subject)}</h1>
+ const tooBig = cm.diffTruncated
+ ? `<p class="muted">This diff is too large to show in full. Clone the repository to read all of it.</p>`
+ : "";
+
+ const body = ` <h1 class="page-title">${esc(cm.subject)}</h1>
${repoNav(opts.owner, opts.name, "log", q)}
- <dl class="${c.commitMeta}">
- <dt class="${c.withIcon}">${icon("git-commit", 13)}commit</dt><dd class="${c.commitHash}">${esc(cm.hash)}</dd>
- <dt class="${c.withIcon}">${icon("user", 13)}author</dt><dd>${esc(cm.author)} <${esc(cm.email)}></dd>
- <dt class="${c.withIcon}">${icon("clock", 13)}date</dt><dd>${fmtDate(cm.time)}</dd>
+ <dl class="commit-meta">
+ <dt class="with-icon">${icon("git-commit", 13)}commit</dt><dd class="mono">${esc(cm.hash)}</dd>
+ <dt class="with-icon">${icon("user", 13)}author</dt><dd>${esc(cm.author)} <${esc(cm.email)}></dd>
+ <dt class="with-icon">${icon("clock", 13)}date</dt><dd>${fmtDate(cm.time)}</dd>
</dl>
- ${cm.body ? `<pre class="${c.code}">${esc(cm.body)}</pre>` : ""}
- ${cm.diffTruncated ? `<p class="${c.binaryNotice}">This diff is too large to show in full. Clone the repository to read all of it.</p>` : ""}
- <pre class="${c.code}"><code>${esc(cm.diff)}</code></pre>`;
+ ${cm.body ? `<pre class="code">${esc(cm.body)}</pre>` : ""}
+ ${tooBig}
+ <pre class="code"><code>${esc(cm.diff)}</code></pre>`;
+
return layout({
title: cm.subject,
user: opts.user,
@@ -848,93 +846,95 @@ ${repoNav(opts.owner, opts.name, "log", q)}
});
}
-function settingsNav(active: string): string {
- const tab = (id: string, label: string, glyph: string, href: string) =>
- `<a class="${c.tab}${id === active ? " " + c.tabActive : ""}" href="${href}">${icon(glyph)}${label}</a>`;
- return ` <nav class="${c.repoTabs}">
- ${tab("account", "account", "user", "/settings")}
- ${tab("tokens", "tokens", "key", "/settings/tokens")}
- ${tab("deleted", "recently deleted", "trash", "/settings/deleted")}
- </nav>`;
+function settingsLayout(opts: {
+ active: string;
+ title: string;
+ description: string;
+ user: SessionUser;
+ body: string;
+}): string {
+ const nav = tabs(opts.active, [
+ ["account", "account", "user", "/settings"],
+ ["tokens", "tokens", "key", "/settings/tokens"],
+ ["deleted", "recently deleted", "trash", "/settings/deleted"],
+ ]);
+ return layout({
+ title: opts.title,
+ user: opts.user,
+ body: ` <h1 class="page-title">settings</h1>
+${nav}
+${opts.body}`,
+ description: opts.description,
+ noindex: true,
+ });
}
export function tokensPage(opts: {
tokens: TokenRow[];
- user: SessionUser | null;
+ user: SessionUser;
newToken?: string | null;
}): string {
- const rows = opts.tokens
- .map(
- (t) => ` <tr>
+ const authUser = esc(sessionSlug(opts.user));
+
+ const rows = opts.tokens.map(
+ (t) => ` <tr>
<td>${esc(t.label)}</td>
- <td class="${c.commitHash}">${esc(t.id)}</td>
- <td class="${c.commitDate}">${fmtDate(t.created_at)}</td>
- <td class="${c.commitDate}">${t.last_used ? fmtDate(t.last_used) : "never"}</td>
+ <td class="mono">${esc(t.id)}</td>
+ <td class="mono">${fmtDate(t.created_at)}</td>
+ <td class="mono">${t.last_used ? fmtDate(t.last_used) : "never"}</td>
<td>
<form method="post" action="/settings/tokens/${esc(t.id)}/revoke">
<button type="submit">${icon("x")}revoke</button>
</form>
</td>
</tr>`,
- )
- .join("\n");
+ );
- const authUser = opts.user ? ownerOf(opts.user) : "git";
const created = opts.newToken
- ? ` <section class="${c.cloneBox}">
+ ? ` <section class="box">
<p><strong>New token — copy it now, it won't be shown again:</strong></p>
<code>${esc(opts.newToken)}</code>
- <p class="${c.repoDesc}">Ready-to-use remote:<br>
- <code>git remote add mirror ${esc(config.baseUrl.replace("://", `://${authUser}:${opts.newToken}@`))}/${esc(authUser)}/<repo>.git</code></p>
+ <p class="muted">Ready-to-use remote:<br>
+ <code>git remote add mirror ${esc(config.baseUrl.replace("://", `://${sessionSlug(opts.user)}:${opts.newToken}@`))}/${authUser}/<repo>.git</code></p>
</section>`
: "";
- const body = ` <h1 class="${c.pageTitle}">settings</h1>
-${settingsNav("tokens")}
- <h2 class="${c.sectionTitle}">${icon("key")}access tokens</h2>
- <p class="${c.repoDesc}">These tokens act as <code>${esc(authUser)}</code>: use that as the git
+ const body = ` <h2 class="section-title">${icon("key")}access tokens</h2>
+ <p class="muted">These tokens act as <code>${authUser}</code>: use that as the git
<strong>username</strong> and the token as the <strong>password</strong>. They can only push to
- repositories under <code>${esc(authUser)}/</code>.</p>
+ repositories under <code>${authUser}/</code>.</p>
${created}
- <form method="post" action="/settings/tokens" class="${c.cloneBox}">
- <label class="${c.cloneLabel} ${c.withIcon}">${icon("tag")}label</label>
- <input type="text" name="label" placeholder="laptop, backup cron, ...">
+ <form method="post" action="/settings/tokens" class="box row">
+ <label class="label with-icon" for="token-label">${icon("tag")}label</label>
+ <input id="token-label" type="text" name="label" placeholder="laptop, backup cron, ...">
<button type="submit">${icon("plus")}create token</button>
</form>
- <table>
- <thead>
- <tr><th>label</th><th>id</th><th>created</th><th>last used</th><th></th></tr>
- </thead>
- <tbody>
-${rows || ` <tr><td colspan="5" class="${c.empty}">no tokens yet</td></tr>`}
- </tbody>
- </table>`;
- return layout({
+ ${table(["label", "id", "created", "last used", ""], rows, "no tokens yet")}`;
+
+ return settingsLayout({
+ active: "tokens",
title: "access tokens",
+ description: "Manage git access tokens.",
user: opts.user,
body,
- description: "Manage git access tokens.",
- noindex: true,
});
}
export function settingsPage(opts: {
- user: SessionUser | null;
+ user: SessionUser;
settings: Settings;
- saved?: string | null;
+ saved: boolean;
}): string {
const s = opts.settings;
const on = (v: boolean) => (v ? " checked" : "");
const webhookState = s.discordWebhook
- ? ` <p class="${c.repoDesc}">configured · <code>${esc(maskWebhook(s.discordWebhook))}</code></p>`
- : ` <p class="${c.empty}">not configured — repository events are not announced anywhere.</p>`;
+ ? ` <p class="muted">configured · <code>${esc(maskWebhook(s.discordWebhook))}</code></p>`
+ : ` <p class="empty">not configured — repository events are not announced anywhere.</p>`;
const webhookError =
s.discordWebhook && s.webhookError
- ? ` <p class="${c.statusBad}">last delivery failed${
- s.webhookErrorAt ? ` at ${fmtDate(s.webhookErrorAt)}` : ""
- }: ${esc(s.webhookError)}</p>`
+ ? ` <p class="bad">last delivery failed${s.webhookErrorAt ? ` at ${fmtDate(s.webhookErrorAt)}` : ""}: ${esc(s.webhookError)}</p>`
: "";
const clear = s.discordWebhook
@@ -944,91 +944,84 @@ export function settingsPage(opts: {
</form>`
: "";
- const body = ` <h1 class="${c.pageTitle}">settings</h1>
-${settingsNav("account")}
-${opts.saved ? ` <p class="${c.statusGood}">${esc(opts.saved)}</p>` : ""}
+ const account = accountUrl();
+ const accountLink = account
+ ? ` — change them on <a href="${esc(account)}">your SSO account page</a>`
+ : "";
+
+ const body = `${opts.saved ? ` <p class="good">saved.</p>` : ""}
- <h2 class="${c.sectionTitle}">${icon("discord-logo")}discord notifications</h2>
- <p class="${c.repoDesc}">Announces repositories being created and deleted, and commits being
+ <h2 class="section-title">${icon("discord-logo")}discord notifications</h2>
+ <p class="muted">Announces repositories being created and deleted, and commits being
pushed. Only repositories you own are announced, and only to this webhook.</p>
- <section class="${c.cloneBox}">
+ <section class="box">
${webhookState}
${webhookError}
- <form method="post" action="/settings/discord" class="${c.formRow}">
- <label class="${c.cloneLabel} ${c.withIcon}" for="discord-url">${icon("link")}webhook</label>
- <input id="discord-url" class="${c.grow}" type="url" name="url" autocomplete="off"
+ <form method="post" action="/settings/discord" class="row">
+ <label class="label with-icon" for="discord-url">${icon("link")}webhook</label>
+ <input id="discord-url" class="grow" type="url" name="url" autocomplete="off"
placeholder="https://discord.com/api/webhooks/…">
<button type="submit">${icon("floppy-disk")}save</button>
</form>
${clear}
</section>
- <h2 class="${c.sectionTitle}">${icon("sliders")}preferences</h2>
- <form method="post" action="/settings/prefs" class="${c.cloneBox}">
+ <h2 class="section-title">${icon("sliders")}preferences</h2>
+ <form method="post" action="/settings/prefs" class="box">
<p><label><input type="checkbox" name="default_private"${on(s.defaultPrivate)}>
New repositories start private</label></p>
<p><label><input type="checkbox" name="discord_private"${on(s.discordPrivate)}>
Announce activity on private repositories</label>
- <br><span class="${c.repoDesc}">Off by default: commit subjects and repository names
+ <br><span class="muted">Off by default: commit subjects and repository names
would otherwise leave a private repo for a Discord channel.</span></p>
<p><label><input type="checkbox" name="mirror_auto"${on(s.mirrorAuto)}>
Check mirror status automatically when viewing a repository</label>
- <br><span class="${c.repoDesc}">Off means mirrors are only checked when you press
+ <br><span class="muted">Off means mirrors are only checked when you press
<em>check now</em>.</span></p>
<button type="submit">${icon("floppy-disk")}save preferences</button>
</form>
- <h2 class="${c.sectionTitle}">${icon("user")}account</h2>
- <p class="${c.repoDesc}">Your name and avatar come from your SSO account and refresh
- automatically, so there is nothing to edit here${
- accountUrl() ? ` — change them on <a href="${esc(accountUrl()!)}">your SSO account page</a>` : ""
- }. Your owner namespace is
- <code>${esc(opts.user ? ownerOf(opts.user) : "")}</code> and never changes.</p>`;
+ <h2 class="section-title">${icon("user")}account</h2>
+ <p class="muted">Your name and avatar come from your SSO account and refresh
+ automatically, so there is nothing to edit here${accountLink}. Your owner namespace is
+ <code>${esc(sessionSlug(opts.user))}</code> and never changes.</p>`;
- return layout({
+ return settingsLayout({
+ active: "account",
title: "settings",
+ description: "Account settings.",
user: opts.user,
body,
- description: "Account settings.",
- noindex: true,
});
}
export function deletedPage(opts: {
- user: SessionUser | null;
+ user: SessionUser;
entries: TrashEntry[];
retentionDays: number;
}): string {
const nowSec = Math.floor(Date.now() / 1000);
- const rows = opts.entries
- .map((e) => {
- const remaining =
- opts.retentionDays > 0
- ? Math.ceil(
- (e.deletedAt + opts.retentionDays * 86400 - nowSec) / 86400,
- )
- : null;
- const life =
- remaining === null
- ? `<span class="${c.statusMuted}">kept until purged</span>`
- : remaining <= 0
- ? `<span class="${c.statusBad}">purged on next visit</span>`
- : remaining <= 3
- ? `<span class="${c.statusBad}">${remaining}d left</span>`
- : `<span class="${c.statusMuted}">${remaining}d left</span>`;
-
- const note = e.degraded
- ? `<br><span class="${c.statusWarn}">recovery metadata unreadable — restorable, but collaborators will need re-adding</span>`
- : e.grants.length
- ? `<br><span class="${c.repoDesc}">${e.grants.length} collaborator${e.grants.length === 1 ? "" : "s"} will be restored</span>`
- : "";
-
- return ` <tr>
- <td class="${c.repoName}">${icon("git-branch", 13)} ${esc(e.name)}${note}</td>
- <td class="${c.commitDate}">${fmtDate(e.deletedAt)}</td>
- <td class="${c.repoDesc}">${esc(e.deletedBy)}</td>
- <td>${life}</td>
+ const lifeLabel = (deletedAt: number): string => {
+ if (opts.retentionDays <= 0) return `<span class="empty">kept until purged</span>`;
+ const left = Math.ceil((deletedAt + opts.retentionDays * 86400 - nowSec) / 86400);
+ if (left <= 0) return `<span class="bad">purged on next visit</span>`;
+ return `<span class="${left <= 3 ? "bad" : "empty"}">${left}d left</span>`;
+ };
+
+ const rows = opts.entries.map((e) => {
+ let note = "";
+ if (e.degraded) {
+ note = `<br><span class="warn">recovery metadata unreadable — restorable, but collaborators will need re-adding</span>`;
+ } else if (e.grants.length) {
+ note = `<br><span class="muted">${e.grants.length} collaborator${e.grants.length === 1 ? "" : "s"} will be restored</span>`;
+ }
+
+ return ` <tr>
+ <td class="repo-name">${icon("git-branch", 13)} ${esc(e.name)}${note}</td>
+ <td class="mono">${fmtDate(e.deletedAt)}</td>
+ <td class="muted">${esc(e.deletedBy)}</td>
+ <td>${lifeLabel(e.deletedAt)}</td>
<td>
<form method="post" action="/settings/deleted/restore">
<input type="hidden" name="entry" value="${esc(e.entry)}">
@@ -1042,34 +1035,24 @@ export function deletedPage(opts: {
</form>
</td>
</tr>`;
- })
- .join("\n");
+ });
const retention =
opts.retentionDays > 0
? `Deleted repositories are kept for ${opts.retentionDays} days, then purged the next time you open this page.`
: `Deleted repositories are kept indefinitely — nothing is purged unless you do it here.`;
- const body = ` <h1 class="${c.pageTitle}">settings</h1>
-${settingsNav("deleted")}
- <h2 class="${c.sectionTitle}">${icon("trash")}recently deleted</h2>
- <p class="${c.repoDesc}">${esc(retention)} A deleted repository keeps its name reserved, so
+ const body = ` <h2 class="section-title">${icon("trash")}recently deleted</h2>
+ <p class="muted">${esc(retention)} A deleted repository keeps its name reserved, so
nothing new can take it until it is restored or purged.</p>
- <table>
- <thead>
- <tr><th>repository</th><th>deleted</th><th>by</th><th>retention</th><th></th><th></th></tr>
- </thead>
- <tbody>
-${rows || ` <tr><td colspan="6" class="${c.empty}">nothing deleted</td></tr>`}
- </tbody>
- </table>`;
+ ${table(["repository", "deleted", "by", "retention", "", ""], rows, "nothing deleted")}`;
- return layout({
+ return settingsLayout({
+ active: "deleted",
title: "recently deleted",
+ description: "Recover deleted repositories.",
user: opts.user,
body,
- description: "Recover deleted repositories.",
- noindex: true,
});
}
@@ -1077,10 +1060,9 @@ export function messagePage(opts: {
title: string;
message: string;
user: SessionUser | null;
- status?: number;
}): string {
- const body = ` <h1 class="${c.pageTitle}">${esc(opts.title)}</h1>
- <p class="${c.message}">${esc(opts.message)}</p>`;
+ const body = ` <h1 class="page-title">${esc(opts.title)}</h1>
+ <p class="muted">${esc(opts.message)}</p>`;
return layout({
title: opts.title,
user: opts.user,
diff --git a/tsconfig.json b/tsconfig.json
index 10fae4b..22d588f 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -11,5 +11,5 @@
"allowImportingTsExtensions": true,
"noEmit": true
},
- "include": ["src", "test", "scripts"]
+ "include": ["src", "test"]
}