2022-07-11 08:22:41 +01:00
|
|
|
// Bayshore - a Wangan Midnight Maximum Tune 6 private server.
|
|
|
|
// Made with love by Luna, and part of Project Asakura.
|
|
|
|
|
2022-07-11 08:38:33 +01:00
|
|
|
import express from 'express';
|
2022-07-11 08:22:41 +01:00
|
|
|
import {PrismaClient} from '@prisma/client';
|
2022-07-11 11:45:36 +01:00
|
|
|
import https, {globalAgent} from 'https';
|
2022-07-11 08:38:33 +01:00
|
|
|
import fs from 'fs';
|
2022-07-11 11:45:36 +01:00
|
|
|
import bodyParser from 'body-parser';
|
|
|
|
globalAgent.options.keepAlive = true;
|
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
require('http').globalAgent.options.keepAlive = true;
|
2022-07-11 08:38:33 +01:00
|
|
|
|
|
|
|
const app = express();
|
2022-07-11 11:45:36 +01:00
|
|
|
app.use(bodyParser.raw({
|
|
|
|
type: '*/*'
|
|
|
|
}));
|
2022-07-11 08:38:33 +01:00
|
|
|
|
2022-07-11 13:43:39 +01:00
|
|
|
app.use((req, res, next) => {
|
|
|
|
console.log(`${req.method} ${req.url}`);
|
|
|
|
next()
|
|
|
|
});
|
|
|
|
|
2022-07-11 09:15:30 +01:00
|
|
|
let dirs = fs.readdirSync('dist/modules');
|
|
|
|
for (let i of dirs) {
|
|
|
|
if (i.endsWith('.js')) {
|
|
|
|
let mod = require(`./modules/${i.substring(0, i.length - 3)}`); // .js extension
|
|
|
|
let inst = new mod.default();
|
|
|
|
inst.register(app);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
app.all('*', (req, res) => {
|
2022-07-11 15:19:36 +01:00
|
|
|
res.status(200).end();
|
2022-07-11 09:15:30 +01:00
|
|
|
})
|
|
|
|
|
2022-07-11 08:38:33 +01:00
|
|
|
https.createServer({
|
2022-07-11 13:43:39 +01:00
|
|
|
key: fs.readFileSync('./server_wangan.key'),
|
|
|
|
cert: fs.readFileSync('./server_wangan.crt')
|
2022-07-11 08:38:33 +01:00
|
|
|
}, app).listen(9002, () => {
|
|
|
|
console.log('Server listening on port 9002!');
|
2022-07-11 13:43:39 +01:00
|
|
|
})
|