#!/bin/bash git checkout server/src/app.ts sed -i '1i import fs from "fs";' server/src/app.ts sed -i '156,173d' server/src/app.ts cat << 'INNER_EOF' > patch_logs.ts app.get("/logs", (req, res) => { try { const logs = fs.readFileSync("/paperclip/bootstrap_logs.txt", "utf-8"); res.status(200).set("Content-Type", "text/plain").send(logs); } catch (e) { res.status(200).set("Content-Type", "text/plain").send("Logs not available yet or bootstrap hasn't run. Please refresh in a few seconds.\n\nError: " + String(e)); } }); INNER_EOF sed -i '/app.use(httpLogger);/r patch_logs.ts' server/src/app.ts