initial commit

This commit is contained in:
ewin 2025-05-09 00:14:15 -04:00
commit cf8a823ad8
Signed by: erin
SSH key fingerprint: SHA256:clvLPaxKthBet+VUQTKQdDkjaqg2/KnYHQaPASp5pFE
4 changed files with 71 additions and 0 deletions

27
shit.mjs Normal file
View file

@ -0,0 +1,27 @@
import {appendFile, readFile} from 'node:fs/promises';
import {createServer} from 'node:http';
createServer(async (request, response) => {
const chat = new URL(`http://a${request.url}`).searchParams.get('chat');
if (chat) {
await appendFile('a.txt', `${chat}\n`, {flag: 'a+', encoding: 'utf8'});
response.writeHead(303, {location: '/'}).end(); // without query
} else {
response.writeHead(200, {
'content-type': 'text/html',
'refresh': '30', // lfmoa
}).end(
`<pre>${
(await readFile('a.txt', {flag: 'a+', encoding: 'utf8'}))
// ugh, fine, i'll html escape it. no xss for you
.replace(/[<>&'"]/g, match => ({
'<': '&lt;',
'>': '&gt;',
'&': '&amp;',
'\'': '&apos',
'"': '&quot;',
})[match])
}</pre><form><input type=text name=chat autofocus><button>send`
);
}
}).listen(process.env.PORT || 80, () => console.log(`hiiiii ^w^ hai hii :3`));