atproto pastebin service: https://plonk.li

fix nix builds

+12
flake.nix
··· 23 23 buildNpmPackage { 24 24 inherit pname version; 25 25 src = ./.; 26 + nativeBuildInputs = [makeBinaryWrapper]; 26 27 packageJson = ./package.json; 27 28 buildPhase = "npm run build"; 29 + installPhase = '' 30 + runHook preInstall 31 + 32 + mkdir -p $out/bin 33 + cp -r ./* $out/ 34 + 35 + makeBinaryWrapper ${nodejs}/bin/node $out/bin/$pname \ 36 + --prefix PATH : ${lib.makeBinPath [nodejs]} \ 37 + --add-flags "$out/dist/index.js" 38 + ''; 39 + 28 40 npmDepsHash = "sha256-qGCbaFAHd/s9hOTWMjHCam6Kf6pU6IWPybfwYh0sOwc="; 29 41 }; 30 42 };
+3
package.json
··· 49 49 "!src/**/__tests__/**", 50 50 "!src/**/*.test.*" 51 51 ], 52 + "loader": { 53 + ".pug": "copy" 54 + }, 52 55 "splitting": false, 53 56 "sourcemap": true, 54 57 "clean": true
+1 -1
src/index.ts
··· 29 29 public app: express.Application, 30 30 public server: http.Server, 31 31 public ctx: Ctx, 32 - ) { } 32 + ) {} 33 33 34 34 static async create() { 35 35 const db: Database = createDb(env.PLONK_DB_PATH);
+6 -9
src/routes.ts
··· 16 16 did: string; 17 17 }; 18 18 19 - async function getSession(req: IncomingMessage, res: ServerResponse<IncomingMessage>) { 19 + async function getSession( 20 + req: IncomingMessage, 21 + res: ServerResponse<IncomingMessage>, 22 + ) { 20 23 return await getIronSession<Session>(req, res, { 21 24 cookieName: "plonk-id", 22 25 password: env.PLONK_COOKIE_SECRET, 23 26 cookieOptions: { 24 - secure: env.PLONK_NODE_ENV === 'production', 27 + secure: env.PLONK_NODE_ENV === "production", 25 28 }, 26 - }) 29 + }); 27 30 } 28 31 29 32 async function getSessionAgent( ··· 45 48 46 49 export const createRouter = (ctx: Ctx) => { 47 50 const router = express.Router(); 48 - 49 - // Static assets 50 - router.use( 51 - "/public", 52 - express.static(path.join(__dirname, "pages", "public")), 53 - ); 54 51 55 52 // OAuth metadata 56 53 router.get("/client-metadata.json", async (_req, res) => {
-12
tsup.config.ts
··· 1 - import { defineConfig } from "tsup"; 2 - 3 - export default defineConfig({ 4 - entry: ["src/index.ts"], 5 - outDir: "dist", 6 - clean: true, 7 - format: "esm", 8 - target: "node18", 9 - dts: true, 10 - minify: true, 11 - sourcemap: true, 12 - });