set up for matrix

This commit is contained in:
zoop 2026-09-08 19:29:17 -04:00
parent c12b9f47fd
commit 2a0f022e3f
No known key found for this signature in database
GPG Key ID: 15C0D336C9E08F3F
26 changed files with 86 additions and 181 deletions

View File

@ -1,22 +1,15 @@
import { defineConfig } from 'astro/config';
import cloudflare from '@astrojs/cloudflare';
export default defineConfig({
output: 'server',
adapter: cloudflare({
platformProxy: { enabled: true },
}),
vite: {
server: {
watch: {
ignored: ['**/.wrangler/**', '**/.dev.vars', '**/.mf/**'],
},
},

View File

@ -0,0 +1 @@
{"m.homeserver":{"base_url":"https://continuwuity.zachy.cc"}}

View File

@ -0,0 +1 @@
{"m.server":"continuwuity.zachy.cc:443"}

4
public/_headers Normal file
View File

@ -0,0 +1,4 @@
/.well-known/matrix/*
Content-Type: application/json
Access-Control-Allow-Origin: *
Cache-Control: public, max-age=3600

View File

@ -1,24 +1,4 @@
#!/usr/bin/env node
import { execFileSync } from "node:child_process";
import {
@ -53,7 +33,6 @@ const LOADER_BY_EXT = {
".jsx": "jsx", ".tsx": "tsx",
};
const KW_REGEX = new Set([
"return", "typeof", "instanceof", "in", "of", "yield", "await", "case",
"delete", "void", "throw", "new", "do", "else",
@ -77,10 +56,6 @@ process.on("SIGINT", () => {
});
function stripJs(code, { lineComments = true, stats } = {}) {
const out = [];
const n = code.length;
@ -91,15 +66,44 @@ function stripJs(code, { lineComments = true, stats } = {}) {
let inClass = false;
let lastSig = "";
let lastWord = "";
let lineStart = 0;
let lineContentEnd = 0;
let skipTerminator = false;
const truncateTo = (idx) => {
out.length = idx;
lastSig = "";
lastWord = "";
for (let j = idx - 1; j >= 0; j--) {
const ch = out[j];
if (/\s/.test(ch)) continue;
lastSig = ch;
let k = j;
while (k >= 0 && /[A-Za-z0-9_$]/.test(out[k])) k--;
lastWord = out.slice(k + 1, j + 1).join("");
break;
}
};
const emit = (s) => {
for (const ch of s) {
out.push(ch);
if (/\s/.test(ch)) continue;
if (ch === "\n") {
lineStart = lineContentEnd = out.length;
} else if (/\s/.test(ch)) {
} else {
lastSig = ch;
if (/[A-Za-z0-9_$]/.test(ch)) lastWord += ch;
else lastWord = "";
lineContentEnd = out.length;
}
}
};
const nextOnLine = (idx) => {
while (idx < n && (code[idx] === " " || code[idx] === "\t" || code[idx] === "\r")) idx++;
if (idx >= n || code[idx] === "\n") return "";
return code[idx];
};
while (i < n) {
@ -107,8 +111,20 @@ function stripJs(code, { lineComments = true, stats } = {}) {
const nx = code[i + 1];
switch (state) {
case "code":
if (skipTerminator && (c === "\r" || c === "\n")) {
skipTerminator = false;
if (c === "\r" && nx === "\n") i += 2;
else i++;
break;
}
if (c === "/" && nx === "/" && lineComments) {
if (stats) stats.removed++;
if (lineContentEnd === lineStart) {
truncateTo(lineStart);
skipTerminator = true;
} else {
truncateTo(lineContentEnd);
}
state = "line";
i += 2;
} else if (c === "/" && nx === "*") {
@ -156,7 +172,11 @@ function stripJs(code, { lineComments = true, stats } = {}) {
case "line":
if (c === "\r" || c === "\n") {
if (c === "\r" && nx === "\n") {
if (skipTerminator) {
skipTerminator = false;
if (c === "\r" && nx === "\n") i += 2;
else i++;
} else if (c === "\r" && nx === "\n") {
emit("\r\n");
i += 2;
} else {
@ -171,9 +191,19 @@ function stripJs(code, { lineComments = true, stats } = {}) {
case "block":
if (c === "*" && nx === "/") {
emit(" ");
i += 2;
state = "code";
if (lineContentEnd === lineStart) {
truncateTo(lineStart);
skipTerminator = nextOnLine(i) === "";
} else {
truncateTo(lineContentEnd);
const prev = out[lineContentEnd - 1];
const next = nextOnLine(i);
if (prev !== undefined && next && /[A-Za-z0-9_$'"`]/.test(prev) && /[A-Za-z0-9_$'"`]/.test(next)) {
emit(" ");
}
}
} else {
i++;
}
@ -239,8 +269,6 @@ function stripCss(code, stats) {
return stripJs(code, { lineComments: false, stats });
}
function stripAstro(code, stats, parts) {
let rest = code;
let head = "";
@ -304,9 +332,6 @@ function stripAstro(code, stats, parts) {
}
function collect() {
const out = [];
const walk = (dir) => {
@ -343,8 +368,6 @@ function stripFile(rel) {
return { rel, src, out, stats, parts, changed: src !== out };
}
async function validate(r) {
const problems = [];
for (const { code, loader, label } of r.parts) {
@ -365,9 +388,6 @@ async function validate(r) {
}
async function main() {
if (DRY) {
console.log("dry run — stripping in memory, touching nothing\n");
@ -424,8 +444,6 @@ async function main() {
try {
execFileSync("git", ["add", "-A"], { stdio: "inherit" });
let hasChanges = true;
try {
execFileSync("git", ["diff", "--cached", "--quiet"], { stdio: "pipe" });

View File

@ -12,7 +12,6 @@ function mulberry32(a) {
}
const rand = mulberry32(20260906);
const shades = [
[0x60, 0x47, 0x2b],
[0x6b, 0x4f, 0x30], [0x6b, 0x4f, 0x30], [0x6b, 0x4f, 0x30],
@ -26,10 +25,8 @@ const grid = new Array(W * H);
const wrap = (v, m) => ((v % m) + m) % m;
const idx = (x, y) => wrap(y, H) * W + wrap(x, W);
for (let i = 0; i < W * H; i++) grid[i] = shades[Math.floor(rand() * shades.length)];
for (let pass = 0; pass < 3; pass++) {
const next = grid.slice();
for (let y = 0; y < H; y++)
@ -43,7 +40,6 @@ for (let pass = 0; pass < 3; pass++) {
for (let i = 0; i < W * H; i++) grid[i] = next[i];
}
const dark = [0x40, 0x2e, 0x1b];
const darker = [0x33, 0x24, 0x14];
const light = [0x9c, 0x7c, 0x54];

View File

@ -1,5 +1,3 @@
import { execFileSync } from "node:child_process";
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
import { tmpdir } from "node:os";
@ -14,7 +12,6 @@ try {
const pngs = [];
for (const s of sizes) {
const out = join(tmp, `${s}.png`);
await sharp(svg, { density: 384 })
.resize(s, s, { fit: "contain", background: { r: 0, g: 0, b: 0, alpha: 0 } })
.png()
@ -22,7 +19,6 @@ try {
pngs.push(out);
}
execFileSync("magick", [...pngs, "public/favicon.ico"], { stdio: "inherit" });
console.log(`wrote public/favicon.ico (${sizes.join(", ")} px)`);
} finally {

View File

@ -1,12 +1,3 @@
import { createServer } from "node:http";
import { appendFileSync, readFileSync, writeFileSync, existsSync } from "node:fs";
@ -71,7 +62,6 @@ const server = createServer(async (req, res) => {
`SPOTIFY_CLIENT_SECRET=${clientSecret}\n` +
`SPOTIFY_REFRESH_TOKEN=${data.refresh_token}\n`;
if (existsSync(".dev.vars")) {
const cur = readFileSync(".dev.vars", "utf8").replace(/^SPOTIFY_[A-Z_]+=.*$/gm, "").replace(/\n{3,}/g, "\n\n");
writeFileSync(".dev.vars", cur.trimEnd() + "\n" + block);

View File

@ -3,14 +3,12 @@ import { buttons, site } from "../data/site";
import CopyText from "./CopyText.astro";
import Egg from "./Egg.astro";
const rnd = (i: number, seed: number) => {
const x = Math.sin((i + 1) * 127.1 + seed * 311.7) * 43758.5453;
return x - Math.floor(x);
};
const r1 = (i: number, seed: number, spread: number) =>
Math.round((rnd(i, seed) - 0.5) * spread * 100) / 100;
const PINS = [
["#ff9a9a", "#d64545", "#7a1f1f"],
["#9ec9ff", "#4a7fd6", "#1f3f7a"],
@ -18,7 +16,6 @@ const PINS = [
["#a8e6b0", "#4caf68", "#1f5c33"],
["#d9b8ff", "#9a6cff", "#4a2f8a"],
];
const scatter = (i: number) => {
const [pl, pb, pd] = PINS[i % PINS.length];
return `--t:${r1(i, 1, 12)}deg;--x:${r1(i, 2, 14)}px;--y:${r1(i, 3, 12)}px;--pl:${pl};--pb:${pb};--pd:${pd}`;
@ -132,7 +129,6 @@ const badgeUrl = `https://${site.domain}/badges/zachy.gif`;
</section>
<style>
.badges__trigger {
display: flex;
align-items: center;
@ -191,7 +187,6 @@ const badgeUrl = `https://${site.domain}/badges/zachy.gif`;
border-radius: 3px;
}
.wall {
margin: auto;
width: min(34rem, calc(100vw - 1.5rem));
@ -261,7 +256,6 @@ const badgeUrl = `https://${site.domain}/badges/zachy.gif`;
min-width: 0;
}
.pile {
display: flex;
flex-wrap: wrap;
@ -272,7 +266,6 @@ const badgeUrl = `https://${site.domain}/badges/zachy.gif`;
margin: 0.9rem;
padding: 2.6rem 1.8rem 2.1rem;
border-radius: 4px;
background-color: #6b4f30;
background-image:
radial-gradient(120% 80% at 50% 0%, rgba(0, 0, 0, 0) 52%, rgba(0, 0, 0, 0.32) 100%),
@ -295,7 +288,6 @@ const badgeUrl = `https://${site.domain}/badges/zachy.gif`;
transform: translate(var(--x), var(--y)) rotate(var(--t));
transition: transform 0.4s cubic-bezier(0.17, 0.89, 0.32, 1.28);
}
.badge::before {
content: "";
position: absolute;
@ -320,7 +312,6 @@ const badgeUrl = `https://${site.domain}/badges/zachy.gif`;
.badge:hover,
.badge:focus-visible {
z-index: 3;
transform: translate(var(--x), calc(var(--y) - 5px)) rotate(0deg) scale(1.2);
}
.badge:hover::before,
@ -385,8 +376,6 @@ const badgeUrl = `https://${site.domain}/badges/zachy.gif`;
const open = document.querySelector<HTMLButtonElement>("[data-badges-open]");
const close = document.querySelector<HTMLButtonElement>("[data-badges-close]");
let embedsLoaded = false;
const loadEmbeds = () => {
if (embedsLoaded) return;
@ -403,7 +392,6 @@ const badgeUrl = `https://${site.domain}/badges/zachy.gif`;
});
close?.addEventListener("click", () => dialog?.close());
dialog?.addEventListener("click", (e) => {
if (e.target === dialog) dialog.close();
});

View File

@ -56,7 +56,6 @@ const isExt = (href: string) => href.startsWith("http");
grid-auto-rows: 3.75rem;
gap: 8px;
}
.bx__cell--email {
grid-column: span 4;
}
@ -101,7 +100,6 @@ const isExt = (href: string) => href.startsWith("http");
background 0.18s ease,
box-shadow 0.24s ease;
}
.bx__cell:hover .bx__item,
.bx__cell:focus-within .bx__item {
transform: scale(1.06);
@ -138,7 +136,6 @@ const isExt = (href: string) => href.startsWith("http");
fill: var(--ink);
}
.bx__name {
font-family: var(--serif);
font-size: 1rem;
@ -172,7 +169,6 @@ const isExt = (href: string) => href.startsWith("http");
opacity: 1;
}
.bx__more {
position: absolute;
left: 0;
@ -217,7 +213,6 @@ const isExt = (href: string) => href.startsWith("http");
text-wrap: pretty;
}
@media (max-width: 34rem) {
.bx {
display: flex;

View File

@ -179,7 +179,6 @@ const rows: Row[] = [
.finger a:hover .term__out {
color: var(--accent-2);
}
.finger dd :global(.copy) {
font-size: 1em;
}

View File

@ -3,7 +3,6 @@ interface Props {
value: string;
display?: string;
label?: string;
event?: string;
}
const { value, display = value, label = `copy ${value}`, event } = Astro.props;

View File

@ -1,6 +1,4 @@
---
interface Props {
note: string;
align?: "left" | "right";

View File

@ -1,7 +1,5 @@
---
---
<div class="music">
@ -86,7 +84,6 @@
<style is:global>
.music {
margin-top: var(--gap);
}
@ -171,7 +168,6 @@
transform: translateX(0.25em);
}
.music-wall {
margin: auto;
width: min(24rem, calc(100vw - 1.5rem));
@ -234,7 +230,6 @@
margin-bottom: 0.7rem;
}
.np {
width: 100%;
border: 1px solid var(--faint);
@ -336,7 +331,6 @@
transition: width 1s linear;
}
.mosaic {
display: grid;
grid-template-columns: repeat(4, 1fr);

View File

@ -1,15 +1,12 @@
export const site = {
name: "zach",
wordmark: "ZACH",
domain: "zachy.cc",
version: "v3.0.1",
tagline: "cool things for the web",
description:
"i make cool things sometimes.",
bio: "call me zoop, i like to make cool projects, and my website is one of them :).",
email: "hi@zachy.cc",
availability: "poking at new projects for early 2026.",
@ -19,8 +16,6 @@ export const elsewhere = [
{ label: "status", href: "https://status.zachy.cc", external: true },
] as const;
export const socials = [
{
label: "email",
@ -75,8 +70,6 @@ export const webrings = {
},
};
export const buttons = [
{ label: "zachy.cc", img: "/badges/zachy.gif", still: "/badges/zachy.png", href: null },
{ label: "powered by fedora", img: "/badges/fedora.gif", still: null, href: "https://fedoraproject.org/" },

View File

@ -18,9 +18,6 @@ const {
const path = Astro.url.pathname;
const canonical = new URL(path, `https://${site.domain}`).href;
const KAO_DEADLINE = "2027-01-01T00:00:00";
const kaoMs = new Date(KAO_DEADLINE).getTime() - Date.now();
const kaoCount = kaoMs > 0 ? `${Math.floor(kaoMs / 86_400_000)}d` : "in effect";
@ -128,7 +125,6 @@ const kaoCount = kaoMs > 0 ? `${Math.floor(kaoMs / 86_400_000)}d` : "in effect";
</main>
<script>
const mark = document.querySelector(".mark");
const still = window.matchMedia("(prefers-reduced-motion: reduce)");
if (mark && !still.matches) {
@ -140,7 +136,6 @@ const kaoCount = kaoMs > 0 ? `${Math.floor(kaoMs / 86_400_000)}d` : "in effect";
setTimeout(sweep, 4000 + Math.random() * 4000);
}
document
.querySelector("[data-ribbon-dismiss]")
?.addEventListener("click", () => {
@ -150,7 +145,6 @@ const kaoCount = kaoMs > 0 ? `${Math.floor(kaoMs / 86_400_000)}d` : "in effect";
} catch (e) {}
});
const kaoEl = document.querySelector("[data-kao-count]");
if (kaoEl instanceof HTMLElement && kaoEl.dataset.kaoDeadline) {
const target = new Date(kaoEl.dataset.kaoDeadline).getTime();

View File

@ -1,6 +1,3 @@
import { env as cfEnv } from "cloudflare:workers";
export interface Note {
@ -25,8 +22,6 @@ export const DEFAULT_NOTE: Note = {
date: "2026-09-06T00:00:00.000Z",
};
export const DEFAULT_PROJECTS: Project[] = [
{
id: "drop",
@ -175,7 +170,6 @@ export async function getNote(): Promise<Note> {
return { body: n.body, date: n.date ?? new Date().toISOString() };
}
} catch {
return { body: raw, date: new Date().toISOString() };
}
return DEFAULT_NOTE;

View File

@ -1,8 +1,4 @@
const esc = (s: string) =>
s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
@ -30,7 +26,6 @@ export function renderMarkdown(src: string): string {
continue;
}
if (line.trim().startsWith("```")) {
const buf: string[] = [];
i++;
@ -43,7 +38,6 @@ export function renderMarkdown(src: string): string {
continue;
}
const h = line.match(/^(#{2,4})\s+(.*)$/);
if (h) {
const level = h[1].length;
@ -52,7 +46,6 @@ export function renderMarkdown(src: string): string {
continue;
}
if (/^\s*[-*]\s+/.test(line)) {
const items: string[] = [];
while (i < lines.length && /^\s*[-*]\s+/.test(lines[i])) {
@ -63,7 +56,6 @@ export function renderMarkdown(src: string): string {
continue;
}
const para: string[] = [];
while (
i < lines.length &&

View File

@ -1,5 +1,3 @@
import { env as cfEnv } from "cloudflare:workers";
const COOKIE = "admin_session";
@ -11,7 +9,6 @@ function secrets(): Record<string, string | undefined> {
try {
worker = cfEnv as any;
} catch {
}
return { ...node, ...worker };
}

View File

@ -29,7 +29,6 @@ const routes = ["projects", "notes", "contact"];
const fof = document.querySelector<HTMLElement>(".fof");
const reduce = window.matchMedia("(prefers-reduced-motion: reduce)");
if (fof && !reduce.matches) {
fof.classList.add("fof--running");
window.setTimeout(() => fof.classList.remove("fof--running"), 550);
}

View File

@ -1,14 +1,9 @@
import type { APIRoute } from "astro";
import { env as cfEnv } from "cloudflare:workers";
export const prerender = false;
type Env = Record<string, string | undefined>;
interface Track {
@ -34,7 +29,6 @@ function getEnv(): Env {
try {
workerEnv = cfEnv as unknown as Env;
} catch {
}
return { ...nodeEnv, ...workerEnv };
}
@ -87,7 +81,6 @@ async function nowPlaying(token: string): Promise<NowPlaying | null> {
}
}
res = await fetch(`${API}/me/player/recently-played?limit=1`, {
headers: { Authorization: `Bearer ${token}` },
});

View File

@ -3,7 +3,6 @@ import Base from "../layouts/Base.astro";
import { getNote } from "../lib/content";
import { renderMarkdown } from "../lib/md";
const note = await getNote();
const html = note.body.trim() ? renderMarkdown(note.body) : "";

View File

@ -2,7 +2,6 @@
import Base from "../layouts/Base.astro";
import { getProjects } from "../lib/content";
const projects = (await getProjects()).filter((p) => !p.draft);
---

View File

@ -1,5 +1,4 @@
interface Track {
title: string;
artist: string;
@ -143,7 +142,6 @@ async function load(): Promise<void> {
if (data.nowPlaying) renderNowPlaying(data.nowPlaying as NP);
if (Array.isArray(data.top)) renderTop(data.top as Track[]);
const trigger = document.querySelector<HTMLButtonElement>(".music__trigger");
if (trigger && (data.nowPlaying || (Array.isArray(data.top) && data.top.length))) {
trigger.hidden = false;

View File

@ -1,14 +1,11 @@
@import "@fontsource-variable/newsreader";
@import "@fontsource-variable/newsreader/wght-italic.css";
@import "@fontsource-variable/jetbrains-mono";
@import "@fontsource/unbounded/900.css";
:root {
color-scheme: dark;
--paper: #1b1a18;
--paper-2: #232220;
--ink: #e7e3dc;
@ -19,7 +16,6 @@
--accent-2: #5ea0ff;
--star: #ffab5e;
--grad: linear-gradient(
90deg,
rgb(255, 224, 138),
@ -40,7 +36,6 @@
--gap: 2.5rem;
}
*,
*::before,
*::after {
@ -97,7 +92,6 @@ img {
display: none !important;
}
.skip {
position: absolute;
left: -9999px;
@ -123,7 +117,6 @@ img {
border: 0;
}
.ribbon {
display: flex;
align-items: stretch;
@ -208,7 +201,6 @@ img {
background: rgba(255, 255, 255, 0.03);
}
.topbar {
margin: 0 0 clamp(2rem, 5vw, 3rem);
display: flex;
@ -231,14 +223,12 @@ img {
background-position: 0% 50%;
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: currentColor;
transition:
-webkit-text-fill-color 0.4s ease,
background-position 0.9s ease;
user-select: none;
}
.mark:hover,
.mark:focus-visible,
.mark.is-sweeping {
@ -263,7 +253,6 @@ img {
color: var(--muted);
}
.section {
margin-top: var(--gap);
}
@ -280,7 +269,6 @@ img {
letter-spacing: 0.06em;
}
.intro {
margin-bottom: var(--gap);
}
@ -298,7 +286,6 @@ img {
text-wrap: pretty;
}
.pagenav {
display: flex;
flex-wrap: wrap;
@ -329,7 +316,6 @@ img {
transform: translate(0.22em, -0.22em);
}
.contact .avail {
color: var(--muted);
font-size: 0.95rem;
@ -358,7 +344,6 @@ img {
display: block;
}
.copy {
font-family: var(--mono);
font-size: 0.9em;
@ -434,7 +419,6 @@ img {
opacity: 1;
}
.colophon {
display: flex;
align-items: center;
@ -462,7 +446,6 @@ img {
color: var(--accent);
}
.backlink {
font-family: var(--mono);
font-size: 0.78rem;
@ -475,7 +458,6 @@ img {
color: var(--accent);
}
@media (prefers-reduced-motion: reduce) {
* {
animation-duration: 0.001ms !important;

View File

@ -5,7 +5,6 @@
"global_fetch_strictly_public"
],
"name": "website-v3",
"account_id": "5745d698d83c15e655924b25248a3029",
"main": "@astrojs/cloudflare/entrypoints/server",
"assets": {
@ -15,8 +14,6 @@
"observability": {
"enabled": true
},
"routes": [
{
"pattern": "zachy.cc",
@ -27,14 +24,10 @@
}
],
"kv_namespaces": [
{
"binding": "CONTENT",
"id": "96b661e1818f4773acd2a3a1b39c58b0"
},
{
"binding": "SESSION",
"id": "8d6df673f9934c1e9d15cfb4de09daac"