This repository has been archived by the owner on May 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
102 lines (90 loc) · 2.73 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
const https = require('https');
const express = require('express');
const fs = require('fs');
const app = express();
const moment = require('moment');
const formUrlEncoded = require('form-urlencoded');
app.use(express.urlencoded({
type: '*/*',
extended: true
}))
const PORT = 10082;
const URL_BASE = `https://localhost:${PORT}`
app.post('/updatacheck.do', (req, res) => {
console.log('POST /updatacheck.do')
let response = {
RESULTS: "001",
UPDATE_VER_1: req.body.gameVer,
UPDATE_URL_1: `${URL_BASE}/updUrl1/`,
UPDATE_SIZE_1: 9318000,
UPDATE_CRC_1: "55C4000000000000",
CHECK_URL_1: `${URL_BASE}/checkUrl/`,
EXE_VER_1: req.body.gameVer,
INFO_SIZE_1: 180,
COM_SIZE_1: 16384,
COM_TIME_1: 100,
LAN_INFO_SIZE_1: 180
}
let urlResponse = formUrlEncoded(response);
let decResponse = decodeURIComponent(urlResponse);
res.status(200).send(decResponse);
})
app.post('/boardauth.do', (req, res) => {
let serverTime = moment().format('YYYYMMDDHHmm');
let utcServerTime = moment().utc().format('YYYYMMDDHHmm');
console.log('POST /boardauth.do');
console.log(`${req.body.placeId}`);
let response = {
RESULTS: "001",
AREA_0: "008",
AREA_0_EN: "",
AREA_1: "009",
AREA_1_EN: "",
AREA_2: "010",
AREA_2_EN: "",
AREA_3: "011",
AREA_3_EN: "",
AREA_FULL_0: "",
AREA_FULL_0_EN: "",
AREA_FULL_1: "",
AREA_FULL_1_EN: "",
AREA_FULL_2: "",
AREA_FULL_2_EN: "",
AREA_FULL_3: "",
AREA_FULL_3_EN: "",
AUTH_INTERVAL: "86400",
CHARGE_URL: `${URL_BASE}/charge/`,
CONSUME_TOKEN: "0",
COUNTRY_CD: "JPN",
DONGLE_FLG: "1",
EXPIRATION_DATE: "null",
FILE_URL: `${URL_BASE}/file/`,
FORCE_BOOT: "0",
PLACE_ID: req.body.placeId,
PREFECTURE_ID: "14",
SERVER_TIME: serverTime,
UTC_SERVER_TIME: utcServerTime,
SHOP_NAME: "WMMT6",
SHOP_NAME_EN: "WMMT6",
SHOP_NICKNAME: "W",
SHOP_NICKNAME_EN: "W",
URL_1: `${URL_BASE}/url1/`,
URL_2: `${URL_BASE}/url2/`,
URL_3: `${URL_BASE}/url3/`,
USE_TOKEN: "0"
}
let urlResponse = formUrlEncoded(response);
let decResponse = decodeURIComponent(urlResponse);
res.status(200).send(decResponse);
})
app.all('*', (req, res) => {
console.log(`catch-all: ${req.method} ${req.originalUrl} ${req.body}`);
res.status(200).end()
})
https.createServer(
{
key: fs.readFileSync('server-key.pem'),
cert: fs.readFileSync('server-cert5.pem')
},
app
).listen(PORT, () => console.log(`listening ${PORT}`));