Skip to content

Commit 35b35fc

Browse files
committed
config: add a webserver bind address/port option
1 parent 7ec97c0 commit 35b35fc

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

contrib/config.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
# Data transfer timeout [seconds], after this idle time the session will be reconnected
1010
timeout_secs = 10
1111

12+
# Webserver bind address/port, empty = disabled
13+
webserver = "0.0.0.0:80"
14+
1215
# Enable legacy USB mode (some HeadUnits/cars needs this enabled for compatibility)
1316
legacy = true
1417

src/config.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ pub struct AppConfig {
107107
pub btalias: Option<String>,
108108
pub keepalive: bool,
109109
pub timeout_secs: u16,
110+
#[serde(default, deserialize_with = "empty_string_as_none")]
111+
pub webserver: Option<String>,
110112
pub bt_timeout_secs: u16,
111113
pub mitm: bool,
112114
pub dpi: u16,
@@ -142,6 +144,7 @@ impl Default for AppConfig {
142144
btalias: None,
143145
keepalive: false,
144146
timeout_secs: 10,
147+
webserver: Some("0.0.0.0:80".into()),
145148
bt_timeout_secs: 120,
146149
mitm: false,
147150
dpi: 0,
@@ -201,6 +204,9 @@ impl AppConfig {
201204
}
202205
doc["keepalive"] = value(self.keepalive);
203206
doc["timeout_secs"] = value(self.timeout_secs as i64);
207+
if let Some(webserver) = &self.webserver {
208+
doc["webserver"] = value(webserver);
209+
}
204210
doc["bt_timeout_secs"] = value(self.bt_timeout_secs as i64);
205211
doc["mitm"] = value(self.mitm);
206212
doc["dpi"] = value(self.dpi as i64);

static/index.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ <h3>🛸 aa-proxy-rs configuration</h3>
5151
>
5252
</td>
5353
</tr>
54+
<tr>
55+
<td><label for="webserver">webserver</label></td>
56+
<td>
57+
<input type="text" id="webserver" /><br /><small>
58+
Webserver bind address/port, empty = disabled</small
59+
>
60+
</td>
61+
</tr>
5462
<tr>
5563
<td><label for="legacy">legacy</label></td>
5664
<td>
@@ -344,6 +352,7 @@ <h3>🛸 aa-proxy-rs configuration</h3>
344352
"hostapd_conf",
345353
"btalias",
346354
"keepalive",
355+
"webserver",
347356
"timeout_secs",
348357
"bt_timeout_secs",
349358
"mitm",

0 commit comments

Comments
 (0)