Skip to content

Commit 6853234

Browse files
committed
v0.4.4: multi-line Apps Script ID input (one per line)
Follow-up to v0.4.3 — users asked for one-ID-per-line instead of comma-separated, which is easier to edit in the UI. Field is now a 3-row textarea with a rolling hint underneath: - 0 or 1 IDs: 'Tip: add more IDs for round-robin with auto-failover' - 2+ IDs: 'N IDs — round-robin with auto-failover on quota' The parser accepts both newlines and commas as separators, so existing configs keep loading cleanly. Closes #1.
1 parent 56d6703 commit 6853234

3 files changed

Lines changed: 17 additions & 14 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mhrv-rs"
3-
version = "0.4.3"
3+
version = "0.4.4"
44
edition = "2021"
55
description = "Rust port of MasterHttpRelayVPN -- DPI bypass via Google Apps Script relay with domain fronting"
66
license = "MIT"

src/bin/ui.rs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,10 @@ fn load_form() -> FormState {
120120
if let Some(c) = existing {
121121
let sid = match &c.script_id {
122122
Some(ScriptId::One(s)) => s.clone(),
123-
Some(ScriptId::Many(v)) => v.join(", "),
123+
Some(ScriptId::Many(v)) => v.join("\n"),
124124
None => match &c.script_ids {
125125
Some(ScriptId::One(s)) => s.clone(),
126-
Some(ScriptId::Many(v)) => v.join(", "),
126+
Some(ScriptId::Many(v)) => v.join("\n"),
127127
None => String::new(),
128128
},
129129
};
@@ -178,7 +178,7 @@ impl FormState {
178178
};
179179
let ids: Vec<String> = self
180180
.script_id
181-
.split(',')
181+
.split(|c: char| c == '\n' || c == ',')
182182
.map(|s| s.trim().to_string())
183183
.filter(|s| !s.is_empty())
184184
.collect();
@@ -293,26 +293,29 @@ impl eframe::App for App {
293293
.show(ui, |ui| {
294294
ui.label("Apps Script ID(s)")
295295
.on_hover_text(
296-
"One deployment ID, or several separated by commas.\n\
296+
"One deployment ID per line.\n\
297297
With multiple IDs the proxy round-robins between them and\n\
298298
automatically sidelines any ID that hits its daily quota (429)\n\
299299
or other rate limits for 10 minutes before retrying it."
300300
);
301-
ui.add(egui::TextEdit::singleline(&mut self.form.script_id)
302-
.hint_text("id1, id2, id3 …")
303-
.desired_width(f32::INFINITY));
301+
ui.add(egui::TextEdit::multiline(&mut self.form.script_id)
302+
.hint_text("one deployment ID per line")
303+
.desired_width(f32::INFINITY)
304+
.desired_rows(3));
304305
ui.end_row();
305306

306307
let id_count = self.form.script_id
307-
.split(',')
308+
.split(|c: char| c == '\n' || c == ',')
308309
.map(|s| s.trim())
309310
.filter(|s| !s.is_empty())
310311
.count();
311-
if id_count > 1 {
312-
ui.label("");
313-
ui.small(format!("{} IDs — round-robin with auto-failover on quota", id_count));
314-
ui.end_row();
312+
ui.label("");
313+
if id_count <= 1 {
314+
ui.small("Tip: add more IDs (one per line) for round-robin rotation with auto-failover on quota.");
315+
} else {
316+
ui.small(format!("{} IDs — round-robin with auto-failover on quota.", id_count));
315317
}
318+
ui.end_row();
316319

317320
ui.label("Auth key");
318321
ui.horizontal(|ui| {

0 commit comments

Comments
 (0)