omegga 1.2.8 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -1
- package/dist/brickadia/config.js +26 -90
- package/dist/brickadia/config.js.map +1 -1
- package/dist/brickadia/server.js +294 -293
- package/dist/brickadia/server.js.map +1 -1
- package/dist/cli/auth.js +149 -177
- package/dist/cli/auth.js.map +1 -1
- package/dist/cli/config.js +64 -66
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/index.js +14 -14
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/installer.js +37 -43
- package/dist/cli/installer.js.map +1 -1
- package/dist/cli/plugin.js +651 -682
- package/dist/cli/plugin.js.map +1 -1
- package/dist/cli/terminal.js +811 -733
- package/dist/cli/terminal.js.map +1 -1
- package/dist/config/formats/format_js.js +6 -6
- package/dist/config/formats/format_js.js.map +1 -1
- package/dist/config/formats/format_yml.js +7 -10
- package/dist/config/formats/format_yml.js.map +1 -1
- package/dist/config/index.js +46 -68
- package/dist/config/index.js.map +1 -1
- package/dist/config/reader.js +16 -27
- package/dist/config/reader.js.map +1 -1
- package/dist/config/validator.js +23 -25
- package/dist/config/validator.js.map +1 -1
- package/dist/config/writer.js +11 -21
- package/dist/config/writer.js.map +1 -1
- package/dist/index.js +18 -64
- package/dist/index.js.map +1 -1
- package/dist/info/default_commands.json.js +39 -0
- package/dist/info/default_commands.json.js.map +1 -0
- package/dist/logger.js +61 -60
- package/dist/logger.js.map +1 -1
- package/dist/main.js +424 -471
- package/dist/main.js.map +1 -1
- package/dist/omegga/auth.js +101 -148
- package/dist/omegga/auth.js.map +1 -1
- package/dist/omegga/commandInjector.js +261 -251
- package/dist/omegga/commandInjector.js.map +1 -1
- package/dist/omegga/index.js +14 -52
- package/dist/omegga/index.js.map +1 -1
- package/dist/omegga/logWrangler.js +224 -275
- package/dist/omegga/logWrangler.js.map +1 -1
- package/dist/omegga/matchers/auth.js +36 -50
- package/dist/omegga/matchers/auth.js.map +1 -1
- package/dist/omegga/matchers/chat.js +49 -71
- package/dist/omegga/matchers/chat.js.map +1 -1
- package/dist/omegga/matchers/command.js +25 -36
- package/dist/omegga/matchers/command.js.map +1 -1
- package/dist/omegga/matchers/exit.js +15 -18
- package/dist/omegga/matchers/exit.js.map +1 -1
- package/dist/omegga/matchers/index.js +26 -40
- package/dist/omegga/matchers/index.js.map +1 -1
- package/dist/omegga/matchers/init.js +20 -23
- package/dist/omegga/matchers/init.js.map +1 -1
- package/dist/omegga/matchers/interact.js +58 -64
- package/dist/omegga/matchers/interact.js.map +1 -1
- package/dist/omegga/matchers/join.js +74 -95
- package/dist/omegga/matchers/join.js.map +1 -1
- package/dist/omegga/matchers/leave.js +43 -56
- package/dist/omegga/matchers/leave.js.map +1 -1
- package/dist/omegga/matchers/mapChange.js +26 -35
- package/dist/omegga/matchers/mapChange.js.map +1 -1
- package/dist/omegga/matchers/minigameJoin.js +24 -31
- package/dist/omegga/matchers/minigameJoin.js.map +1 -1
- package/dist/omegga/matchers/version.js +42 -49
- package/dist/omegga/matchers/version.js.map +1 -1
- package/dist/omegga/player.js +527 -527
- package/dist/omegga/player.js.map +1 -1
- package/dist/omegga/plugin/interface.js +91 -98
- package/dist/omegga/plugin/interface.js.map +1 -1
- package/dist/omegga/plugin/plugin_jsonrpc_stdio.js +524 -429
- package/dist/omegga/plugin/plugin_jsonrpc_stdio.js.map +1 -1
- package/dist/omegga/plugin/plugin_node_safe/proxyOmegga.js +282 -294
- package/dist/omegga/plugin/plugin_node_safe/proxyOmegga.js.map +1 -1
- package/dist/omegga/plugin/plugin_node_safe.js +365 -393
- package/dist/omegga/plugin/plugin_node_safe.js.map +1 -1
- package/dist/omegga/plugin/plugin_node_unsafe.js +119 -179
- package/dist/omegga/plugin/plugin_node_unsafe.js.map +1 -1
- package/dist/omegga/plugin.js +402 -347
- package/dist/omegga/plugin.js.map +1 -1
- package/dist/omegga/server.js +742 -774
- package/dist/omegga/server.js.map +1 -1
- package/dist/omegga/wrapper.js +64 -91
- package/dist/omegga/wrapper.js.map +1 -1
- package/dist/plugin.js +11 -31
- package/dist/plugin.js.map +1 -1
- package/dist/softconfig.js +121 -100
- package/dist/softconfig.js.map +1 -1
- package/dist/updater/steam.js +97 -112
- package/dist/updater/steam.js.map +1 -1
- package/dist/util/brdb.js +496 -528
- package/dist/util/brdb.js.map +1 -1
- package/dist/util/brick/checkBounds.js +11 -15
- package/dist/util/brick/checkBounds.js.map +1 -1
- package/dist/util/brick/constants.js +723 -174
- package/dist/util/brick/constants.js.map +1 -1
- package/dist/util/brick/displayName.js +204 -211
- package/dist/util/brick/displayName.js.map +1 -1
- package/dist/util/brick/getBounds.js +29 -41
- package/dist/util/brick/getBounds.js.map +1 -1
- package/dist/util/brick/getBrickSize.js +6 -7
- package/dist/util/brick/getBrickSize.js.map +1 -1
- package/dist/util/brick/getScaleAxis.js +24 -30
- package/dist/util/brick/getScaleAxis.js.map +1 -1
- package/dist/util/brick/index.js +8 -29
- package/dist/util/brick/index.js.map +1 -1
- package/dist/util/brick/rotate.js +29 -34
- package/dist/util/brick/rotate.js.map +1 -1
- package/dist/util/brick/setOwnership.js +13 -19
- package/dist/util/brick/setOwnership.js.map +1 -1
- package/dist/util/chat.js +53 -44
- package/dist/util/chat.js.map +1 -1
- package/dist/util/color.js +112 -124
- package/dist/util/color.js.map +1 -1
- package/dist/util/file.js +54 -98
- package/dist/util/file.js.map +1 -1
- package/dist/util/index.js +84 -106
- package/dist/util/index.js.map +1 -1
- package/dist/util/map.js +18 -20
- package/dist/util/map.js.map +1 -1
- package/dist/util/pattern.js +6 -9
- package/dist/util/pattern.js.map +1 -1
- package/dist/util/time.js +31 -34
- package/dist/util/time.js.map +1 -1
- package/dist/util/uuid.js +10 -8
- package/dist/util/uuid.js.map +1 -1
- package/dist/util/wsl.js +19 -25
- package/dist/util/wsl.js.map +1 -1
- package/dist/version.js +7 -9
- package/dist/version.js.map +1 -1
- package/dist/webserver/backend/api.js +784 -874
- package/dist/webserver/backend/api.js.map +1 -1
- package/dist/webserver/backend/calendar.js +14 -17
- package/dist/webserver/backend/calendar.js.map +1 -1
- package/dist/webserver/backend/database.js +563 -613
- package/dist/webserver/backend/database.js.map +1 -1
- package/dist/webserver/backend/index.js +153 -191
- package/dist/webserver/backend/index.js.map +1 -1
- package/dist/webserver/backend/metrics.js +219 -248
- package/dist/webserver/backend/metrics.js.map +1 -1
- package/dist/webserver/backend/util.js +47 -68
- package/dist/webserver/backend/util.js.map +1 -1
- package/dist/worker.js +322 -0
- package/dist/worker.js.map +1 -0
- package/package.json +14 -10
- package/templates/safe-ts/omegga.d.ts +2 -2
- package/vite.backend.config.mts +46 -0
- package/vite.frontend.config.mts +58 -0
- package/vitest.backend.config.mts +7 -0
- package/dist/brickadia/config.d.ts +0 -3
- package/dist/brickadia/presets.d.ts +0 -65
- package/dist/brickadia/presets.js +0 -3
- package/dist/brickadia/presets.js.map +0 -1
- package/dist/brickadia/server.d.ts +0 -36
- package/dist/brickadia/types.d.ts +0 -45
- package/dist/brickadia/types.js +0 -3
- package/dist/brickadia/types.js.map +0 -1
- package/dist/cli/auth.d.ts +0 -26
- package/dist/cli/config.d.ts +0 -10
- package/dist/cli/index.d.ts +0 -30
- package/dist/cli/installer.d.ts +0 -1
- package/dist/cli/plugin.d.ts +0 -22
- package/dist/cli/terminal.d.ts +0 -25
- package/dist/config/authorizer.d.ts +0 -2
- package/dist/config/authorizer.js +0 -38
- package/dist/config/authorizer.js.map +0 -1
- package/dist/config/formats/format_js.d.ts +0 -3
- package/dist/config/formats/format_yml.d.ts +0 -3
- package/dist/config/index.d.ts +0 -18
- package/dist/config/reader.d.ts +0 -3
- package/dist/config/types.d.ts +0 -50
- package/dist/config/types.js +0 -3
- package/dist/config/types.js.map +0 -1
- package/dist/config/validator.d.ts +0 -6
- package/dist/config/writer.d.ts +0 -3
- package/dist/index.d.ts +0 -22
- package/dist/info/default_commands.json +0 -29
- package/dist/logger.d.ts +0 -41
- package/dist/main.d.ts +0 -1
- package/dist/omegga/auth.d.ts +0 -9
- package/dist/omegga/commandInjector.d.ts +0 -35
- package/dist/omegga/index.d.ts +0 -7
- package/dist/omegga/logWrangler.d.ts +0 -32
- package/dist/omegga/matchers/auth.d.ts +0 -10
- package/dist/omegga/matchers/chat.d.ts +0 -10
- package/dist/omegga/matchers/command.d.ts +0 -7
- package/dist/omegga/matchers/exit.d.ts +0 -3
- package/dist/omegga/matchers/index.d.ts +0 -3
- package/dist/omegga/matchers/init.d.ts +0 -3
- package/dist/omegga/matchers/interact.d.ts +0 -4
- package/dist/omegga/matchers/join.d.ts +0 -4
- package/dist/omegga/matchers/leave.d.ts +0 -4
- package/dist/omegga/matchers/mapChange.d.ts +0 -3
- package/dist/omegga/matchers/minigameJoin.d.ts +0 -9
- package/dist/omegga/matchers/types.d.ts +0 -5
- package/dist/omegga/matchers/types.js +0 -3
- package/dist/omegga/matchers/types.js.map +0 -1
- package/dist/omegga/matchers/version.d.ts +0 -3
- package/dist/omegga/player.d.ts +0 -81
- package/dist/omegga/plugin/interface.d.ts +0 -30
- package/dist/omegga/plugin/plugin_jsonrpc_stdio.d.ts +0 -23
- package/dist/omegga/plugin/plugin_node_safe/proxyOmegga.d.ts +0 -145
- package/dist/omegga/plugin/plugin_node_safe/worker.d.ts +0 -1
- package/dist/omegga/plugin/plugin_node_safe/worker.js +0 -367
- package/dist/omegga/plugin/plugin_node_safe/worker.js.map +0 -1
- package/dist/omegga/plugin/plugin_node_safe.d.ts +0 -23
- package/dist/omegga/plugin/plugin_node_unsafe.d.ts +0 -13
- package/dist/omegga/plugin.d.ts +0 -63
- package/dist/omegga/server.d.ts +0 -166
- package/dist/omegga/types.d.ts +0 -49
- package/dist/omegga/types.js +0 -3
- package/dist/omegga/types.js.map +0 -1
- package/dist/omegga/wrapper.d.ts +0 -32
- package/dist/plugin.d.ts +0 -916
- package/dist/softconfig.d.ts +0 -67
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/updater/index.d.ts +0 -1
- package/dist/updater/index.js +0 -10
- package/dist/updater/index.js.map +0 -1
- package/dist/updater/steam.d.ts +0 -52
- package/dist/util/brdb.d.ts +0 -31
- package/dist/util/brick/checkBounds.d.ts +0 -8
- package/dist/util/brick/constants.d.ts +0 -18
- package/dist/util/brick/displayName.d.ts +0 -7
- package/dist/util/brick/getBounds.d.ts +0 -5
- package/dist/util/brick/getBrickSize.d.ts +0 -3
- package/dist/util/brick/getScaleAxis.d.ts +0 -3
- package/dist/util/brick/index.d.ts +0 -14
- package/dist/util/brick/rotate.d.ts +0 -16
- package/dist/util/brick/setOwnership.d.ts +0 -12
- package/dist/util/chat.d.ts +0 -23
- package/dist/util/color.d.ts +0 -13
- package/dist/util/file.d.ts +0 -5
- package/dist/util/index.d.ts +0 -183
- package/dist/util/map.d.ts +0 -6
- package/dist/util/pattern.d.ts +0 -1
- package/dist/util/time.d.ts +0 -39
- package/dist/util/uuid.d.ts +0 -3
- package/dist/util/wsl.d.ts +0 -2
- package/dist/version.d.ts +0 -2
- package/dist/webserver/backend/api.d.ts +0 -115
- package/dist/webserver/backend/calendar.d.ts +0 -5
- package/dist/webserver/backend/database.d.ts +0 -150
- package/dist/webserver/backend/index.d.ts +0 -30
- package/dist/webserver/backend/metrics.d.ts +0 -3
- package/dist/webserver/backend/types.d.ts +0 -114
- package/dist/webserver/backend/types.js +0 -3
- package/dist/webserver/backend/types.js.map +0 -1
- package/dist/webserver/backend/util.d.ts +0 -2
- package/dist/webserver/index.d.ts +0 -2
- package/dist/webserver/index.js +0 -9
- package/dist/webserver/index.js.map +0 -1
package/dist/softconfig.js
CHANGED
|
@@ -1,105 +1,126 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
exports.DEFAULT_PORT = 8080;
|
|
15
|
-
// filenames that omegga searches for
|
|
16
|
-
// extensions are added based on the available config formats
|
|
17
|
-
exports.CONFIG_FILENAMES = [
|
|
18
|
-
'omegga-config',
|
|
19
|
-
'omegga',
|
|
20
|
-
'.omegga-config',
|
|
21
|
-
'.omegga',
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const os = require("os");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const PROJECT_NAME = "omegga";
|
|
6
|
+
const CONFIG_HOME = path.join(os.homedir(), ".config/" + PROJECT_NAME);
|
|
7
|
+
const GLOBAL_TOKEN = path.join(CONFIG_HOME, "global_auth_token");
|
|
8
|
+
const DEFAULT_PORT = 8080;
|
|
9
|
+
const CONFIG_FILENAMES = [
|
|
10
|
+
"omegga-config",
|
|
11
|
+
"omegga",
|
|
12
|
+
".omegga-config",
|
|
13
|
+
".omegga"
|
|
22
14
|
];
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
const BRICKADIA_INSTALLS = path.join(
|
|
16
|
+
os.homedir(),
|
|
17
|
+
".local/share/brickadia-launcher/brickadia-installs"
|
|
18
|
+
);
|
|
19
|
+
let GAME_DIR = "Brickadia";
|
|
20
|
+
let INSTALL_DIR = path.join(CONFIG_HOME, "steam_installs");
|
|
21
|
+
if (process.env.STEAM_GAME_DIR) GAME_DIR = process.env.STEAM_GAME_DIR;
|
|
28
22
|
if (process.env.STEAM_INSTALLS_DIR)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
23
|
+
INSTALL_DIR = process.env.STEAM_INSTALLS_DIR;
|
|
24
|
+
const OVERRIDE_GAME_DIR = process.env.BRICKADIA_DIR;
|
|
25
|
+
const STEAM_DIR = path.join(CONFIG_HOME, "steam");
|
|
26
|
+
const STEAMCMD_PATH = path.join(STEAM_DIR, "steamcmd.sh");
|
|
27
|
+
const GAME_DIRNAME = process.env.STEAM_GAME_DIR ?? GAME_DIR;
|
|
28
|
+
const STEAM_APP_ID = "3017590";
|
|
29
|
+
const GAME_INSTALL_DIR = INSTALL_DIR;
|
|
30
|
+
const GAME_BIN_PATH = "Binaries/Linux/BrickadiaServer-Linux-Shipping";
|
|
31
|
+
const LOCAL_LAUNCHER = path.join(
|
|
32
|
+
CONFIG_HOME,
|
|
33
|
+
"launcher/brickadia-launcher/main-brickadia-launcher"
|
|
34
|
+
);
|
|
35
|
+
const CONFIG_AUTH_DIR = "Auth";
|
|
36
|
+
const CONFIG_SAVED_DIR = "Saved";
|
|
37
|
+
const BRICKADIA_AUTH_FILES = [
|
|
38
|
+
"OfflinePayload.bin",
|
|
39
|
+
"OfflineSignature.bin",
|
|
40
|
+
"SessionToken.bin"
|
|
46
41
|
];
|
|
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
|
-
WEB_CERTS_DATA: exports.WEB_CERTS_DATA,
|
|
96
|
-
WEB_SESSION_TOKEN: exports.WEB_SESSION_TOKEN,
|
|
97
|
-
METRIC_HEARTBEAT_INTERVAL: exports.METRIC_HEARTBEAT_INTERVAL,
|
|
98
|
-
METRIC_EMPTIES_BEFORE_PAUSE: exports.METRIC_EMPTIES_BEFORE_PAUSE,
|
|
99
|
-
STEAM_DIR: exports.STEAM_DIR,
|
|
100
|
-
STEAMCMD_PATH: exports.STEAMCMD_PATH,
|
|
101
|
-
STEAM_INSTALLS_DIR: exports.GAME_INSTALL_DIR,
|
|
102
|
-
STEAM_BRICKADIA_PATH: exports.GAME_BIN_PATH,
|
|
103
|
-
GLOBAL_TOKEN: exports.GLOBAL_TOKEN,
|
|
42
|
+
const TEMP_DIR_NAME = ".omegga-temp-data";
|
|
43
|
+
const DATA_PATH = "./data";
|
|
44
|
+
const PLUGIN_PATH = "./plugins";
|
|
45
|
+
const PLUGIN_FILE = "./plugin.json";
|
|
46
|
+
const PLUGIN_POSTINSTALL = "./setup.sh";
|
|
47
|
+
const CHAT_STORE = "chat.db";
|
|
48
|
+
const PLAYER_STORE = "players.db";
|
|
49
|
+
const PLUGIN_STORE = "plugins.db";
|
|
50
|
+
const STATUS_STORE = "status.db";
|
|
51
|
+
const USER_STORE = "users.db";
|
|
52
|
+
const SERVER_STORE = "store.db";
|
|
53
|
+
const SESSION_STORE = "session.db";
|
|
54
|
+
const ACTIVE_WORLD_FILE = "active_world";
|
|
55
|
+
const WEB_CERTS_DATA = "web_certs.json";
|
|
56
|
+
const WEB_SESSION_TOKEN = "web_session_token";
|
|
57
|
+
const METRIC_HEARTBEAT_INTERVAL = 60 * 1e3;
|
|
58
|
+
const METRIC_EMPTIES_BEFORE_PAUSE = 3;
|
|
59
|
+
const soft = {
|
|
60
|
+
PROJECT_NAME,
|
|
61
|
+
CONFIG_HOME,
|
|
62
|
+
DEFAULT_PORT,
|
|
63
|
+
CONFIG_FILENAMES,
|
|
64
|
+
BRICKADIA_INSTALLS,
|
|
65
|
+
LOCAL_LAUNCHER,
|
|
66
|
+
CONFIG_AUTH_DIR,
|
|
67
|
+
CONFIG_SAVED_DIR,
|
|
68
|
+
BRICKADIA_AUTH_FILES,
|
|
69
|
+
TEMP_DIR_NAME,
|
|
70
|
+
DATA_PATH,
|
|
71
|
+
PLUGIN_PATH,
|
|
72
|
+
PLUGIN_FILE,
|
|
73
|
+
PLUGIN_POSTINSTALL,
|
|
74
|
+
CHAT_STORE,
|
|
75
|
+
PLAYER_STORE,
|
|
76
|
+
PLUGIN_STORE,
|
|
77
|
+
STATUS_STORE,
|
|
78
|
+
USER_STORE,
|
|
79
|
+
SERVER_STORE,
|
|
80
|
+
SESSION_STORE,
|
|
81
|
+
WEB_CERTS_DATA,
|
|
82
|
+
WEB_SESSION_TOKEN,
|
|
83
|
+
METRIC_HEARTBEAT_INTERVAL,
|
|
84
|
+
METRIC_EMPTIES_BEFORE_PAUSE,
|
|
85
|
+
STEAM_DIR,
|
|
86
|
+
STEAMCMD_PATH,
|
|
87
|
+
STEAM_INSTALLS_DIR: GAME_INSTALL_DIR,
|
|
88
|
+
STEAM_BRICKADIA_PATH: GAME_BIN_PATH,
|
|
89
|
+
GLOBAL_TOKEN
|
|
104
90
|
};
|
|
105
|
-
|
|
91
|
+
exports.ACTIVE_WORLD_FILE = ACTIVE_WORLD_FILE;
|
|
92
|
+
exports.BRICKADIA_AUTH_FILES = BRICKADIA_AUTH_FILES;
|
|
93
|
+
exports.BRICKADIA_INSTALLS = BRICKADIA_INSTALLS;
|
|
94
|
+
exports.CHAT_STORE = CHAT_STORE;
|
|
95
|
+
exports.CONFIG_AUTH_DIR = CONFIG_AUTH_DIR;
|
|
96
|
+
exports.CONFIG_FILENAMES = CONFIG_FILENAMES;
|
|
97
|
+
exports.CONFIG_HOME = CONFIG_HOME;
|
|
98
|
+
exports.CONFIG_SAVED_DIR = CONFIG_SAVED_DIR;
|
|
99
|
+
exports.DATA_PATH = DATA_PATH;
|
|
100
|
+
exports.DEFAULT_PORT = DEFAULT_PORT;
|
|
101
|
+
exports.GAME_BIN_PATH = GAME_BIN_PATH;
|
|
102
|
+
exports.GAME_DIRNAME = GAME_DIRNAME;
|
|
103
|
+
exports.GAME_INSTALL_DIR = GAME_INSTALL_DIR;
|
|
104
|
+
exports.GLOBAL_TOKEN = GLOBAL_TOKEN;
|
|
105
|
+
exports.LOCAL_LAUNCHER = LOCAL_LAUNCHER;
|
|
106
|
+
exports.METRIC_EMPTIES_BEFORE_PAUSE = METRIC_EMPTIES_BEFORE_PAUSE;
|
|
107
|
+
exports.METRIC_HEARTBEAT_INTERVAL = METRIC_HEARTBEAT_INTERVAL;
|
|
108
|
+
exports.OVERRIDE_GAME_DIR = OVERRIDE_GAME_DIR;
|
|
109
|
+
exports.PLAYER_STORE = PLAYER_STORE;
|
|
110
|
+
exports.PLUGIN_FILE = PLUGIN_FILE;
|
|
111
|
+
exports.PLUGIN_PATH = PLUGIN_PATH;
|
|
112
|
+
exports.PLUGIN_POSTINSTALL = PLUGIN_POSTINSTALL;
|
|
113
|
+
exports.PLUGIN_STORE = PLUGIN_STORE;
|
|
114
|
+
exports.PROJECT_NAME = PROJECT_NAME;
|
|
115
|
+
exports.SERVER_STORE = SERVER_STORE;
|
|
116
|
+
exports.SESSION_STORE = SESSION_STORE;
|
|
117
|
+
exports.STATUS_STORE = STATUS_STORE;
|
|
118
|
+
exports.STEAMCMD_PATH = STEAMCMD_PATH;
|
|
119
|
+
exports.STEAM_APP_ID = STEAM_APP_ID;
|
|
120
|
+
exports.STEAM_DIR = STEAM_DIR;
|
|
121
|
+
exports.TEMP_DIR_NAME = TEMP_DIR_NAME;
|
|
122
|
+
exports.USER_STORE = USER_STORE;
|
|
123
|
+
exports.WEB_CERTS_DATA = WEB_CERTS_DATA;
|
|
124
|
+
exports.WEB_SESSION_TOKEN = WEB_SESSION_TOKEN;
|
|
125
|
+
exports.default = soft;
|
|
126
|
+
//# sourceMappingURL=softconfig.js.map
|
package/dist/softconfig.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"softconfig.js","
|
|
1
|
+
{"version":3,"file":"softconfig.js","sources":["../src/softconfig.ts"],"sourcesContent":["import os from 'os';\nimport path from 'path';\n\n// home directory for omegga config\nexport const PROJECT_NAME = 'omegga';\nexport const CONFIG_HOME = path.join(os.homedir(), '.config/' + PROJECT_NAME);\nexport const GLOBAL_TOKEN = path.join(CONFIG_HOME, 'global_auth_token');\n\nexport const DEFAULT_PORT = 8080;\n\n// filenames that omegga searches for\n// extensions are added based on the available config formats\nexport const CONFIG_FILENAMES = [\n 'omegga-config',\n 'omegga',\n '.omegga-config',\n '.omegga',\n];\n\nexport const BRICKADIA_INSTALLS = path.join(\n os.homedir(),\n '.local/share/brickadia-launcher/brickadia-installs',\n);\n\nlet GAME_DIR = 'Brickadia';\nlet INSTALL_DIR = path.join(CONFIG_HOME, 'steam_installs');\nif (process.env.STEAM_GAME_DIR) GAME_DIR = process.env.STEAM_GAME_DIR;\nif (process.env.STEAM_INSTALLS_DIR)\n INSTALL_DIR = process.env.STEAM_INSTALLS_DIR;\n\nexport const OVERRIDE_GAME_DIR = process.env.BRICKADIA_DIR;\nexport const STEAM_DIR = path.join(CONFIG_HOME, 'steam');\nexport const STEAMCMD_PATH = path.join(STEAM_DIR, 'steamcmd.sh');\nexport const GAME_DIRNAME = process.env.STEAM_GAME_DIR ?? GAME_DIR;\nexport const STEAM_APP_ID = '3017590'; // Brickadia app ID\nexport const GAME_INSTALL_DIR = INSTALL_DIR;\nexport const GAME_BIN_PATH = 'Binaries/Linux/BrickadiaServer-Linux-Shipping';\n\nexport const LOCAL_LAUNCHER = path.join(\n CONFIG_HOME,\n 'launcher/brickadia-launcher/main-brickadia-launcher',\n);\n\n// path to auth files\nexport const CONFIG_AUTH_DIR = 'Auth';\nexport const CONFIG_SAVED_DIR = 'Saved';\n// files in Brickadia/Saved/Auth\nexport const BRICKADIA_AUTH_FILES = [\n 'OfflinePayload.bin',\n 'OfflineSignature.bin',\n 'SessionToken.bin',\n];\n\n// temporary install for generating auth files\nexport const TEMP_DIR_NAME = '.omegga-temp-data';\n\n// path to certain info folders\nexport const DATA_PATH = './data';\nexport const PLUGIN_PATH = './plugins';\n\n// plugin data\nexport const PLUGIN_FILE = './plugin.json';\n// post install file\nexport const PLUGIN_POSTINSTALL = './setup.sh';\n\n// databases\nexport const CHAT_STORE = 'chat.db';\nexport const PLAYER_STORE = 'players.db';\nexport const PLUGIN_STORE = 'plugins.db';\nexport const STATUS_STORE = 'status.db';\nexport const USER_STORE = 'users.db';\nexport const SERVER_STORE = 'store.db';\nexport const SESSION_STORE = 'session.db';\nexport const ACTIVE_WORLD_FILE = 'active_world';\n\n// website config\nexport const WEB_CERTS_DATA = 'web_certs.json';\nexport const WEB_SESSION_TOKEN = 'web_session_token';\n\n// how often server status is requested in a heartbeat\nexport const METRIC_HEARTBEAT_INTERVAL = 60 * 1000;\n// the number of empty server statuses before metric logging is paused\nexport const METRIC_EMPTIES_BEFORE_PAUSE = 3;\n\n// rexport as default\nexport default {\n PROJECT_NAME,\n CONFIG_HOME,\n DEFAULT_PORT,\n CONFIG_FILENAMES,\n BRICKADIA_INSTALLS,\n LOCAL_LAUNCHER,\n CONFIG_AUTH_DIR,\n CONFIG_SAVED_DIR,\n BRICKADIA_AUTH_FILES,\n TEMP_DIR_NAME,\n DATA_PATH,\n PLUGIN_PATH,\n PLUGIN_FILE,\n PLUGIN_POSTINSTALL,\n CHAT_STORE,\n PLAYER_STORE,\n PLUGIN_STORE,\n STATUS_STORE,\n USER_STORE,\n SERVER_STORE,\n SESSION_STORE,\n WEB_CERTS_DATA,\n WEB_SESSION_TOKEN,\n METRIC_HEARTBEAT_INTERVAL,\n METRIC_EMPTIES_BEFORE_PAUSE,\n STEAM_DIR,\n STEAMCMD_PATH,\n STEAM_INSTALLS_DIR: GAME_INSTALL_DIR,\n STEAM_BRICKADIA_PATH: GAME_BIN_PATH,\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AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,oBAAoB;AAAA,EACpB,sBAAsB;AAAA,EACtB;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/updater/steam.js
CHANGED
|
@@ -1,139 +1,124 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
exports.steamcmdDownloadGame = steamcmdDownloadGame;
|
|
10
|
-
exports.getLocalSteamDepot = getLocalSteamDepot;
|
|
11
|
-
exports.getRemoteSteamDepot = getRemoteSteamDepot;
|
|
12
|
-
exports.hasSteamUpdate = hasSteamUpdate;
|
|
13
|
-
const logger_1 = __importDefault(require("../logger"));
|
|
14
|
-
const softconfig_1 = require("../softconfig");
|
|
15
|
-
const child_process_1 = require("child_process");
|
|
16
|
-
const fs_1 = require("fs");
|
|
17
|
-
const path_1 = __importDefault(require("path"));
|
|
18
|
-
const steam_acf2json_1 = __importDefault(require("steam-acf2json"));
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const logger = require("../logger.js");
|
|
4
|
+
const softconfig = require("../softconfig.js");
|
|
5
|
+
const node_child_process = require("node:child_process");
|
|
6
|
+
const fs = require("node:fs");
|
|
7
|
+
const path = require("node:path");
|
|
8
|
+
const acfParser = require("steam-acf2json");
|
|
19
9
|
function getAppId() {
|
|
20
|
-
|
|
21
|
-
return (_a = process.env.STEAM_APP_ID) !== null && _a !== void 0 ? _a : softconfig_1.STEAM_APP_ID;
|
|
10
|
+
return process.env.STEAM_APP_ID ?? softconfig.STEAM_APP_ID;
|
|
22
11
|
}
|
|
23
12
|
function steamcmdDownloadSelf() {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
13
|
+
node_child_process.execSync(path.join(__dirname, "../../tools/install_steamcmd.sh"), {
|
|
14
|
+
stdio: "inherit"
|
|
15
|
+
});
|
|
27
16
|
}
|
|
28
|
-
function steamcmdDownloadGame({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
17
|
+
function steamcmdDownloadGame({
|
|
18
|
+
steambeta,
|
|
19
|
+
steambetaPassword
|
|
20
|
+
} = {}) {
|
|
21
|
+
const args = [
|
|
22
|
+
`+force_install_dir ${path.join(softconfig.GAME_INSTALL_DIR, steambeta ?? "main")}`,
|
|
23
|
+
`+login anonymous`,
|
|
24
|
+
`+app_update ${getAppId()}`,
|
|
25
|
+
steambeta ? `-beta ${steambeta}` : null,
|
|
26
|
+
steambeta && steambetaPassword ? `-betapassword ${steambetaPassword}` : null,
|
|
27
|
+
"+quit"
|
|
28
|
+
].filter(Boolean);
|
|
29
|
+
node_child_process.execSync(`${softconfig.STEAMCMD_PATH} ${args.join(" ")}`, { stdio: "inherit" });
|
|
40
30
|
}
|
|
41
31
|
async function fetchSteamInfo() {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
32
|
+
const appId = getAppId();
|
|
33
|
+
const res = await fetch("https://api.steamcmd.net/v1/info/" + appId);
|
|
34
|
+
const json = await res.json();
|
|
35
|
+
return json;
|
|
46
36
|
}
|
|
47
37
|
function getSteamAcf(steambeta) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
38
|
+
const appId = getAppId();
|
|
39
|
+
const installDir = path.join(softconfig.GAME_INSTALL_DIR, steambeta ?? "main");
|
|
40
|
+
const acfPath = path.join(
|
|
41
|
+
installDir,
|
|
42
|
+
"steamapps",
|
|
43
|
+
`appmanifest_${appId}.acf`
|
|
44
|
+
);
|
|
45
|
+
if (!fs.existsSync(acfPath)) {
|
|
46
|
+
logger.default.verbose(`File not found: ${acfPath}`);
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
const plaintext = fs.readFileSync(acfPath, "utf-8");
|
|
51
|
+
const json = acfParser.decode(plaintext);
|
|
52
|
+
return json;
|
|
53
|
+
} catch (err) {
|
|
54
|
+
logger.default.error(`Error parsing ACF file ${acfPath}:`, err);
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
64
57
|
}
|
|
65
58
|
function getSteamDepot(info, branch) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return {
|
|
75
|
-
buildId: depot.buildid,
|
|
76
|
-
timeUpdated: Number(depot.timeupdated),
|
|
77
|
-
};
|
|
59
|
+
const appId = getAppId();
|
|
60
|
+
const depot = info.data[appId]?.depots?.branches?.[!branch || branch === "main" ? "public" : branch];
|
|
61
|
+
if (!depot || typeof depot !== "object" || !("buildid" in depot) || !("timeupdated" in depot))
|
|
62
|
+
return null;
|
|
63
|
+
return {
|
|
64
|
+
buildId: depot.buildid,
|
|
65
|
+
timeUpdated: Number(depot.timeupdated)
|
|
66
|
+
};
|
|
78
67
|
}
|
|
79
68
|
function getSteamAcfDepot(acf) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
return {
|
|
89
|
-
buildId: appState.buildid,
|
|
90
|
-
timeUpdated: Number(appState.lastupdated),
|
|
91
|
-
};
|
|
69
|
+
const appId = getAppId();
|
|
70
|
+
const appState = acf.AppState;
|
|
71
|
+
if (!appState || typeof appState !== "object" || appState.appid !== appId || !("buildid" in appState) || !("lastupdated" in appState))
|
|
72
|
+
return null;
|
|
73
|
+
return {
|
|
74
|
+
buildId: appState.buildid,
|
|
75
|
+
timeUpdated: Number(appState.lastupdated)
|
|
76
|
+
};
|
|
92
77
|
}
|
|
93
78
|
function getLocalSteamDepot(steambeta) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return null;
|
|
100
|
-
return depot;
|
|
79
|
+
const acf = getSteamAcf(steambeta);
|
|
80
|
+
if (!acf) return null;
|
|
81
|
+
const depot = getSteamAcfDepot(acf);
|
|
82
|
+
if (!depot) return null;
|
|
83
|
+
return depot;
|
|
101
84
|
}
|
|
102
85
|
async function getRemoteSteamDepot(steambeta) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return depot;
|
|
86
|
+
const info = await fetchSteamInfo();
|
|
87
|
+
if (!info || !info.data) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
const depot = getSteamDepot(info, steambeta);
|
|
91
|
+
if (!depot) return null;
|
|
92
|
+
return depot;
|
|
111
93
|
}
|
|
112
94
|
let lastUpdateCheck = 0;
|
|
113
95
|
let lastUpdateAvailable = 0;
|
|
114
96
|
let lastUpdateResult = false;
|
|
115
97
|
const getLastSteamUpdateCheck = () => ({
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
98
|
+
attempt: lastUpdateCheck,
|
|
99
|
+
available: lastUpdateAvailable,
|
|
100
|
+
result: lastUpdateResult
|
|
119
101
|
});
|
|
120
|
-
exports.getLastSteamUpdateCheck = getLastSteamUpdateCheck;
|
|
121
102
|
const clearLastSteamUpdateCheck = () => {
|
|
122
|
-
|
|
103
|
+
lastUpdateResult = false;
|
|
123
104
|
};
|
|
124
|
-
exports.clearLastSteamUpdateCheck = clearLastSteamUpdateCheck;
|
|
125
105
|
async function hasSteamUpdate(steambeta) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
localDepot.timeUpdated < remoteDepot.timeUpdated;
|
|
136
|
-
lastUpdateResult = res;
|
|
137
|
-
return res;
|
|
106
|
+
lastUpdateCheck = Date.now();
|
|
107
|
+
const localDepot = getLocalSteamDepot(steambeta);
|
|
108
|
+
if (!localDepot) return false;
|
|
109
|
+
const remoteDepot = await getRemoteSteamDepot(steambeta);
|
|
110
|
+
if (!remoteDepot) return false;
|
|
111
|
+
lastUpdateAvailable = Date.now();
|
|
112
|
+
const res = localDepot.buildId !== remoteDepot.buildId || localDepot.timeUpdated < remoteDepot.timeUpdated;
|
|
113
|
+
lastUpdateResult = res;
|
|
114
|
+
return res;
|
|
138
115
|
}
|
|
139
|
-
|
|
116
|
+
exports.clearLastSteamUpdateCheck = clearLastSteamUpdateCheck;
|
|
117
|
+
exports.getAppId = getAppId;
|
|
118
|
+
exports.getLastSteamUpdateCheck = getLastSteamUpdateCheck;
|
|
119
|
+
exports.getLocalSteamDepot = getLocalSteamDepot;
|
|
120
|
+
exports.getRemoteSteamDepot = getRemoteSteamDepot;
|
|
121
|
+
exports.hasSteamUpdate = hasSteamUpdate;
|
|
122
|
+
exports.steamcmdDownloadGame = steamcmdDownloadGame;
|
|
123
|
+
exports.steamcmdDownloadSelf = steamcmdDownloadSelf;
|
|
124
|
+
//# sourceMappingURL=steam.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"steam.js","
|
|
1
|
+
{"version":3,"file":"steam.js","sources":["../../src/updater/steam.ts"],"sourcesContent":["import Logger from '@/logger';\nimport { GAME_INSTALL_DIR, STEAM_APP_ID, STEAMCMD_PATH } from '@/softconfig';\nimport { execSync } from 'node:child_process';\nimport { existsSync, readFileSync } from 'node:fs';\nimport path from 'node:path';\nimport acfParser from 'steam-acf2json';\n\nexport function getAppId() {\n return process.env.STEAM_APP_ID ?? STEAM_APP_ID;\n}\n\nexport function steamcmdDownloadSelf() {\n execSync(path.join(__dirname, '../../tools/install_steamcmd.sh'), {\n stdio: 'inherit',\n });\n}\n\nexport function steamcmdDownloadGame({\n steambeta,\n steambetaPassword,\n}: {\n steambeta?: string;\n steambetaPassword?: string;\n} = {}) {\n const args = [\n `+force_install_dir ${path.join(GAME_INSTALL_DIR, steambeta ?? 'main')}`,\n `+login anonymous`,\n `+app_update ${getAppId()}`,\n steambeta ? `-beta ${steambeta}` : null,\n steambeta && steambetaPassword\n ? `-betapassword ${steambetaPassword}`\n : null,\n '+quit',\n ].filter(Boolean);\n\n execSync(`${STEAMCMD_PATH} ${args.join(' ')}`, { stdio: 'inherit' });\n}\n\nexport type SteamInfo = {\n data: Record<\n string,\n {\n _change_number: number;\n _missing_token: boolean;\n _sha: string;\n _size: number;\n appid: number;\n common: unknown;\n config: unknown;\n depots: Record<\n string,\n {\n config: { oslist: 'linux' | 'windows' | 'macos' };\n }\n > & {\n branches: Record<\n string,\n {\n buildid: string;\n timeupdated: string;\n description?: string;\n }\n >;\n privatebranches: '1';\n };\n }\n >;\n status: 'success';\n};\n\nasync function fetchSteamInfo() {\n const appId = getAppId();\n const res = await fetch('https://api.steamcmd.net/v1/info/' + appId);\n const json = await res.json();\n return json as SteamInfo;\n}\n\nexport type SteamAcf = {\n AppState: {\n appid: string;\n buildid: string;\n lastupdated: string;\n };\n};\n\nfunction getSteamAcf(steambeta?: string) {\n const appId = getAppId();\n const installDir = path.join(GAME_INSTALL_DIR, steambeta ?? 'main');\n const acfPath = path.join(\n installDir,\n 'steamapps',\n `appmanifest_${appId}.acf`,\n );\n if (!existsSync(acfPath)) {\n Logger.verbose(`File not found: ${acfPath}`);\n return null;\n }\n try {\n const plaintext = readFileSync(acfPath, 'utf-8');\n const json = acfParser.decode(plaintext);\n return json as SteamAcf;\n } catch (err) {\n Logger.error(`Error parsing ACF file ${acfPath}:`, err);\n return null;\n }\n}\n\nfunction getSteamDepot(info: SteamInfo, branch?: string) {\n const appId = getAppId();\n const depot =\n info.data[appId]?.depots?.branches?.[\n !branch || branch === 'main' ? 'public' : branch\n ];\n if (\n !depot ||\n typeof depot !== 'object' ||\n !('buildid' in depot) ||\n !('timeupdated' in depot)\n )\n return null;\n return {\n buildId: depot.buildid,\n timeUpdated: Number(depot.timeupdated),\n };\n}\n\nfunction getSteamAcfDepot(acf: SteamAcf) {\n const appId = getAppId();\n const appState = acf.AppState;\n if (\n !appState ||\n typeof appState !== 'object' ||\n appState.appid !== appId ||\n !('buildid' in appState) ||\n !('lastupdated' in appState)\n )\n return null;\n return {\n buildId: appState.buildid,\n timeUpdated: Number(appState.lastupdated),\n };\n}\n\nexport function getLocalSteamDepot(steambeta?: string) {\n const acf = getSteamAcf(steambeta);\n if (!acf) return null;\n const depot = getSteamAcfDepot(acf);\n if (!depot) return null;\n return depot;\n}\n\nexport async function getRemoteSteamDepot(steambeta?: string) {\n const info = await fetchSteamInfo();\n if (!info || !info.data) {\n return null;\n }\n const depot = getSteamDepot(info, steambeta);\n if (!depot) return null;\n return depot;\n}\n\nlet lastUpdateCheck = 0;\nlet lastUpdateAvailable = 0;\nlet lastUpdateResult = false;\n\nexport const getLastSteamUpdateCheck = () => ({\n attempt: lastUpdateCheck,\n available: lastUpdateAvailable,\n result: lastUpdateResult,\n});\n\nexport const clearLastSteamUpdateCheck = () => {\n lastUpdateResult = false;\n};\n\nexport async function hasSteamUpdate(steambeta?: string) {\n lastUpdateCheck = Date.now();\n const localDepot = getLocalSteamDepot(steambeta);\n if (!localDepot) return false;\n\n const remoteDepot = await getRemoteSteamDepot(steambeta);\n if (!remoteDepot) return false;\n\n lastUpdateAvailable = Date.now();\n const res =\n localDepot.buildId !== remoteDepot.buildId ||\n localDepot.timeUpdated < remoteDepot.timeUpdated;\n lastUpdateResult = res;\n\n return res;\n}\n"],"names":["STEAM_APP_ID","execSync","GAME_INSTALL_DIR","STEAMCMD_PATH","existsSync","Logger","readFileSync"],"mappings":";;;;;;;;AAOO,SAAS,WAAW;AACzB,SAAO,QAAQ,IAAI,gBAAgBA,WAAAA;AACrC;AAEO,SAAS,uBAAuB;AACrCC,qBAAAA,SAAS,KAAK,KAAK,WAAW,iCAAiC,GAAG;AAAA,IAChE,OAAO;AAAA,EAAA,CACR;AACH;AAEO,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AACF,IAGI,IAAI;AACN,QAAM,OAAO;AAAA,IACX,sBAAsB,KAAK,KAAKC,WAAAA,kBAAkB,aAAa,MAAM,CAAC;AAAA,IACtE;AAAA,IACA,eAAe,UAAU;AAAA,IACzB,YAAY,SAAS,SAAS,KAAK;AAAA,IACnC,aAAa,oBACT,iBAAiB,iBAAiB,KAClC;AAAA,IACJ;AAAA,EAAA,EACA,OAAO,OAAO;AAEhBD,qBAAAA,SAAS,GAAGE,wBAAa,IAAI,KAAK,KAAK,GAAG,CAAC,IAAI,EAAE,OAAO,UAAA,CAAW;AACrE;AAkCA,eAAe,iBAAiB;AAC9B,QAAM,QAAQ,SAAA;AACd,QAAM,MAAM,MAAM,MAAM,sCAAsC,KAAK;AACnE,QAAM,OAAO,MAAM,IAAI,KAAA;AACvB,SAAO;AACT;AAUA,SAAS,YAAY,WAAoB;AACvC,QAAM,QAAQ,SAAA;AACd,QAAM,aAAa,KAAK,KAAKD,WAAAA,kBAAkB,aAAa,MAAM;AAClE,QAAM,UAAU,KAAK;AAAA,IACnB;AAAA,IACA;AAAA,IACA,eAAe,KAAK;AAAA,EAAA;AAEtB,MAAI,CAACE,GAAAA,WAAW,OAAO,GAAG;AACxBC,WAAAA,QAAO,QAAQ,mBAAmB,OAAO,EAAE;A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