-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.ts
38 lines (34 loc) · 1.28 KB
/
index.ts
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
import * as bancho from "./routes/bancho";
import * as web from "./routes/web";
import * as bots from "./handlers/bot";
import * as channels from "./handlers/channel";
import hyperExpress from "hyper-express";
import * as log from "./handlers/logs";
// @ts-ignore
import * as config from "./config";
const app = new hyperExpress.Server();
(async () => {
await Promise.all([bots.createBot(), channels.initialize()]);
app.any("/", bancho.banchoIndex);
app.get("/d/:id", web.handleDownload);
app.get("/web/osu-search.php", web.osuSearch);
app.get("/web/osu-search-set.php", web.osuSearchSet);
app.get("/web/check-updates.php", web.osuCheckUpdates);
app.get("/web/osu-getseasonal.php", web.osuSeasonal);
app.get("/web/osu-checktweets.php", web.osuGetTweets);
app.get("/web/osu-osz2-getscores.php", web.osuGetScores);
app.post("/web/osu-screenshot.php", web.osuScreenshot);
app.post("/web/osu-submit-modular-selector.php", web.osuSubmitModular);
if (config.server.allowIngameRegistration) {
app.any("/users", web.registerAccount);
}
app
.listen(config.server.port)
.then((listen) => log.printStartup())
.catch((err) => log.error(err));
process.on('SIGINT', function () {
app.close(function () {
console.log("Shutting down...");
});
});
})();