返回提交历史
Modified
src/routes/cache.ts
+4
-13
Modified
src/services/buildConfigService.ts
+0
-2
XFEstudio/XFESpaceNinjaServer
chore: remove IBuildConfig.version (#3948)
If for some reason SpaceNinjaServer has to serve an H.Cache.bin still, then it should just be present directly. No reason for us to abstract away renaming or moving a file. Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3948 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
dc5a5339
代码差异
2 个文件
+4
-15
@@ -1,15 +1,10 @@
1
1
import express from "express";
2
import { buildConfig } from "../services/buildConfigService.ts";
3
2
import fs from "fs/promises";
4
3
5
4
const cacheRouter = express.Router();
6
5
7
cacheRouter.get(/^\/origin\/[a-zA-Z0-9]+\/[0-9]+\/H\.Cache\.bin.*$/, (req, res) => {
8
if (typeof req.query.version == "string" && req.query.version.match(/^\d\d\d\d\.\d\d\.\d\d\.\d\d\.\d\d$/)) {
9
res.sendFile(`static/data/H.Cache_${req.query.version}.bin`, { root: "./" });
10
} else {
11
res.sendFile(`static/data/H.Cache_${buildConfig.version}.bin`, { root: "./" });
12
}
6
cacheRouter.get(/^\/origin\/[a-zA-Z0-9]+\/[0-9]+\/H\.Cache\.bin.*$/, (_req, res) => {
7
res.sendFile(`static/data/H.Cache.bin`, { root: "./" });
13
8
});
14
9
15
10
cacheRouter.get(/^\/0\/.+!.+$/, async (req, res) => {
@@ -33,12 +28,8 @@ cacheRouter.get(/^\/origin\/[a-zA-Z0-9]+\/index\.txt\.lzma.*$/, (_, res) => {
33
28
res.sendFile(`static/data/content/index.txt.lzma`, { root: "./" });
34
29
});
35
30
36
cacheRouter.get(/^\/[0-9]+\/H\.Cache\.bin.*$/, (req, res) => {
37
if (typeof req.query.version == "string" && req.query.version.match(/^\d\d\d\d\.\d\d\.\d\d\.\d\d\.\d\d$/)) {
38
res.sendFile(`static/data/H.Cache_${req.query.version}.bin`, { root: "./" });
39
} else {
40
res.sendFile(`static/data/H.Cache_${buildConfig.version}.bin`, { root: "./" });
41
}
31
cacheRouter.get(/^\/[0-9]+\/H\.Cache\.bin.*$/, (_req, res) => {
32
res.sendFile(`static/data/H.Cache.bin`, { root: "./" });
42
33
});
43
34
44
35
cacheRouter.get(/^(\/\/|\/)(SplitCaches|Lotus|Tools|7|7_en)\/.*$/, async (req, res) => {
@@ -3,12 +3,10 @@ import fs from "fs";
3
3
import { repoDir } from "../helpers/pathHelper.ts";
4
4
5
5
interface IBuildConfig {
6
version: string;
7
6
buildLabel: string;
8
7
}
9
8
10
9
export const buildConfig: IBuildConfig = {
11
version: "",
12
10
buildLabel: ""
13
11
};
14
12