actually fix tabs

This commit is contained in:
sam 2024-02-29 17:05:40 +13:00
parent af0b68eadc
commit 1cc5508506
2 changed files with 16 additions and 16 deletions

View file

@ -1,8 +1,8 @@
<head>
<title>noscript discord</title>
<link rel="stylesheet" href="/style.css">
<title>noscript discord</title>
<link rel="stylesheet" href="/style.css">
</head>
<body>
<div class="container">
<form action="/send"><input type="text" name="content" /></form>
<div class="messages">
<form action="/send"><input type="text" name="content" target="_blank" /></form>
<div class="messages">

View file

@ -17,28 +17,28 @@ app.get("/send", async (req, res) => {
});
app.get("/channels/:channel", async (req, res) => {
channel = await client.channels.fetch(req.params.channel);
resStream = res;
resStream.writeHead(200, {
"Content-Type": "text/html",
});
channel = await client.channels.fetch(req.params.channel);
resStream = res;
resStream.writeHead(200, {
"Content-Type": "text/html",
});
resStream.write(readFileSync("pages/index.html"));
resStream.write(readFileSync("pages/index.html"));
(await channel.messages.search()).messages.reverse().each(msg => {
resStream.write(constructMessage(msg));
});
});
function constructMessage(msg) {
return `<div>
<span>${msg.author.username}</span>: ${msg.content}
</div>`;
return `<div>
<span>${msg.author.username}</span>: ${msg.content}
</div>`;
}
client.on("messageCreate", (msg) => {
if(!resStream || !channel || msg.channel.id !== channel.id) return;
resStream.write(constructMessage(msg));
if(!resStream || !channel || msg.channel.id !== channel.id) return;
resStream.write(constructMessage(msg));
});
app.listen(cfg.port);