Re-did changes that allowed newer Node.JS to work, change env example's ALL.NET port to 80
This commit is contained in:
parent
1ba8f9c7f2
commit
fe9ba87c70
@ -1,7 +1,7 @@
|
||||
POSTGRES_URL=postgresql://user:password@your-host:5432/database
|
||||
ALLNET_PORT=20080
|
||||
ALLNET_PORT=80
|
||||
MUCHA_PORT=10082
|
||||
SERVICE_PORT=9002
|
||||
API_PORT=9003
|
||||
OPENTELEMETRY_ENABLED=false
|
||||
OPENTELEMETRY_OTLP_URI=disregard-this
|
||||
OPENTELEMETRY_OTLP_URI=disregard-this
|
||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -9,4 +9,5 @@ key.pem
|
||||
config.json
|
||||
ecosystem.config.js
|
||||
static/*
|
||||
screenshot/*
|
||||
screenshot/*
|
||||
yarn.lock
|
||||
|
@ -118,10 +118,10 @@ let dirs = fs.readdirSync(path.join(path.dirname(__filename), 'modules'));
|
||||
for (let i of dirs)
|
||||
{
|
||||
// If the file is a .js file
|
||||
if (i.endsWith('.js'))
|
||||
if (i.endsWith('.js') || i.endsWith('.ts')) // if running directly from ts files
|
||||
{
|
||||
// Require the module file
|
||||
let mod = require(`./modules/${i.substring(0, i.length - 3)}`); // .js extension
|
||||
let mod = require(`./modules/${i.substring(0, i.length - 3)}`);
|
||||
|
||||
// Create an instance of the module
|
||||
let inst = new mod.default();
|
||||
@ -135,7 +135,7 @@ for (let i of dirs)
|
||||
app.use('/', appRouter);
|
||||
app.use('/wmmt6/', appRouter);
|
||||
|
||||
app.all('*', (req, res) => {
|
||||
app.all('*', (req, res) => {
|
||||
common.writeLog(`[ MAIN] ${req.method} ${req.url} is unhandled`);
|
||||
res.status(200).end();
|
||||
})
|
||||
@ -181,4 +181,4 @@ https.createServer({key, cert}, muchaApp).listen(PORT_MUCHA, '0.0.0.0', 511, ()
|
||||
// Create the game server
|
||||
https.createServer({key, cert}, app).listen(PORT_BNGI, '0.0.0.0', 511, () => {
|
||||
console.log(`Game server listening on port ${PORT_BNGI}!`);
|
||||
})
|
||||
})
|
||||
|
@ -12,7 +12,7 @@ import * as carFunctions from "./cars/functions";
|
||||
import * as terminal from "./terminal/check_car";
|
||||
|
||||
|
||||
export default class CarModule extends Module {
|
||||
export default class CarModule {
|
||||
register(app: Application): void {
|
||||
|
||||
// Load Car
|
||||
|
@ -16,7 +16,7 @@ import * as ghost from "./game/ghost";
|
||||
import * as versus from "./game/versus";
|
||||
|
||||
|
||||
export default class GameModule extends Module {
|
||||
export default class GameModule {
|
||||
register(app: Application): void {
|
||||
|
||||
// Saving the game result on mileage screen
|
||||
|
@ -42,10 +42,10 @@ export async function saveStoryResult(body: wm.protobuf.SaveGameResultRequest, c
|
||||
}
|
||||
|
||||
// If the lose bits are set, and are long data
|
||||
if (Long.isLong(storyResult.stLoseBits))
|
||||
if (Long.isLong(storyResult.stLoseBits) && storyResult && storyResult.stLoseBits)
|
||||
{
|
||||
// Convert them to BigInt and add to the data
|
||||
data.stLoseBits = common.getBigIntFromLong(storyResult.stLoseBits);
|
||||
data.stLoseBits = common.getBigIntFromLong(storyResult.stLoseBits as Long);
|
||||
stLoseBits = data.stLoseBits
|
||||
|
||||
// If a loss has been recorded
|
||||
|
@ -16,7 +16,7 @@ import * as ghost_trail from "./ghost/ghost_util/ghost_trail";
|
||||
import * as ghost_area from "./ghost/ghost_util/ghost_area";
|
||||
|
||||
|
||||
export default class GhostModule extends Module {
|
||||
export default class GhostModule {
|
||||
register(app: Application): void {
|
||||
|
||||
// Load Ghost Battle Info
|
||||
@ -307,10 +307,10 @@ export default class GhostModule extends Module {
|
||||
let actualSessionId: number = 0;
|
||||
|
||||
// If the session are set, and are long data
|
||||
if(Long.isLong(body.ghostSessionId))
|
||||
if(Long.isLong(body.ghostSessionId) && body && body.ghostSessionId)
|
||||
{
|
||||
// Convert them to BigInt and add to the data
|
||||
actualSessionId = common.getBigIntFromLong(body.ghostSessionId);
|
||||
actualSessionId = common.getBigIntFromLong(body.ghostSessionId as Long);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------
|
||||
|
@ -12,7 +12,7 @@ import * as ghost_ocm from "./ghost/ghost_ocm";
|
||||
import * as ghost_ocm_area from "./ghost/ghost_util/ghost_ocm_area";
|
||||
|
||||
|
||||
export default class GhostModule extends Module {
|
||||
export default class GhostModule {
|
||||
register(app: Application): void {
|
||||
|
||||
// Get OCM Battle event info
|
||||
|
@ -14,7 +14,7 @@ import * as crown_list from "./resource/crown_list";
|
||||
import * as ranking from "./resource/ranking";
|
||||
|
||||
|
||||
export default class ResourceModule extends Module {
|
||||
export default class ResourceModule {
|
||||
register(app: Application): void {
|
||||
|
||||
// Place List
|
||||
@ -74,7 +74,6 @@ export default class ResourceModule extends Module {
|
||||
|
||||
// Encode the response
|
||||
let message = wm.wm.protobuf.PlaceList.encode({places});
|
||||
|
||||
// Send the response to the client
|
||||
common.sendResponse(message, res, req.rawHeaders);
|
||||
})
|
||||
|
@ -9,7 +9,7 @@ import * as common from "./util/common";
|
||||
import * as startupFunctions from "./startup/functions";
|
||||
|
||||
|
||||
export default class StartupModule extends Module {
|
||||
export default class StartupModule {
|
||||
register(app: Application): void {
|
||||
|
||||
// Register system info upon booting
|
||||
|
@ -12,7 +12,7 @@ import * as scratch from "./terminal/scratch";
|
||||
import * as common from "./util/common";
|
||||
|
||||
|
||||
export default class TerminalModule extends Module {
|
||||
export default class TerminalModule {
|
||||
register(app: Application): void {
|
||||
|
||||
// Load upon enter terminal
|
||||
|
@ -9,7 +9,7 @@ import * as wm from "../wmmt/wm.proto";
|
||||
import * as common from "./util/common";
|
||||
|
||||
|
||||
export default class TimeAttackModule extends Module {
|
||||
export default class TimeAttackModule {
|
||||
register(app: Application): void {
|
||||
|
||||
// Load time Attack Record
|
||||
|
@ -11,7 +11,7 @@ import * as scratch from "./terminal/scratch";
|
||||
import * as common from "./util/common";
|
||||
|
||||
|
||||
export default class UserModule extends Module {
|
||||
export default class UserModule {
|
||||
register(app: Application): void {
|
||||
|
||||
// Load user data when entering the game or after tapping the bannapass card
|
||||
|
@ -88,7 +88,7 @@ export function sendResponse(message: Writer, res: Response, headers: string[])
|
||||
|
||||
// Send the response to the client
|
||||
r.send(Buffer.from(end));
|
||||
}
|
||||
}
|
||||
catch (e) // Failed to send response
|
||||
{
|
||||
writeLog(`Failed to send response: ${String(e)}`);
|
||||
@ -156,4 +156,4 @@ export async function writeLog(message: string) {
|
||||
catch {
|
||||
// Failed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,10 @@
|
||||
"strict": true,
|
||||
"lib": ["esnext"],
|
||||
"esModuleInterop": true,
|
||||
"allowJs": true
|
||||
"allowJs": true,
|
||||
"types":[
|
||||
"long"
|
||||
]
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["src/wmmt/**/*"]
|
||||
|
Loading…
x
Reference in New Issue
Block a user