// builds stash and deploys it to the PDS via wisp. the OAuth client_id is the // hosted metadata under the site root, so the origin is fixed here. import { $ } from "bun"; const HANDLE = process.env.WISP_HANDLE ?? "zzstoatzz.io"; const SITE = process.env.WISP_SITE ?? "stash"; const base = process.env.STASH_BASE ?? "https://stash.waow.tech/"; // must match SCOPE in src/oauth.ts const SCOPE = "atproto " + "space:tech.waow.stash.space?authority=self&skey=self&collection=tech.waow.stash.file" + "&action=read&action=create&action=update&action=delete&manage=create " + "blob:*/*"; const metadata = { client_id: `${base}oauth-client-metadata.json`, client_name: "stash", client_uri: base, redirect_uris: [base], scope: SCOPE, grant_types: ["authorization_code", "refresh_token"], response_types: ["code"], token_endpoint_auth_method: "none", application_type: "web", dpop_bound_access_tokens: true, }; await Bun.write("public/oauth-client-metadata.json", JSON.stringify(metadata, null, 2)); await $`bun run build`; await $`wispctl deploy ${HANDLE} --path ./dist --site ${SITE} --spa --yes`; console.log(`deployed → ${base}`);