1
0
mirror of https://github.com/shiroikitsu8/Bayshore_6r_legacy.git synced 2024-12-01 10:37:28 +01:00
This commit is contained in:
Rin 2022-07-13 18:09:13 +01:00
parent 4c86e1a0df
commit 431b5681df
5 changed files with 13 additions and 8 deletions

View File

@ -1,4 +1,6 @@
{
"shopName": "Bayshore",
"shopNickname": "BSH"
"shopNickname": "BSH",
"regionName": "Bayshore",
"serverIp": "127.0.0.1"
}

View File

@ -6,8 +6,8 @@ import iconv from "iconv-lite";
import { Config } from "./config";
// TODO: Move this into the config
const STARTUP_URI = "https://localhost:9002";
const STARTUP_HOST = "localhost:9002";
const STARTUP_URI = `https://${Config.getConfig().serverIp || "localhost"}:9002`;
const STARTUP_HOST = `${Config.getConfig().serverIp || "localhost"}:9002`;
export default class AllnetModule extends Module {
register(app: Application): void {
@ -71,6 +71,7 @@ export default class AllnetModule extends Module {
let shopName = Config.getConfig().shopName;
let shopNick = Config.getConfig().shopNickname;
let regionName = Config.getConfig().regionName;
const resParams = {
stat: 1,
@ -80,7 +81,7 @@ export default class AllnetModule extends Module {
name: shopName,
nickname: shopNick,
region0: "1",
region_name0: "W",
region_name0: regionName,
region_name1: "X",
region_name2: "Y",
region_name3: "Z",

View File

@ -3,6 +3,8 @@ import fs from 'fs';
export interface ConfigFile {
shopName: string;
shopNickname: string;
regionName: string;
serverIp?: string;
}
export class Config {
@ -16,6 +18,9 @@ export class Config {
}
static getConfig(): ConfigFile {
if (!this.cfg)
this.load();
return this.cfg;
}
}

View File

@ -9,7 +9,6 @@ import fs from 'fs';
import bodyParser from 'body-parser';
import AllnetModule from './allnet';
import MuchaModule from './mucha';
import { Config } from './config';
globalAgent.options.keepAlive = true;
// @ts-ignore
@ -21,8 +20,6 @@ const PORT_ALLNET = 80;
const PORT_MUCHA = 10082;
const PORT_BNGI = 9002;
Config.load();
const app = express();
app.use(bodyParser.raw({
type: '*/*'

View File

@ -8,7 +8,7 @@ const PORT = 10082;
export default class MuchaModule extends Module {
register(app: Application): void {
const URL_BASE = `https://localhost:${PORT}`
const URL_BASE = `https://${Config.getConfig().serverIp || "localhost"}:${PORT}`
app.use(express.urlencoded({
type: '*/*',