@roster-lock/match-agent 0.2.0 → 0.4.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/client/dist/assets/index-D2395vmC.css +1 -0
- package/client/dist/assets/index-DcKsa72V.js +125 -0
- package/client/dist/index.html +2 -2
- package/client/e2e/lib/env.ts +50 -0
- package/client/e2e/lib/fileDialog.ts +31 -0
- package/client/e2e/lib/mockGamepad.ts +71 -0
- package/client/e2e/lib/onscreenKeyboard.ts +32 -0
- package/client/e2e/playwright.config.ts +48 -0
- package/client/e2e/tests/gamepad-only.spec.ts +274 -0
- package/client/e2e/tests/keyboard-only.spec.ts +67 -0
- package/client/e2e/tsconfig.json +15 -0
- package/client/node_modules/.bin/playwright +17 -0
- package/client/node_modules/.bin/roster-lock-plugin-manager +17 -0
- package/client/node_modules/.vite/deps/@rjsf_core.js +95 -95
- package/client/node_modules/.vite/deps/@rjsf_validator-ajv8.js +4 -3
- package/client/node_modules/.vite/deps/@roster-lock_ts-client.js +25 -25
- package/client/node_modules/.vite/deps/@roster-lock_types.js +2 -1
- package/client/node_modules/.vite/deps/@roster-lock_utils.js +2 -1
- package/client/node_modules/.vite/deps/_metadata.json +27 -27
- package/client/node_modules/.vite/deps/{chunk-NE7PXY4V.js → chunk-3HBL6DQ6.js} +99 -98
- package/client/node_modules/.vite/deps/{chunk-NE7PXY4V.js.map → chunk-3HBL6DQ6.js.map} +3 -3
- package/client/node_modules/.vite/deps/{chunk-4D2L7OBZ.js → chunk-3IRPLLFB.js} +498 -501
- package/client/node_modules/.vite/deps/{chunk-4D2L7OBZ.js.map → chunk-3IRPLLFB.js.map} +1 -1
- package/client/node_modules/.vite/deps/{chunk-I55GDNGV.js → chunk-7DRNB6P7.js} +5 -5
- package/client/node_modules/.vite/deps/{chunk-77TXW5ZT.js → chunk-FFVS6IUX.js} +6 -6
- package/client/node_modules/.vite/deps/{chunk-5KLROPUR.js → chunk-G44QLPFQ.js} +6 -6
- package/client/node_modules/.vite/deps/{chunk-IIDO6PKU.js → chunk-QTQN6EZX.js} +98 -98
- package/client/node_modules/.vite/deps/chunk-QTQN6EZX.js.map +7 -0
- package/client/node_modules/.vite/deps/chunk-WMTNK64S.js +1 -0
- package/client/node_modules/.vite/deps/react-dom.js +3 -2
- package/client/node_modules/.vite/deps/react-dom_client.js +12 -12
- package/client/node_modules/.vite/deps/react-dom_client.js.map +1 -1
- package/client/node_modules/.vite/deps/react-router-dom.js +42 -9
- package/client/node_modules/.vite/deps/react.js +2 -1
- package/client/node_modules/.vite/deps/react_jsx-dev-runtime.js +5 -5
- package/client/node_modules/.vite/deps/react_jsx-runtime.js +3 -2
- package/client/package.json +4 -1
- package/client/src/App.tsx +23 -14
- package/client/src/NavBar.tsx +15 -5
- package/client/src/api/matchAgent.ts +208 -5
- package/client/src/bridge/hostBridge.ts +39 -10
- package/client/src/components/FullScreenMenu.tsx +32 -0
- package/client/src/components/GameLauncherSettingsForm.tsx +80 -5
- package/client/src/components/InputHints.tsx +37 -0
- package/client/src/components/InstallGameLauncherLightbox.tsx +27 -14
- package/client/src/components/OnScreenFileDialog.tsx +83 -0
- package/client/src/components/OnScreenKeyboard.tsx +75 -0
- package/client/src/components/Selection/PieceCard.tsx +29 -4
- package/client/src/components/Selection/PiecePreviewPanel.tsx +48 -0
- package/client/src/components/Selection/PieceTypeSection.tsx +124 -46
- package/client/src/components/Selection/PlayerSelectionPanel.tsx +1 -5
- package/client/src/components/Selection/index.tsx +72 -47
- package/client/src/context/GlobalNavContext.tsx +340 -0
- package/client/src/context/SelectionSourceContext.tsx +26 -0
- package/client/src/hooks/useCursorInput.ts +66 -24
- package/client/src/hooks/useDownloadedPieceVersions.ts +39 -0
- package/client/src/hooks/useGridColumns.ts +29 -0
- package/client/src/hooks/useInView.ts +32 -0
- package/client/src/hooks/usePiecePreview.ts +124 -0
- package/client/src/pages/Controls/index.tsx +126 -0
- package/client/src/pages/Game/index.tsx +11 -15
- package/client/src/pages/MatchMaking/index.tsx +14 -7
- package/client/src/pages/PreviewRoster/index.tsx +118 -0
- package/client/src/styles/global.css +355 -6
- package/client/src/utils/inputLabels.ts +25 -0
- package/client/test-results/.last-run.json +4 -0
- package/client/tsconfig.tsbuildinfo +1 -1
- package/dist/config/index.js +2 -0
- package/dist/config/index.js.map +1 -1
- package/dist/config/inputBindings.js +40 -0
- package/dist/config/inputBindings.js.map +1 -0
- package/dist/config/manage.js +1 -0
- package/dist/config/manage.js.map +1 -1
- package/dist/handle-room/version-1/game-launcher/binaries.js +36 -0
- package/dist/handle-room/version-1/game-launcher/binaries.js.map +1 -0
- package/dist/handle-room/version-1/game-launcher/listing.js +24 -0
- package/dist/handle-room/version-1/game-launcher/listing.js.map +1 -0
- package/dist/handle-room/version-1/game-launcher/preview.js +38 -0
- package/dist/handle-room/version-1/game-launcher/preview.js.map +1 -0
- package/dist/handle-room/version-1/game-launcher/process.js +52 -0
- package/dist/handle-room/version-1/game-launcher/process.js.map +1 -0
- package/dist/handle-room/version-1/game-launcher/router.js +32 -0
- package/dist/handle-room/version-1/game-launcher/router.js.map +1 -0
- package/dist/handle-room/version-1/game-launcher/settings.js +49 -0
- package/dist/handle-room/version-1/game-launcher/settings.js.map +1 -0
- package/dist/handle-room/version-1/game-launcher/shared.js +28 -0
- package/dist/handle-room/version-1/game-launcher/shared.js.map +1 -0
- package/dist/handle-room/version-1/game-launcher/start.js +76 -0
- package/dist/handle-room/version-1/game-launcher/start.js.map +1 -0
- package/dist/handle-room/version-1/game-launcher/version.js +63 -0
- package/dist/handle-room/version-1/game-launcher/version.js.map +1 -0
- package/dist/handle-room/version-1/globals/FolderDB/SQLFolderDB/ensurePieceExists.js +22 -9
- package/dist/handle-room/version-1/globals/FolderDB/SQLFolderDB/ensurePieceExists.js.map +1 -1
- package/dist/handle-room/version-1/globals/FolderDB/SQLFolderDB/schema.js +50 -1
- package/dist/handle-room/version-1/globals/FolderDB/SQLFolderDB/schema.js.map +1 -1
- package/dist/handle-room/version-1/index.js +15 -15
- package/dist/handle-room/version-1/index.js.map +1 -1
- package/dist/handle-room/version-1/input-bindings.js +22 -0
- package/dist/handle-room/version-1/input-bindings.js.map +1 -0
- package/dist/handle-room/version-1/room-handler-bridge/exchange-and-download-selections.js +2 -1
- package/dist/handle-room/version-1/room-handler-bridge/exchange-and-download-selections.js.map +1 -1
- package/dist/handle-room/version-1/room-handler-bridge/http-handler.js +1 -1
- package/dist/handle-room/version-1/room-handler-bridge/http-handler.js.map +1 -1
- package/dist/handle-room/version-1/room-handler-bridge/steps.js +2 -1
- package/dist/handle-room/version-1/room-handler-bridge/steps.js.map +1 -1
- package/dist/handle-room/version-1/room-handler-bridge/ws-handler.js +2 -2
- package/dist/handle-room/version-1/room-handler-bridge/ws-handler.js.map +1 -1
- package/dist/index.js +18 -4
- package/dist/index.js.map +1 -1
- package/dist/util-routers/file-system/env.js +3 -0
- package/dist/util-routers/file-system/env.js.map +1 -0
- package/dist/util-routers/file-system/index.js +31 -0
- package/dist/util-routers/file-system/index.js.map +1 -0
- package/dist/util-routers/file-system/list.js +50 -0
- package/dist/util-routers/file-system/list.js.map +1 -0
- package/dist/util-routers/file-system/resolve-within-root.js +18 -0
- package/dist/util-routers/file-system/resolve-within-root.js.map +1 -0
- package/dist/util-routers/file-system/roster-lock.js +56 -0
- package/dist/util-routers/file-system/roster-lock.js.map +1 -0
- package/dist/utils/pick-file.js +82 -0
- package/dist/utils/pick-file.js.map +1 -0
- package/dist/utils/pick-folder.js +84 -0
- package/dist/utils/pick-folder.js.map +1 -0
- package/package.json +10 -7
- package/src/config/index.ts +8 -3
- package/src/config/inputBindings.ts +56 -0
- package/src/config/manage.ts +7 -0
- package/src/handle-room/version-1/game-launcher/binaries.ts +52 -0
- package/src/handle-room/version-1/game-launcher/listing.ts +36 -0
- package/src/handle-room/version-1/game-launcher/preview.ts +54 -0
- package/src/handle-room/version-1/game-launcher/process.ts +75 -0
- package/src/handle-room/version-1/game-launcher/router.ts +42 -0
- package/src/handle-room/version-1/game-launcher/settings.ts +58 -0
- package/src/handle-room/version-1/game-launcher/shared.ts +34 -0
- package/src/handle-room/version-1/game-launcher/start.ts +113 -0
- package/src/handle-room/version-1/game-launcher/version.ts +85 -0
- package/src/handle-room/version-1/globals/FolderDB/SQLFolderDB/ensurePieceExists.ts +39 -14
- package/src/handle-room/version-1/globals/FolderDB/SQLFolderDB/schema.ts +83 -1
- package/src/handle-room/version-1/globals/FolderDB/types.ts +24 -0
- package/src/handle-room/version-1/globals/types.ts +24 -2
- package/src/handle-room/version-1/index.ts +27 -25
- package/src/handle-room/version-1/input-bindings.ts +19 -0
- package/src/handle-room/version-1/room-handler-bridge/exchange-and-download-selections.ts +4 -1
- package/src/handle-room/version-1/room-handler-bridge/http-handler.ts +4 -1
- package/src/handle-room/version-1/room-handler-bridge/steps.ts +8 -0
- package/src/handle-room/version-1/room-handler-bridge/ws-handler.ts +2 -2
- package/src/index.ts +42 -10
- package/src/util-routers/file-system/env.ts +7 -0
- package/src/util-routers/file-system/index.ts +23 -0
- package/src/util-routers/file-system/list.ts +62 -0
- package/src/util-routers/file-system/resolve-within-root.ts +25 -0
- package/src/util-routers/file-system/roster-lock.ts +74 -0
- package/src/utils/pick-file.ts +81 -0
- package/src/utils/pick-folder.ts +92 -0
- package/tests/integration/filesystem.test.ts +117 -0
- package/tests/integration/game-launcher-binaries.test.ts +263 -0
- package/tests/integration/game-launcher-game-complete.test.ts +111 -0
- package/tests/integration/game-launcher-preview.test.ts +107 -0
- package/tests/integration/game-launcher-settings.test.ts +123 -8
- package/tests/integration/game-processes-ws.test.ts +122 -0
- package/tests/integration/helpers/fakeFolderDB.ts +16 -0
- package/tests/integration/helpers/fakePluginRuntime.ts +10 -1
- package/tests/integration/helpers/relayHarness.ts +24 -0
- package/tests/integration/helpers/server.ts +23 -3
- package/tests/integration/input-bindings.test.ts +94 -0
- package/tests/integration/piece-ensure-ws.test.ts +1 -1
- package/tests/integration/piece-files.test.ts +1 -1
- package/tests/integration/relay-protocol.test.ts +100 -0
- package/tests/integration/roster-lock.test.ts +86 -0
- package/tests/integration/sync-dl.test.ts +1 -1
- package/vitest.config.ts +7 -1
- package/client/dist/assets/index-DeYshswm.js +0 -125
- package/client/dist/assets/index-gxAuIfGQ.css +0 -1
- package/client/node_modules/.vite/deps/chunk-IIDO6PKU.js.map +0 -7
- package/client/node_modules/.vite/deps_temp_ab51ebe9/package.json +0 -3
- package/dist/handle-room/version-1/game-launcher.js +0 -181
- package/dist/handle-room/version-1/game-launcher.js.map +0 -1
- package/src/handle-room/version-1/game-launcher.ts +0 -263
- /package/client/node_modules/.vite/deps/{chunk-I55GDNGV.js.map → chunk-7DRNB6P7.js.map} +0 -0
- /package/client/node_modules/.vite/deps/{chunk-77TXW5ZT.js.map → chunk-FFVS6IUX.js.map} +0 -0
- /package/client/node_modules/.vite/deps/{chunk-5KLROPUR.js.map → chunk-G44QLPFQ.js.map} +0 -0
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
require_react_dom
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FFVS6IUX.js";
|
|
4
4
|
import {
|
|
5
5
|
require_react
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7DRNB6P7.js";
|
|
7
7
|
import {
|
|
8
8
|
__commonJS,
|
|
9
9
|
__toESM
|
|
10
10
|
} from "./chunk-WMTNK64S.js";
|
|
11
11
|
|
|
12
|
-
//
|
|
12
|
+
// ../../../node_modules/.pnpm/cookie@1.1.1/node_modules/cookie/dist/index.js
|
|
13
13
|
var require_dist = __commonJS({
|
|
14
|
-
"
|
|
14
|
+
"../../../node_modules/.pnpm/cookie@1.1.1/node_modules/cookie/dist/index.js"(exports) {
|
|
15
15
|
"use strict";
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.parseCookie = parseCookie;
|
|
@@ -258,9 +258,9 @@ var require_dist = __commonJS({
|
|
|
258
258
|
}
|
|
259
259
|
});
|
|
260
260
|
|
|
261
|
-
//
|
|
261
|
+
// ../../../node_modules/.pnpm/set-cookie-parser@2.7.2/node_modules/set-cookie-parser/lib/set-cookie.js
|
|
262
262
|
var require_set_cookie = __commonJS({
|
|
263
|
-
"
|
|
263
|
+
"../../../node_modules/.pnpm/set-cookie-parser@2.7.2/node_modules/set-cookie-parser/lib/set-cookie.js"(exports, module) {
|
|
264
264
|
"use strict";
|
|
265
265
|
var defaultParseOptions = {
|
|
266
266
|
decodeValues: true,
|
|
@@ -441,7 +441,7 @@ var require_set_cookie = __commonJS({
|
|
|
441
441
|
}
|
|
442
442
|
});
|
|
443
443
|
|
|
444
|
-
//
|
|
444
|
+
// ../../../node_modules/.pnpm/react-router@7.18.0_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/react-router/dist/development/chunk-4ZMWKKQ3.mjs
|
|
445
445
|
var React = __toESM(require_react(), 1);
|
|
446
446
|
var React2 = __toESM(require_react(), 1);
|
|
447
447
|
var React3 = __toESM(require_react(), 1);
|
|
@@ -11938,7 +11938,7 @@ function encodeLocation(to) {
|
|
|
11938
11938
|
};
|
|
11939
11939
|
}
|
|
11940
11940
|
|
|
11941
|
-
//
|
|
11941
|
+
// ../../../node_modules/.pnpm/react-router@7.18.0_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/react-router/dist/development/chunk-E4MTK73K.mjs
|
|
11942
11942
|
var React12 = __toESM(require_react(), 1);
|
|
11943
11943
|
var React22 = __toESM(require_react(), 1);
|
|
11944
11944
|
var import_cookie = __toESM(require_dist(), 1);
|
|
@@ -14321,7 +14321,7 @@ function getHydrationData({
|
|
|
14321
14321
|
return hydrationData;
|
|
14322
14322
|
}
|
|
14323
14323
|
|
|
14324
|
-
//
|
|
14324
|
+
// ../../../node_modules/.pnpm/react-router@7.18.0_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/react-router/dist/development/dom-export.mjs
|
|
14325
14325
|
var React13 = __toESM(require_react(), 1);
|
|
14326
14326
|
var ReactDOM = __toESM(require_react_dom(), 1);
|
|
14327
14327
|
var React23 = __toESM(require_react(), 1);
|
|
@@ -14673,8 +14673,41 @@ export {
|
|
|
14673
14673
|
/*! Bundled license information:
|
|
14674
14674
|
|
|
14675
14675
|
react-router/dist/development/chunk-4ZMWKKQ3.mjs:
|
|
14676
|
+
(**
|
|
14677
|
+
* react-router v7.18.0
|
|
14678
|
+
*
|
|
14679
|
+
* Copyright (c) Remix Software Inc.
|
|
14680
|
+
*
|
|
14681
|
+
* This source code is licensed under the MIT license found in the
|
|
14682
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
14683
|
+
*
|
|
14684
|
+
* @license MIT
|
|
14685
|
+
*)
|
|
14686
|
+
|
|
14676
14687
|
react-router/dist/development/chunk-E4MTK73K.mjs:
|
|
14688
|
+
(**
|
|
14689
|
+
* react-router v7.18.0
|
|
14690
|
+
*
|
|
14691
|
+
* Copyright (c) Remix Software Inc.
|
|
14692
|
+
*
|
|
14693
|
+
* This source code is licensed under the MIT license found in the
|
|
14694
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
14695
|
+
*
|
|
14696
|
+
* @license MIT
|
|
14697
|
+
*)
|
|
14698
|
+
|
|
14677
14699
|
react-router/dist/development/dom-export.mjs:
|
|
14700
|
+
(**
|
|
14701
|
+
* react-router v7.18.0
|
|
14702
|
+
*
|
|
14703
|
+
* Copyright (c) Remix Software Inc.
|
|
14704
|
+
*
|
|
14705
|
+
* This source code is licensed under the MIT license found in the
|
|
14706
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
14707
|
+
*
|
|
14708
|
+
* @license MIT
|
|
14709
|
+
*)
|
|
14710
|
+
|
|
14678
14711
|
react-router/dist/development/index.mjs:
|
|
14679
14712
|
(**
|
|
14680
14713
|
* react-router v7.18.0
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
require_react
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7DRNB6P7.js";
|
|
4
4
|
import {
|
|
5
5
|
__commonJS
|
|
6
6
|
} from "./chunk-WMTNK64S.js";
|
|
7
7
|
|
|
8
|
-
//
|
|
8
|
+
// ../../../node_modules/.pnpm/react@19.2.7/node_modules/react/cjs/react-jsx-dev-runtime.development.js
|
|
9
9
|
var require_react_jsx_dev_runtime_development = __commonJS({
|
|
10
|
-
"
|
|
10
|
+
"../../../node_modules/.pnpm/react@19.2.7/node_modules/react/cjs/react-jsx-dev-runtime.development.js"(exports) {
|
|
11
11
|
"use strict";
|
|
12
12
|
(function() {
|
|
13
13
|
function getComponentNameFromType(type) {
|
|
@@ -251,9 +251,9 @@ var require_react_jsx_dev_runtime_development = __commonJS({
|
|
|
251
251
|
}
|
|
252
252
|
});
|
|
253
253
|
|
|
254
|
-
//
|
|
254
|
+
// ../../../node_modules/.pnpm/react@19.2.7/node_modules/react/jsx-dev-runtime.js
|
|
255
255
|
var require_jsx_dev_runtime = __commonJS({
|
|
256
|
-
"
|
|
256
|
+
"../../../node_modules/.pnpm/react@19.2.7/node_modules/react/jsx-dev-runtime.js"(exports, module) {
|
|
257
257
|
if (false) {
|
|
258
258
|
module.exports = null;
|
|
259
259
|
} else {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
require_jsx_runtime
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-G44QLPFQ.js";
|
|
4
|
+
import "./chunk-7DRNB6P7.js";
|
|
5
5
|
import "./chunk-WMTNK64S.js";
|
|
6
6
|
export default require_jsx_runtime();
|
|
7
|
+
//# sourceMappingURL=react_jsx-runtime.js.map
|
package/client/package.json
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
"scripts": {
|
|
8
8
|
"dev": "vite",
|
|
9
9
|
"build": "tsc -b && vite build",
|
|
10
|
-
"preview": "vite preview"
|
|
10
|
+
"preview": "vite preview",
|
|
11
|
+
"test:e2e": "playwright test -c e2e/playwright.config.ts"
|
|
11
12
|
},
|
|
12
13
|
"dependencies": {
|
|
13
14
|
"@rjsf/core": "^6.8.0",
|
|
@@ -21,6 +22,8 @@
|
|
|
21
22
|
"react-router-dom": "^7.6.2"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
25
|
+
"@playwright/test": "^1.48.0",
|
|
26
|
+
"@roster-lock/plugin-runtime": "workspace:*",
|
|
24
27
|
"@types/react": "^19.1.2",
|
|
25
28
|
"@types/react-dom": "^19.1.2",
|
|
26
29
|
"@vitejs/plugin-react": "^4.4.1",
|
package/client/src/App.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import { MatchAgentProvider, useMatchAgent } from "./context/MatchAgentContext";
|
|
|
3
3
|
import { IdentityProvider } from "./context/IdentityContext";
|
|
4
4
|
import { JoinSettingsProvider } from "./context/JoinSettingsContext";
|
|
5
5
|
import { DownloadSessionProvider } from "./context/DownloadSessionContext";
|
|
6
|
+
import { GlobalNavProvider } from "./context/GlobalNavContext";
|
|
6
7
|
import { ConnectPage } from "./pages/Connect";
|
|
7
8
|
import { JoinSettingsPage } from "./pages/JoinSettings";
|
|
8
9
|
import { GameLauncherListPage } from "./pages/GameLauncher";
|
|
@@ -10,6 +11,8 @@ import { GameLauncherDetailPage } from "./pages/GameLauncher/Detail";
|
|
|
10
11
|
import { MatchMakingPage } from "./pages/MatchMaking";
|
|
11
12
|
import { DownloadPage } from "./pages/Download";
|
|
12
13
|
import { GameStatusPage } from "./pages/Game";
|
|
14
|
+
import { ControlsPage } from "./pages/Controls";
|
|
15
|
+
import { PreviewRosterPage } from "./pages/PreviewRoster";
|
|
13
16
|
import { NavBar } from "./NavBar";
|
|
14
17
|
import { RequireConnection } from "./components/RequireConnection";
|
|
15
18
|
|
|
@@ -37,20 +40,26 @@ function ConnectOrApp(){
|
|
|
37
40
|
|
|
38
41
|
return (
|
|
39
42
|
<BrowserRouter>
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
<GlobalNavProvider>
|
|
44
|
+
<NavBar />
|
|
45
|
+
<main id="page-content">
|
|
46
|
+
<Routes>
|
|
47
|
+
<Route path="/" element={<Navigate to="/match-making" replace />} />
|
|
48
|
+
<Route path="/connect" element={<ConnectPage />} />
|
|
49
|
+
<Route path="/join-settings" element={<RequireConnection><JoinSettingsPage /></RequireConnection>} />
|
|
50
|
+
<Route path="/game-launcher" element={<RequireConnection><GameLauncherListPage /></RequireConnection>} />
|
|
51
|
+
<Route
|
|
52
|
+
path="/game-launcher/:pluginName"
|
|
53
|
+
element={<RequireConnection><GameLauncherDetailPage /></RequireConnection>}
|
|
54
|
+
/>
|
|
55
|
+
<Route path="/match-making" element={<RequireConnection><MatchMakingPage /></RequireConnection>} />
|
|
56
|
+
<Route path="/download" element={<RequireConnection><DownloadPage /></RequireConnection>} />
|
|
57
|
+
<Route path="/game" element={<RequireConnection><GameStatusPage /></RequireConnection>} />
|
|
58
|
+
<Route path="/controls" element={<RequireConnection><ControlsPage /></RequireConnection>} />
|
|
59
|
+
<Route path="/preview-roster" element={<RequireConnection><PreviewRosterPage /></RequireConnection>} />
|
|
60
|
+
</Routes>
|
|
61
|
+
</main>
|
|
62
|
+
</GlobalNavProvider>
|
|
54
63
|
</BrowserRouter>
|
|
55
64
|
)
|
|
56
65
|
}
|
package/client/src/NavBar.tsx
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import { Link } from "react-router-dom";
|
|
2
2
|
|
|
3
|
+
// Shared with FullScreenMenu so a gamepad's Start-button menu (see
|
|
4
|
+
// GlobalNavContext) lists exactly the same destinations as this bar.
|
|
5
|
+
export const NAV_LINKS = [
|
|
6
|
+
{ to: "/match-making", label: "Match Making" },
|
|
7
|
+
{ to: "/game", label: "Games" },
|
|
8
|
+
{ to: "/join-settings", label: "Join Settings" },
|
|
9
|
+
{ to: "/game-launcher", label: "Game Launchers" },
|
|
10
|
+
{ to: "/preview-roster", label: "Preview Roster" },
|
|
11
|
+
{ to: "/controls", label: "Controls" },
|
|
12
|
+
{ to: "/connect", label: "Connect" },
|
|
13
|
+
];
|
|
14
|
+
|
|
3
15
|
export function NavBar() {
|
|
4
16
|
return (
|
|
5
17
|
<nav className="nav-bar">
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
<Link to="/game-launcher">Game Launchers</Link>
|
|
10
|
-
<Link to="/connect">Connect</Link>
|
|
18
|
+
{NAV_LINKS.map((link) => (
|
|
19
|
+
<Link key={link.to} to={link.to}>{link.label}</Link>
|
|
20
|
+
))}
|
|
11
21
|
</nav>
|
|
12
22
|
);
|
|
13
23
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// Thin wrappers around match-agent's own /v1/game-launcher/* control routes
|
|
2
|
-
// (see core/match-agent/src/handle-room/version-1/game-launcher
|
|
2
|
+
// (see core/match-agent/src/handle-room/version-1/game-launcher/). These are
|
|
3
3
|
// specific to this app (configuring/launching a local game launcher) rather
|
|
4
4
|
// than something a game itself needs, so they live here instead of
|
|
5
5
|
// @roster-lock/ts-client - see that package's README/index.ts for the
|
|
6
6
|
// asset-loading surface games actually consume.
|
|
7
7
|
|
|
8
|
-
import { PlatformTarget } from "@roster-lock/types";
|
|
8
|
+
import { PlatformTarget, PiecePreview, RosterLockV1Config, RosterLockPiece } from "@roster-lock/types";
|
|
9
|
+
import { MessageBridge } from "@roster-lock/utils";
|
|
9
10
|
|
|
10
11
|
export type GameLauncherLocalSettings = {
|
|
11
12
|
binaryLocation?: string,
|
|
@@ -40,7 +41,7 @@ async function matchAgentFetch(
|
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
// Appended as query params on any game-launcher route that resolves a
|
|
43
|
-
// concrete binary - see resolveTarget in game-launcher.ts. Omitting `target`
|
|
44
|
+
// concrete binary - see resolveTarget in game-launcher/shared.ts. Omitting `target`
|
|
44
45
|
// entirely (the ordinary case) leaves match-agent to default to its own
|
|
45
46
|
// current host; passing one is only for the deliberate exception (see
|
|
46
47
|
// docs/v2/binary-location.md).
|
|
@@ -84,6 +85,22 @@ export async function setGameLauncherSettings(
|
|
|
84
85
|
});
|
|
85
86
|
}
|
|
86
87
|
|
|
88
|
+
// Opens a native OS folder-picker on match-agent's own host (see
|
|
89
|
+
// core/match-agent/src/utils/pick-folder.ts for why a browser <input> can't
|
|
90
|
+
// do this itself) and returns the chosen absolute path. `cancelled: true`
|
|
91
|
+
// means the user closed the dialog without picking anything; the picker
|
|
92
|
+
// itself may not exist on a headless/remote match-agent, in which case this
|
|
93
|
+
// throws and the caller should fall back to manual text entry.
|
|
94
|
+
export async function pickGameLauncherBinaryLocation(
|
|
95
|
+
matchAgentUrl: string, authCode: string, pluginName: string
|
|
96
|
+
): Promise<{ path: string } | { cancelled: true }> {
|
|
97
|
+
const res = await matchAgentFetch(
|
|
98
|
+
matchAgentUrl, authCode, `/v1/game-launcher/${encodeURIComponent(pluginName)}/pick-binary-location`,
|
|
99
|
+
{ method: "POST" }
|
|
100
|
+
);
|
|
101
|
+
return res.json();
|
|
102
|
+
}
|
|
103
|
+
|
|
87
104
|
export async function getGameLauncherVersion(
|
|
88
105
|
matchAgentUrl: string, authCode: string, pluginName: string, target?: PlatformTarget
|
|
89
106
|
): Promise<{ local: { title: string, id: string }, supported: { title: string, id: string } }> {
|
|
@@ -102,13 +119,92 @@ export async function validateGameLauncherBinaryLocation(
|
|
|
102
119
|
return res.json();
|
|
103
120
|
}
|
|
104
121
|
|
|
122
|
+
export async function validateGameLauncherGameConfig(
|
|
123
|
+
matchAgentUrl: string, authCode: string, pluginName: string, gameConfig: unknown, rosterConfig: unknown
|
|
124
|
+
): Promise<Array<string>> {
|
|
125
|
+
const res = await matchAgentFetch(
|
|
126
|
+
matchAgentUrl, authCode, `/v1/game-launcher/${encodeURIComponent(pluginName)}/validate-game-config`,
|
|
127
|
+
{
|
|
128
|
+
method: "POST",
|
|
129
|
+
headers: { "Content-Type": "application/json" },
|
|
130
|
+
body: JSON.stringify({ gameConfig, rosterConfig }),
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
const { problems } = await res.json();
|
|
134
|
+
return problems;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// `source` says which of the plugin's two preview functions answered:
|
|
138
|
+
// "piece" is a real preview read out of that piece's downloaded assets,
|
|
139
|
+
// "default" the plugin's generic engine placeholder for a piece that isn't
|
|
140
|
+
// downloaded yet, null when neither produced anything. A selection UI ranks
|
|
141
|
+
// those differently against the roster author's own humanInfo.image - see
|
|
142
|
+
// match-agent's game-launcher/preview.ts.
|
|
143
|
+
export type PiecePreviewResult = {
|
|
144
|
+
preview: PiecePreview | null,
|
|
145
|
+
source: "piece" | "default" | null,
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export async function getGameLauncherPreview(
|
|
149
|
+
matchAgentUrl: string, authCode: string, pluginName: string,
|
|
150
|
+
engine: RosterLockV1Config["engine"], pieceType: string, piece: Pick<RosterLockPiece, "version" | "pathVariables">
|
|
151
|
+
): Promise<PiecePreviewResult> {
|
|
152
|
+
const res = await matchAgentFetch(
|
|
153
|
+
matchAgentUrl, authCode, `/v1/game-launcher/${encodeURIComponent(pluginName)}/preview`,
|
|
154
|
+
{
|
|
155
|
+
method: "POST",
|
|
156
|
+
headers: { "Content-Type": "application/json" },
|
|
157
|
+
body: JSON.stringify({ engine, pieceType, piece }),
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
const { preview, source } = await res.json();
|
|
161
|
+
return { preview: preview ?? null, source: source ?? null };
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// No binaryLocation needs to already be configured to call this - getBinary
|
|
165
|
+
// (see GameLauncherPlugin.getBinary) acquires one from scratch, rather than
|
|
166
|
+
// updating an already-set path, so this returns the one it just persisted.
|
|
105
167
|
export async function updateGameLauncherBinary(
|
|
106
168
|
matchAgentUrl: string, authCode: string, pluginName: string, target?: PlatformTarget
|
|
107
|
-
): Promise<
|
|
108
|
-
await matchAgentFetch(
|
|
169
|
+
): Promise<{ binaryLocation: string }> {
|
|
170
|
+
const res = await matchAgentFetch(
|
|
109
171
|
matchAgentUrl, authCode, withTarget(`/v1/game-launcher/${encodeURIComponent(pluginName)}/update`, target),
|
|
110
172
|
{ method: "POST" }
|
|
111
173
|
);
|
|
174
|
+
return res.json();
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export type DownloadedGameLauncherBinary = {
|
|
178
|
+
binaryLocation: string,
|
|
179
|
+
version: { title: string, id: string } | null,
|
|
180
|
+
active: boolean,
|
|
181
|
+
downloadedAt: number | null,
|
|
182
|
+
lastUsedAt: number | null,
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
// Everything getBinary has ever put under this plugin's own dataDir (see
|
|
186
|
+
// GameLauncher.listBinaries), so a settings UI can show what's accumulating
|
|
187
|
+
// on disk and offer removeGameLauncherBinary below instead of letting old
|
|
188
|
+
// engine versions pile up unnoticed. `version: null` means the folder is
|
|
189
|
+
// there but doesn't look like a real install any more (e.g. partially
|
|
190
|
+
// deleted by hand) - still listed, just not a candidate anyone would pick.
|
|
191
|
+
export async function listGameLauncherBinaries(
|
|
192
|
+
matchAgentUrl: string, authCode: string, pluginName: string, target?: PlatformTarget
|
|
193
|
+
): Promise<Array<DownloadedGameLauncherBinary>> {
|
|
194
|
+
const res = await matchAgentFetch(
|
|
195
|
+
matchAgentUrl, authCode, withTarget(`/v1/game-launcher/${encodeURIComponent(pluginName)}/binaries`, target)
|
|
196
|
+
);
|
|
197
|
+
return res.json();
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export async function removeGameLauncherBinary(
|
|
201
|
+
matchAgentUrl: string, authCode: string, pluginName: string, binaryLocation: string
|
|
202
|
+
): Promise<void> {
|
|
203
|
+
const params = new URLSearchParams({ binaryLocation });
|
|
204
|
+
await matchAgentFetch(
|
|
205
|
+
matchAgentUrl, authCode, `/v1/game-launcher/${encodeURIComponent(pluginName)}/binaries?${params.toString()}`,
|
|
206
|
+
{ method: "DELETE" }
|
|
207
|
+
);
|
|
112
208
|
}
|
|
113
209
|
|
|
114
210
|
export async function startGameLauncher(
|
|
@@ -148,6 +244,27 @@ export async function listGameProcesses(
|
|
|
148
244
|
return res.json();
|
|
149
245
|
}
|
|
150
246
|
|
|
247
|
+
// WS counterpart to listGameProcesses (see game-launcher/process.ts's gameProcessesWs)
|
|
248
|
+
// - pushes the current snapshot immediately and again on every later
|
|
249
|
+
// start/exit, so a caller like pages/Game doesn't have to poll. Returns an
|
|
250
|
+
// unsubscribe function that closes the socket.
|
|
251
|
+
export function subscribeToGameProcesses(
|
|
252
|
+
matchAgentUrl: string, authCode: string,
|
|
253
|
+
onUpdate: (processes: Array<GameProcessSummary>) => void, onError: (error: Error) => void
|
|
254
|
+
): () => void {
|
|
255
|
+
const wsUrl = new URL("/v1/game-launcher/processes", matchAgentUrl);
|
|
256
|
+
wsUrl.protocol = wsUrl.protocol === "https:" ? "wss:" : "ws:";
|
|
257
|
+
wsUrl.searchParams.set("authorization", authCode);
|
|
258
|
+
|
|
259
|
+
const ws = new WebSocket(wsUrl.href);
|
|
260
|
+
const bridge = new MessageBridge((message) => ws.send(JSON.stringify(message)));
|
|
261
|
+
ws.addEventListener("message", (event) => bridge.handleMessage(JSON.parse(event.data)));
|
|
262
|
+
ws.addEventListener("error", () => onError(new Error("Lost connection to match agent")));
|
|
263
|
+
bridge.onEvent("processes", (processes) => onUpdate(processes));
|
|
264
|
+
|
|
265
|
+
return () => ws.close();
|
|
266
|
+
}
|
|
267
|
+
|
|
151
268
|
export async function stopGameLauncher(
|
|
152
269
|
matchAgentUrl: string, authCode: string, pluginName: string, handleId: string
|
|
153
270
|
): Promise<void> {
|
|
@@ -157,3 +274,89 @@ export async function stopGameLauncher(
|
|
|
157
274
|
{ method: "POST" }
|
|
158
275
|
);
|
|
159
276
|
}
|
|
277
|
+
|
|
278
|
+
export type NavAction = "select" | "back" | "menu";
|
|
279
|
+
export type KeyboardBindings = Record<NavAction, string>;
|
|
280
|
+
export type GamepadBindings = Record<NavAction, number>;
|
|
281
|
+
export type InputBindings = { keyboard: KeyboardBindings, gamepad: GamepadBindings };
|
|
282
|
+
|
|
283
|
+
// Stored by match-agent next to its own portable config file (see
|
|
284
|
+
// core/match-agent/src/config/inputBindings.ts), not in this browser's
|
|
285
|
+
// localStorage - an arcade/internet-cafe host's browser profile doesn't
|
|
286
|
+
// travel with the player, but match-agent run off their own USB does (see
|
|
287
|
+
// docs/economics/machine-environments/pieces-usb.md/cafe.md).
|
|
288
|
+
export async function getInputBindings(matchAgentUrl: string, authCode: string): Promise<InputBindings> {
|
|
289
|
+
const res = await matchAgentFetch(matchAgentUrl, authCode, "/v1/input-bindings");
|
|
290
|
+
return res.json();
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export async function setInputBindings(
|
|
294
|
+
matchAgentUrl: string, authCode: string, bindings: InputBindings
|
|
295
|
+
): Promise<void> {
|
|
296
|
+
await matchAgentFetch(matchAgentUrl, authCode, "/v1/input-bindings", {
|
|
297
|
+
method: "PUT",
|
|
298
|
+
headers: { "Content-Type": "application/json" },
|
|
299
|
+
body: JSON.stringify(bindings),
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// Opens a native OS file-picker on match-agent's own host (see
|
|
304
|
+
// core/match-agent/src/utils/pick-file.ts for why a browser <input> can't
|
|
305
|
+
// hand back an absolute path) pre-seeded with whatever path is already
|
|
306
|
+
// typed, if any. `cancelled: true` means the user closed the dialog
|
|
307
|
+
// without picking anything; the picker itself may not exist on a
|
|
308
|
+
// headless/remote match-agent, in which case this throws and the caller
|
|
309
|
+
// should fall back to typing the path manually (which, via the on-screen
|
|
310
|
+
// keyboard, is also the only option a gamepad-only player has anyway).
|
|
311
|
+
// Mounted outside /v1 (see src/index.ts's startServer) - these don't touch
|
|
312
|
+
// the room protocol, and are bounded to match-agent's configured
|
|
313
|
+
// rosterLockFolder (core/match-agent/src/util-routers/file-system/
|
|
314
|
+
// resolve-within-root.ts), not anywhere else its host filesystem happens
|
|
315
|
+
// to reach: a plain "list any path, read any file" HTTP API would hand
|
|
316
|
+
// anyone holding the auth code a way to enumerate/read the whole machine
|
|
317
|
+
// programmatically, which the native OS dialog this feature replaces
|
|
318
|
+
// never could (it only ever returns one path, chosen through a trusted
|
|
319
|
+
// OS UI - never a general filesystem-browsing capability).
|
|
320
|
+
export async function pickRosterLockFile(
|
|
321
|
+
matchAgentUrl: string, authCode: string, startPath?: string
|
|
322
|
+
): Promise<{ path: string } | { cancelled: true }> {
|
|
323
|
+
const res = await matchAgentFetch(matchAgentUrl, authCode, "/util/file-system/roster-lock/pick", {
|
|
324
|
+
method: "POST",
|
|
325
|
+
headers: { "Content-Type": "application/json" },
|
|
326
|
+
body: JSON.stringify({ startPath }),
|
|
327
|
+
});
|
|
328
|
+
return res.json();
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// Reads+parses a roster-lock config straight off match-agent's own host
|
|
332
|
+
// disk - lets pages/PreviewRoster open a SelectionBoard against a roster
|
|
333
|
+
// lock directly, with no matchmaker/room (and so none of the Docker
|
|
334
|
+
// services/real login flow those need) involved at all.
|
|
335
|
+
export async function readRosterLock(
|
|
336
|
+
matchAgentUrl: string, authCode: string, path: string
|
|
337
|
+
): Promise<RosterLockV1Config> {
|
|
338
|
+
const res = await matchAgentFetch(
|
|
339
|
+
matchAgentUrl, authCode, `/util/file-system/roster-lock?path=${encodeURIComponent(path)}`
|
|
340
|
+
);
|
|
341
|
+
return res.json();
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
export type DirectoryEntry = { name: string, path: string, isDirectory: boolean };
|
|
345
|
+
export type DirectoryListing = { path: string, parent: string | null, entries: Array<DirectoryEntry> };
|
|
346
|
+
|
|
347
|
+
// Backs OnScreenFileDialog - a file picker rendered in the page itself
|
|
348
|
+
// rather than a native OS dialog, so it's reachable through the same
|
|
349
|
+
// Move/Select/Back scheme (GlobalNavContext) a gamepad already uses
|
|
350
|
+
// everywhere else. `path` omitted defaults to match-agent's configured
|
|
351
|
+
// rosterLockFolder; `extension` (e.g. ".roster-lock.json") filters which
|
|
352
|
+
// files show up without hiding any folders, so navigation is never blocked.
|
|
353
|
+
export async function listDirectory(
|
|
354
|
+
matchAgentUrl: string, authCode: string, path?: string, extension?: string
|
|
355
|
+
): Promise<DirectoryListing> {
|
|
356
|
+
const params = new URLSearchParams();
|
|
357
|
+
if (path) params.set("path", path);
|
|
358
|
+
if (extension) params.set("extension", extension);
|
|
359
|
+
const query = params.toString();
|
|
360
|
+
const res = await matchAgentFetch(matchAgentUrl, authCode, `/util/file-system/list${query ? `?${query}` : ""}`);
|
|
361
|
+
return res.json();
|
|
362
|
+
}
|
|
@@ -7,16 +7,20 @@ import {
|
|
|
7
7
|
GetIdentityResponse,
|
|
8
8
|
RequestSelectionRequest, RequestSelectionResponse,
|
|
9
9
|
UpdateGameLauncherSettingsRequest, UpdateGameLauncherSettingsResponse,
|
|
10
|
+
ValidateGameConfigRequest, ValidateGameConfigResponse,
|
|
10
11
|
InitiateRelayEvent,
|
|
11
12
|
} from "@roster-lock/types";
|
|
12
13
|
import { UserKeyPair } from "@roster-lock/ts-client";
|
|
13
|
-
import { listAvailableGameLaunchers } from "../api/matchAgent";
|
|
14
|
+
import { listAvailableGameLaunchers, validateGameLauncherGameConfig } from "../api/matchAgent";
|
|
14
15
|
import { PlayerSlot } from "../context/JoinSettingsContext";
|
|
15
16
|
import { DownloadSession } from "../context/DownloadSessionContext";
|
|
16
17
|
|
|
17
18
|
export type PendingLightbox = (
|
|
18
|
-
| { type: "install", pluginName: string, resolve: () => void }
|
|
19
|
-
| {
|
|
19
|
+
| { type: "install", pluginName: string, resolve: () => void, reject: (e: Error) => void }
|
|
20
|
+
| {
|
|
21
|
+
type: "selection", rosterConfig: RequestSelectionRequest["rosterLockConfig"], numPlayers: number,
|
|
22
|
+
pluginName: string, resolve: (v: RequestSelectionResponse) => void, reject: (e: Error) => void,
|
|
23
|
+
}
|
|
20
24
|
);
|
|
21
25
|
|
|
22
26
|
// Host-side half of the matchmaker bridge protocol (see
|
|
@@ -26,7 +30,7 @@ export type PendingLightbox = (
|
|
|
26
30
|
// sync-dl.ws.ts uses over WebSocket, just over postMessage here).
|
|
27
31
|
export function useHostBridge(args: {
|
|
28
32
|
iframeRef: RefObject<HTMLIFrameElement | null>,
|
|
29
|
-
iframeLoaded:
|
|
33
|
+
iframeLoaded: number,
|
|
30
34
|
matchAgent: { url: string, authCode: string },
|
|
31
35
|
identityKeys: UserKeyPair,
|
|
32
36
|
machineId: string,
|
|
@@ -35,6 +39,8 @@ export function useHostBridge(args: {
|
|
|
35
39
|
}) {
|
|
36
40
|
const { iframeRef, iframeLoaded, matchAgent, identityKeys, machineId, playerSlots, onInitiateRelay } = args;
|
|
37
41
|
|
|
42
|
+
const activeConnection = useRef<number>(-1);
|
|
43
|
+
|
|
38
44
|
const [pendingLightbox, setPendingLightbox] = useState<PendingLightbox | null>(null);
|
|
39
45
|
const [connected, setConnected] = useState(false);
|
|
40
46
|
const [connectionError, setConnectionError] = useState(false);
|
|
@@ -48,7 +54,8 @@ export function useHostBridge(args: {
|
|
|
48
54
|
latest.current = args;
|
|
49
55
|
|
|
50
56
|
useEffect(() => {
|
|
51
|
-
if (
|
|
57
|
+
if (iframeLoaded === -1) return;
|
|
58
|
+
activeConnection.current = iframeLoaded
|
|
52
59
|
setConnected(false);
|
|
53
60
|
setConnectionError(false);
|
|
54
61
|
|
|
@@ -64,8 +71,8 @@ export function useHostBridge(args: {
|
|
|
64
71
|
window.addEventListener("message", onMessage);
|
|
65
72
|
|
|
66
73
|
bridge.onRequest(MATCHMAKER_BRIDGE_PATHS.installGameLauncherPlugin, ({ pluginName }: InstallGameLauncherPluginRequest) => {
|
|
67
|
-
return new Promise<InstallGameLauncherPluginResponse>((resolve) => {
|
|
68
|
-
setPendingLightbox({ type: "install", pluginName, resolve: () => resolve({}) });
|
|
74
|
+
return new Promise<InstallGameLauncherPluginResponse>((resolve, reject) => {
|
|
75
|
+
setPendingLightbox({ type: "install", pluginName, resolve: () => resolve({}), reject: (e) => reject(e) });
|
|
69
76
|
});
|
|
70
77
|
});
|
|
71
78
|
|
|
@@ -82,12 +89,13 @@ export function useHostBridge(args: {
|
|
|
82
89
|
|
|
83
90
|
bridge.onRequest(
|
|
84
91
|
MATCHMAKER_BRIDGE_PATHS.requestSelection,
|
|
85
|
-
({ rosterLockConfig, numPlayers }: RequestSelectionRequest) => {
|
|
92
|
+
({ rosterLockConfig, numPlayers, pluginName }: RequestSelectionRequest) => {
|
|
86
93
|
return new Promise<RequestSelectionResponse>((resolve, reject) => {
|
|
87
94
|
setPendingLightbox({
|
|
88
95
|
type: "selection",
|
|
89
96
|
rosterConfig: rosterLockConfig,
|
|
90
97
|
numPlayers,
|
|
98
|
+
pluginName,
|
|
91
99
|
resolve: (selection) => {
|
|
92
100
|
pendingSelectionRef.current = selection;
|
|
93
101
|
resolve(selection);
|
|
@@ -106,6 +114,16 @@ export function useHostBridge(args: {
|
|
|
106
114
|
}
|
|
107
115
|
);
|
|
108
116
|
|
|
117
|
+
bridge.onRequest(
|
|
118
|
+
MATCHMAKER_BRIDGE_PATHS.validateGameConfig,
|
|
119
|
+
async ({ pluginName, gameConfig, rosterConfig }: ValidateGameConfigRequest): Promise<ValidateGameConfigResponse> => {
|
|
120
|
+
const problems = await validateGameLauncherGameConfig(
|
|
121
|
+
latest.current.matchAgent.url, latest.current.matchAgent.authCode, pluginName, gameConfig, rosterConfig
|
|
122
|
+
);
|
|
123
|
+
return { problems };
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
|
|
109
127
|
bridge.onEvent(MATCHMAKER_BRIDGE_PATHS.initiateRelay, (payload: InitiateRelayEvent) => {
|
|
110
128
|
if (!pendingSelectionRef.current) return;
|
|
111
129
|
latest.current.onInitiateRelay({
|
|
@@ -121,7 +139,10 @@ export function useHostBridge(args: {
|
|
|
121
139
|
|
|
122
140
|
waitForBridgeEvent(bridge, MATCHMAKER_BRIDGE_PATHS.ready, 15_000)
|
|
123
141
|
.then(() => setConnected(true))
|
|
124
|
-
.catch(()
|
|
142
|
+
.catch(()=>{
|
|
143
|
+
if(activeConnection.current !== iframeLoaded) return;
|
|
144
|
+
setConnectionError(true)
|
|
145
|
+
});
|
|
125
146
|
|
|
126
147
|
return () => {
|
|
127
148
|
window.removeEventListener("message", onMessage);
|
|
@@ -135,6 +156,11 @@ export function useHostBridge(args: {
|
|
|
135
156
|
setPendingLightbox(null);
|
|
136
157
|
};
|
|
137
158
|
|
|
159
|
+
const cancelInstallLightbox = () => {
|
|
160
|
+
if (pendingLightbox?.type === "install") pendingLightbox.reject(new Error("cancelled"));
|
|
161
|
+
setPendingLightbox(null);
|
|
162
|
+
};
|
|
163
|
+
|
|
138
164
|
const resolveSelectionLightbox = (selection: RequestSelectionResponse) => {
|
|
139
165
|
if (pendingLightbox?.type === "selection") pendingLightbox.resolve(selection);
|
|
140
166
|
setPendingLightbox(null);
|
|
@@ -145,5 +171,8 @@ export function useHostBridge(args: {
|
|
|
145
171
|
setPendingLightbox(null);
|
|
146
172
|
};
|
|
147
173
|
|
|
148
|
-
return {
|
|
174
|
+
return {
|
|
175
|
+
connected, connectionError, pendingLightbox,
|
|
176
|
+
resolveInstallLightbox, cancelInstallLightbox, resolveSelectionLightbox, cancelSelectionLightbox,
|
|
177
|
+
};
|
|
149
178
|
}
|