返回提交历史
Modified
config-vanilla.json
+1
-0
Modified
src/controllers/api/loginController.ts
+1
-2
Modified
src/controllers/api/versionController.ts
+2
-2
Deleted
src/services/buildConfigService.ts
+0
-16
Modified
src/services/configService.ts
+1
-0
XFEstudio/SpaceNinjaServer
chore: add config.fallbackBuildLabel to replace buildConfig (#3966)
Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3966 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
4452606e
代码差异
5 个文件
+5
-20
@@ -27,6 +27,7 @@
27
27
"administratorNames": [],
28
28
"autoCreateAccount": true,
29
29
"skipTutorial": false,
30
"fallbackBuildLabel": "2013.01.04.10.41/",
30
31
"fullyStockedVendors": false,
31
32
"skipClanKeyCrafting": false,
32
33
"webui": {
@@ -1,7 +1,6 @@
1
1
import type { Request, RequestHandler } from "express";
2
2
3
3
import { config, getReflexiveAddress } from "../../services/configService.ts";
4
import { buildConfig } from "../../services/buildConfigService.ts";
5
4
6
5
import { Account } from "../../models/loginModel.ts";
7
6
import {
@@ -62,7 +61,7 @@ export const loginController: RequestHandler = async (request, response) => {
62
61
const buildLabel: string =
63
62
typeof request.query.buildLabel == "string"
64
63
? request.query.buildLabel.replaceAll(" ", "+")
65
: buildConfig.buildLabel;
64
: (config.fallbackBuildLabel ?? "");
66
65
67
66
if (version_compare(buildLabel, gameToBuildVersion["42.0.0"]) >= 0) {
68
67
if (args.dev) {
@@ -1,11 +1,11 @@
1
1
import type { RequestHandler } from "express";
2
import { buildConfig } from "../../services/buildConfigService.ts";
2
import { config } from "../../services/configService.ts";
3
3
4
4
export const versionController: RequestHandler = (request, res) => {
5
5
const buildLabel: string =
6
6
typeof request.query.buildLabel == "string"
7
7
? request.query.buildLabel.replaceAll(" ", "+")
8
: buildConfig.buildLabel;
8
: (config.fallbackBuildLabel ?? "");
9
9
10
10
res.send(buildLabel);
11
11
};
@@ -1,16 +0,0 @@
1
import path from "path";
2
import fs from "fs";
3
import { repoDir } from "../helpers/pathHelper.ts";
4
5
interface IBuildConfig {
6
buildLabel: string;
7
}
8
9
export const buildConfig: IBuildConfig = {
10
buildLabel: ""
11
};
12
13
const buildConfigPath = path.join(repoDir, "static/data/buildConfig.json");
14
if (fs.existsSync(buildConfigPath)) {
15
Object.assign(buildConfig, JSON.parse(fs.readFileSync(buildConfigPath, "utf-8")) as IBuildConfig);
16
}
@@ -36,6 +36,7 @@ export interface IConfig {
36
36
dtls?: number;
37
37
administratorNames?: string[];
38
38
autoCreateAccount?: boolean;
39
fallbackBuildLabel?: string;
39
40
skipTutorial?: boolean;
40
41
fullyStockedVendors?: boolean;
41
42
skipClanKeyCrafting?: boolean;