Spaces:
Runtime error
Runtime error
File size: 688 Bytes
0872831 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | app.get("/url", (req, res) => {
try {
if (fs.existsSync("/paperclip/bootstrap_logs.txt")) {
const logs = fs.readFileSync("/paperclip/bootstrap_logs.txt", "utf-8");
const match = logs.match(/https?:\/\/[^\s]+/);
if (match) {
res.status(200).set("Content-Type", "text/plain").send(match[0]);
} else {
res.status(200).set("Content-Type", "text/plain").send("URL not found in logs yet.");
}
} else {
res.status(200).set("Content-Type", "text/plain").send("Logs not available yet.");
}
} catch (e) {
res.status(500).set("Content-Type", "text/plain").send("Error: " + String(e));
}
});
|