diff --git a/rust/src_webpack/src/api.ts b/rust/src_webpack/src/api.ts index 738cff5..b30c300 100644 --- a/rust/src_webpack/src/api.ts +++ b/rust/src_webpack/src/api.ts @@ -29,6 +29,8 @@ export interface NetworkConfig { password: string, mqtt_url: string, base_topic: string, + mqtt_user: string | null, + mqtt_password: string | null, max_wait: number } diff --git a/rust/src_webpack/src/network.html b/rust/src_webpack/src/network.html index 5bdca8d..7d0a56b 100644 --- a/rust/src_webpack/src/network.html +++ b/rust/src_webpack/src/network.html @@ -72,8 +72,20 @@ +
+
+ MQTT User +
+ +
+
+
+ MQTT Password +
+ +
- \ No newline at end of file + diff --git a/rust/src_webpack/src/network.ts b/rust/src_webpack/src/network.ts index df1ffbd..f26b659 100644 --- a/rust/src_webpack/src/network.ts +++ b/rust/src_webpack/src/network.ts @@ -16,6 +16,8 @@ export class NetworkConfigView { private readonly mqtt_url: HTMLInputElement; private readonly base_topic: HTMLInputElement; private readonly max_wait: HTMLInputElement; + private readonly mqtt_user: HTMLInputElement; + private readonly mqtt_password: HTMLInputElement; private readonly ssidlist: HTMLElement; constructor(controller: Controller, publicIp: string) { @@ -37,6 +39,10 @@ export class NetworkConfigView { this.mqtt_url.onchange = controller.configChanged this.base_topic = document.getElementById("base_topic") as HTMLInputElement; this.base_topic.onchange = controller.configChanged + this.mqtt_user = document.getElementById("mqtt_user") as HTMLInputElement; + this.mqtt_user.onchange = controller.configChanged + this.mqtt_password = document.getElementById("mqtt_password") as HTMLInputElement; + this.mqtt_password.onchange = controller.configChanged this.ssidlist = document.getElementById("ssidlist") as HTMLElement @@ -52,6 +58,8 @@ export class NetworkConfigView { this.password.value = network.password; this.mqtt_url.value = network.mqtt_url; this.base_topic.value = network.base_topic; + this.mqtt_user.value = network.mqtt_user ?? ""; + this.mqtt_password.value = network.mqtt_password ?? ""; this.max_wait.value = network.max_wait.toString(); } @@ -62,7 +70,9 @@ export class NetworkConfigView { ssid: this.ssid.value ?? null, password: this.password.value ?? null, mqtt_url: this.mqtt_url.value ?? null, + mqtt_user: this.mqtt_user.value ? this.mqtt_user.value : null, + mqtt_password: this.mqtt_password.value ? this.mqtt_password.value : null, base_topic: this.base_topic.value ?? null } } - } \ No newline at end of file + }