UV Added! (Repl support not a given yet)

This commit is contained in:
QuiteAFancyEmerald 2022-02-28 15:17:03 -08:00
parent d70d202131
commit ec78402863
14 changed files with 772 additions and 199 deletions

View file

@ -7,7 +7,6 @@ import pkg from './routes.mjs';
import { paintSource, tryReadFile } from './randomization.mjs';
const bare = new Server('/bare/', '');
const config = JSON.parse(await readFile(new URL('./config.json',
import.meta.url)));
const { pages, text404 } = pkg;
@ -18,12 +17,10 @@ const router = express.Router();
const server = http.createServer(app);
router.get('/', async(req, res) => res.send(paintSource(tryReadFile(path.normalize(__dirname + '/views/' + (['/', '/?'].includes(req.url) ? pages.index : pages[Object.keys(req.query)[0]]))))));
app.use('/', (req, res, next) => {
if (!bare.route_request(req, res)) return next()
});
app.use(router);
app.use('/', (req, res, next) => {
if (!bare.route_request(req, res)) return next()
});
app.use(express.static(path.normalize(__dirname + '/views')));
app.disable('x-powered-by');
app.use((req, res) => {
@ -31,4 +28,4 @@ app.use((req, res) => {
});
server.listen(port);
console.log('Holy Unblocker is listening on port ' + port + '.');
console.log('Holy Unblocker is listening on port ' + port + '.');