Force JS eval of window.location
We need to get the fqdn of machine running the app, otherwise the frontend cannot access the api on the VOC VM
This commit is contained in:
Generated
+1
@@ -1410,6 +1410,7 @@ dependencies = [
|
|||||||
"env_logger",
|
"env_logger",
|
||||||
"ewebsock",
|
"ewebsock",
|
||||||
"hrtime",
|
"hrtime",
|
||||||
|
"js-sys",
|
||||||
"log",
|
"log",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ eframe = { version = "0.27.0", default-features = false, features = [
|
|||||||
"default_fonts", # Embed the default egui fonts.
|
"default_fonts", # Embed the default egui fonts.
|
||||||
"glow", # Use the glow rendering backend. Alternative: "wgpu".
|
"glow", # Use the glow rendering backend. Alternative: "wgpu".
|
||||||
] }
|
] }
|
||||||
|
js-sys = "0.3.69"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
hrtime = "0.2.0"
|
hrtime = "0.2.0"
|
||||||
|
|||||||
+6
-1
@@ -7,6 +7,7 @@ use std::{
|
|||||||
use egui::{Button, Color32, RichText, Rounding, Sense, Stroke, Vec2};
|
use egui::{Button, Color32, RichText, Rounding, Sense, Stroke, Vec2};
|
||||||
use ewebsock::{Options, WsReceiver, WsSender};
|
use ewebsock::{Options, WsReceiver, WsSender};
|
||||||
use wasm_timer::Instant;
|
use wasm_timer::Instant;
|
||||||
|
use js_sys::eval;
|
||||||
|
|
||||||
use crate::websocket::{
|
use crate::websocket::{
|
||||||
AddHyperdeckRequest, ClientRequest, HyperdeckConnectionState, HyperdeckRecordBay,
|
AddHyperdeckRequest, ClientRequest, HyperdeckConnectionState, HyperdeckRecordBay,
|
||||||
@@ -27,8 +28,12 @@ pub struct HyperdeckMonitorApp {
|
|||||||
|
|
||||||
impl Default for HyperdeckMonitorApp {
|
impl Default for HyperdeckMonitorApp {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
|
// returns voc.emf.camp:9681/
|
||||||
|
let window_location = eval("window.location.host").unwrap().as_string().unwrap();
|
||||||
|
// returns ws://voc.emf.camp:9681
|
||||||
|
let api_websocket_location = format!("ws://{}ws", window_location);
|
||||||
let (ws_sender, ws_receiver) =
|
let (ws_sender, ws_receiver) =
|
||||||
ewebsock::connect("ws://127.0.0.1:9681/ws", Options::default()).unwrap();
|
ewebsock::connect(api_websocket_location, Options::default()).unwrap();
|
||||||
Self {
|
Self {
|
||||||
blink: false,
|
blink: false,
|
||||||
last_blink_change: Instant::now(),
|
last_blink_change: Instant::now(),
|
||||||
|
|||||||
Reference in New Issue
Block a user