Update index.ts
This commit is contained in:
11
src/index.ts
11
src/index.ts
@@ -99,10 +99,6 @@ const instances = JSON.parse(
|
|||||||
readFileSync(process.env.JANK_INSTANCES_PATH || __dirname + "/webpage/instances.json").toString(),
|
readFileSync(process.env.JANK_INSTANCES_PATH || __dirname + "/webpage/instances.json").toString(),
|
||||||
) as instace[];
|
) as instace[];
|
||||||
|
|
||||||
const manifest = JSON.parse(
|
|
||||||
readFileSync(process.env.JANK_INSTANCES_PATH || __dirname + "/webpage/manifest.json").toString(),
|
|
||||||
) as object;
|
|
||||||
|
|
||||||
const instanceNames = new Map<string, Instance>();
|
const instanceNames = new Map<string, Instance>();
|
||||||
|
|
||||||
for (const instance of instances) {
|
for (const instance of instances) {
|
||||||
@@ -187,11 +183,6 @@ app.use("/", async (req: Request, res: Response) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req.path.startsWith("/manifest.json")) {
|
|
||||||
res.json(manifest);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (req.path.startsWith("/invite/")) {
|
if (req.path.startsWith("/invite/")) {
|
||||||
res.sendFile(path.join(__dirname, "webpage", "invite.html"));
|
res.sendFile(path.join(__dirname, "webpage", "invite.html"));
|
||||||
return;
|
return;
|
||||||
@@ -202,7 +193,7 @@ app.use("/", async (req: Request, res: Response) => {
|
|||||||
|
|
||||||
app.set("trust proxy", (ip: string) => ip.startsWith("127."));
|
app.set("trust proxy", (ip: string) => ip.startsWith("127."));
|
||||||
|
|
||||||
const PORT = process.env.PORT || Number(process.argv[2]) || 8333;
|
const PORT = process.env.PORT || Number(process.argv[2]) || 8080;
|
||||||
app.listen(PORT, () => {
|
app.listen(PORT, () => {
|
||||||
console.log(`Server running on port ${PORT}`);
|
console.log(`Server running on port ${PORT}`);
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user