Skip to content

Commit 6fcd25f

Browse files
committed
frontend/frame: pass path to iframe.
This enables the user to navigate to the recovery and debug/fs pages without having to press abstruse key combinations.
1 parent d27f60f commit 6fcd25f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

frontend/src/components/Frame.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ class VirtualNetworkInterface {
8989
return;
9090

9191
case "webinterface_loaded":
92-
clearTimeout(this.timeout);
93-
this.setParentState.parentState({show_spinner: false});
9492
iframe.contentWindow.postMessage({
9593
connection_id: this.id,
9694
});
@@ -152,7 +150,14 @@ class VirtualNetworkInterface {
152150
case "ready":
153151
this.setParentState.parentState({connection_state: ConnectionState.LoadingWebinterface});
154152
const iframe = document.getElementById("interface") as HTMLIFrameElement;
155-
iframe.src = `/wg-${this.id}/`;
153+
const path = window.location.pathname.slice(0, window.location.pathname.endsWith("/") ? -1 : undefined);
154+
const split = path.split("/");
155+
const newPath = split.slice(3).join("/");
156+
iframe.src = `/wg-${this.id}/${newPath}`;
157+
iframe.addEventListener("load", () => {
158+
clearTimeout(this.timeout);
159+
this.setParentState.parentState({show_spinner: false});
160+
});
156161
break;
157162
case "closed":
158163
this.worker.terminate();

0 commit comments

Comments
 (0)