-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
96 lines (76 loc) · 3.35 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
/*
urls to patch in GSA for openspy (Aphex.exe, ArcRes.dll):
webservices.gamespyid.com -> gsidsvs.gsarc.openspy.net
www.gamespyid.com -> gsarc.openspy.net
gamespy.com -> openspy.net
gamespyarcade.com -> gsarc.openspy.net
*/
const express = require('express')
const app = express()
var mysql = require('mysql');
var path = require('path');
var morgan = require('morgan')
app.use(morgan('combined'))
app.use(express.urlencoded({ extended: true }));
var pool = mysql.createPool({
host : process.env.MYSQL_HOST || 'localhost',
port : process.env.MYSQL_PORT,
user : process.env.MYSQL_USER || 'root',
password : process.env.MYSQL_PASSWORD || 'password',
database : process.env.MYSQL_DB || 'MOTDWeb'
});
var SoftwareServicesHandler = require('./services/SoftwareServicesHandler');
var MOTDHandler = require('./motd/MOTDHandler');
var VersionCheckHandler = require('./motd/VersionCheckHandler');
var ValidateSubscriptionHandler = require('./motd/ValidateSubscriptionHandler');
var ImglibHandler = require('./services/ImglibHandler');
var ChatClubsHandler = require('./services/ChatClubHandler');
var FeaturesHandler = require('./services/Features');
app.get('/', function(req, res, next) {
res.end();
});
global.software_static_path = path.join(__dirname, 'public');
app.use('/software/', express.static(global.software_static_path))
app.get('/software/services/index.aspx', SoftwareServicesHandler.bind(null, pool));
app.get('/software/welcome.asp', function(req, res, next) {
res.send("Welcome to OpenSpy!");
res.end();
});
app.get("/software/eula/", function(req, res, next) {
res.send("GSA EULA");
res.end();
});
app.get("/aunit1.asp", function(req, res, next) {
res.send("BOTTOM AD");
res.end();
});
app.get("/software/banner.html", function(req,res, next) {
res.send("BANNER");
res.end();
});
//app.get('/software/services/:servicename/:fsvid/:filename', RawFileHandler.bind(null, pool));
app.get('/motd/motd.asp', MOTDHandler.bind(null, pool));
app.get('/motd/vercheck.asp', VersionCheckHandler.bind(null, pool));
app.get('/motd/validate.asp', ValidateSubscriptionHandler.bind(null, pool));
//maybe not needed
app.get('/motd/motd.aspx', MOTDHandler.bind(null, pool));
app.get('/motd/vercheck.aspx', VersionCheckHandler.bind(null, pool));
app.post('/bundle.asp', function(req, res, next) {
res.end();
});
//imglib
app.post('/software/imglib/ppost.asp', ImglibHandler.PicturePost.bind(null, pool, false));
app.get('/software/imglib/portraits/user/*', ImglibHandler.PortraitGet.bind(null, pool, false));
app.post('/software/imglib/ippost.asp', ImglibHandler.PicturePost.bind(null, pool, true));
app.get('/software/imglib/icons/user/*', ImglibHandler.PortraitGet.bind(null, pool, true));
app.post('/software/imglib/userfilepost.asp', ImglibHandler.UserFileStore.bind(null, pool));
app.get('/software/imglib/userfiles/*', ImglibHandler.UserFileGet.bind(null, pool));
//chatclubs
app.get('/software/chatclubs/club.aspx', ChatClubsHandler.GetClub.bind(null, pool));
//subscriber feature
app.get('/users/features.asmx/GetFeatures', FeaturesHandler.GetFeatures.bind(null, pool));
app.use(function (err, req, res, next) {
console.log(err);
res.status(500).end();
});
app.listen(process.env.PORT || 3000, () => console.log('Server running on port: ', process.env.PORT || 3000))