const config = require('./config'); const apiRoute = require('./api/v1'); const express = require('express'); const cookieParser = require('cookie-parser'); const cors = require('cors') const http = require('http'); const { authenticateEndpoint } = require('./api/v1/authfunctions'); const GatewayServer = require('./api/v1/gateway/index'); const app = express(); const httpServer = http.createServer(app); const gateway = new GatewayServer(httpServer); app.use(express.urlencoded({ extended: false })); app.use(express.json()); app.use(cookieParser()); app.use(cors({ origin: function (origin, callback) { if (config.corsAllowList.indexOf(origin) !== -1) { callback(null, true); } else { callback(new Error('Not allowed by CORS')); } }, credentials: true, optionsSuccessStatus: 200 })); app.use('/api/v1', apiRoute); app.use(express.static('app')); app.get('/', authenticateEndpoint((req, res, user) => { res.redirect('/app.html'); }, '/auth.html')); app.get('/admin', (req, res) => { res.send('Keanu chungus wholesome 100 reddit moment 😀i beat up a kid that said minecraft bad 😂and my doggo bit him so i gave him snaccos😉 and we watched pewdiepie together while in elon musk’s cyber truck 😳talking about how superior reddit memers are : “haha emojis bad” 😲i said and keanu reeves came outta nowhere and said “this is wholesome 100, updoot this wholesome boy” 😗so i got alot of updoots and edit: thanks for the gold kind stranger😣. but the kind stranger revealed himself to be baby yoda eating chiccy nuggies😨 and drinking choccy milk😎 so we went to the cinema to see our (communism funny) favorite movies avengers endgame😆 but then thor played fortnite and fortnite bad😡, so then i said “reality is often dissappointing” and then baby yoda replied r/unexpectedthanos and i replied by r/expectedthanos😖 for balance and then danny devito came to pick us up from the cinema😩 and all the insta normies and gay mods stood watching😵 ,as we,superior redditors went home with danny devito to suck on his magnum dong😫 but i said no homo and started sucking,not like those gay mods😮,then the next morning we woke up to MrBeast telling us to plant 69420 million trees😌, me, baby yoda and danny said nice, and then on our way to plant 69420 million trees😊 (nice) we saw a kid doing a tiktok so keanu reeves appeared and said “we have a kid to burn” and i replied “you’re breathtaking”😄 so i said “i need a weapon” and baby yoda gave me an RPG so i blew the kid (DESTRUCTION 100)😎 and posted it on r/memes and r/dankmemes and r/pewdiepiesubmissions and got 1000000000 updoots😘,i’m sure pewds will give me a big pp, then we shat on emoji users😂😂 and started dreaming about girls that will never like me😢 and posted a lie on r/teenagers about how i got a GF after my doggo died by the hands of fortnite players😳 so i exploited his death for updoots😜, but i watched the sunset with the wholesome gang😁 (keanu,danny,Mrbeast, pewds, spongebob,stefan karl , bob ross, steve irwin, baby yoda and other artists that reddit exploits them) [Everyone liked that] WHOLESOME 100 REDDIT 100🤡'); }); const onServerClosing = (evt) => { gateway.notifyClientsOfUpdate('exit'); process.exit(); }; ['exit', 'SIGINT', 'SIGUSR1', 'SIGUSR2', 'uncaughtException', 'SIGTERM'].forEach((eventType) => { process.on(eventType, onServerClosing.bind(null, eventType)); }) httpServer.listen(config.ports.mainServerPort, () => { console.log(`[*] [server] Main server is listening on port ${config.ports.mainServerPort}`); });