404
No Route could be matched.
diff --git a/desktop/local-app/src/lib/InputField.svelte b/desktop/local-app/src/lib/InputField.svelte
index 33a833e7..bb759793 100644
--- a/desktop/local-app/src/lib/InputField.svelte
+++ b/desktop/local-app/src/lib/InputField.svelte
@@ -9,7 +9,6 @@
{title}
-
{#if description.length > 0}
{description}
{/if}
diff --git a/desktop/local-app/src/lib/Link.svelte b/desktop/local-app/src/lib/Link.svelte
deleted file mode 100644
index d5d9ff46..00000000
--- a/desktop/local-app/src/lib/Link.svelte
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
diff --git a/desktop/local-app/src/lib/Sidebar.svelte b/desktop/local-app/src/lib/Sidebar.svelte
index d1e1929b..5b0f6f3c 100644
--- a/desktop/local-app/src/lib/Sidebar.svelte
+++ b/desktop/local-app/src/lib/Sidebar.svelte
@@ -1,8 +1,8 @@
+
+Server: "{server.name}"
\ No newline at end of file
diff --git a/desktop/local-app/src/window.d.ts b/desktop/local-app/src/window.d.ts
new file mode 100644
index 00000000..50b20044
--- /dev/null
+++ b/desktop/local-app/src/window.d.ts
@@ -0,0 +1,7 @@
+import type { WorkAdventureLocalAppApi } from "@wa-preload-local-app";
+
+declare global {
+ interface Window {
+ WAD: WorkAdventureLocalAppApi;
+ }
+}
diff --git a/front/src/Api/desktop/index.ts b/front/src/Api/desktop/index.ts
new file mode 100644
index 00000000..be5c7901
--- /dev/null
+++ b/front/src/Api/desktop/index.ts
@@ -0,0 +1,38 @@
+import { isSilentStore, requestedCameraState, requestedMicrophoneState } from "../../Stores/MediaStore";
+import { get } from "svelte/store";
+
+class DesktopApi {
+ isSilent: boolean = false;
+
+ init() {
+ if (!window?.WAD?.desktop) {
+ return;
+ }
+
+ console.log("Yipee you are using the desktop app ;)");
+
+ window.WAD.onMuteToggle(() => {
+ if (this.isSilent) return;
+ if (get(requestedMicrophoneState) === true) {
+ requestedMicrophoneState.disableMicrophone();
+ } else {
+ requestedMicrophoneState.enableMicrophone();
+ }
+ });
+
+ window.WAD.onCameraToggle(() => {
+ if (this.isSilent) return;
+ if (get(requestedCameraState) === true) {
+ requestedCameraState.disableWebcam();
+ } else {
+ requestedCameraState.enableWebcam();
+ }
+ });
+
+ isSilentStore.subscribe((value) => {
+ this.isSilent = value;
+ });
+ }
+}
+
+export const desktopApi = new DesktopApi();
diff --git a/front/src/iframe_api.ts b/front/src/iframe_api.ts
index f5e20032..e368df32 100644
--- a/front/src/iframe_api.ts
+++ b/front/src/iframe_api.ts
@@ -182,13 +182,6 @@ const wa = {
export type WorkAdventureApi = typeof wa;
-declare global {
- interface Window {
- WA: WorkAdventureApi;
- }
- let WA: WorkAdventureApi;
-}
-
window.WA = wa;
window.addEventListener(
diff --git a/front/src/index.ts b/front/src/index.ts
index b34191aa..cfe06a46 100644
--- a/front/src/index.ts
+++ b/front/src/index.ts
@@ -16,6 +16,7 @@ import { coWebsiteManager } from "./WebRtc/CoWebsiteManager";
import { localUserStore } from "./Connexion/LocalUserStore";
import { ErrorScene } from "./Phaser/Reconnecting/ErrorScene";
import { iframeListener } from "./Api/IframeListener";
+import { desktopApi } from "./Api/desktop/index";
import { SelectCharacterMobileScene } from "./Phaser/Login/SelectCharacterMobileScene";
import { HdpiManager } from "./Phaser/Services/HdpiManager";
import { waScaleManager } from "./Phaser/Services/WaScaleManager";
@@ -154,6 +155,7 @@ coWebsiteManager.onResize.subscribe(() => {
});
iframeListener.init();
+desktopApi.init();
const app = new App({
target: HtmlUtils.getElementByIdOrFail("game-overlay"),
diff --git a/front/src/window.d.ts b/front/src/window.d.ts
new file mode 100644
index 00000000..8393e15e
--- /dev/null
+++ b/front/src/window.d.ts
@@ -0,0 +1,10 @@
+import { WorkAdventureApi } from "./iframe_api";
+import { WorkAdventureDesktopApi } from "@wa-preload-app";
+
+declare global {
+ interface Window {
+ WA: WorkAdventureApi;
+ WAD: WorkAdventureDesktopApi;
+ }
+ let WA: WorkAdventureApi;
+}
diff --git a/front/tsconfig.json b/front/tsconfig.json
index b9057d28..edb99eb5 100644
--- a/front/tsconfig.json
+++ b/front/tsconfig.json
@@ -27,7 +27,10 @@
"alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
"noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
- "noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */
+ "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
+ "paths": {
+ "@wa-preload-app": ["../desktop/electron/src/preload-app/types.ts"],
+ }
},
"exclude": [
"node_modules",