diff --git a/src/main.js b/src/main.js index 6cfd149..c516a49 100644 --- a/src/main.js +++ b/src/main.js @@ -274,6 +274,13 @@ http.createServer((req, res) => { res.end(tpl(data), 'utf-8'); }); } + else if(filePath == "./random") { + sql.query("select `id` from `f0ck`.`items` order by rand() limit 1", null, (err, rows, fields) => { + res.writeHead(301, { + Location: req.headers.host + '/' + rows[0][0].id + }); + }); + } else if(filePath == "./how") { var tpl = swig.compile(templates.how); res.writeHead(200, { 'Content-Type': 'text/html' });