fix: multiple fixes
This commit is contained in:
22 files changed
+107
-92
No files matched your search
@@ -544,6 +544,9 @@ def _overall_state(snapshot):
|
||||
label = "Proxy only" if label == "Proxy" else label
|
||||
elif snapshot["awg"]["active"]:
|
||||
label = "AmneziaWG"
|
||||
elif traffic:
|
||||
# TUN runs its own backend, without proxy-suite-socks.
|
||||
label = "TUN" + (" + zapret" if zapret else "")
|
||||
else:
|
||||
label = "Zapret only" if zapret else "Inactive"
|
||||
units = snapshot.get("units") or {}
|
||||
@@ -2350,7 +2353,8 @@ ALIASES = {
|
||||
|
||||
def cmd_logs(*units):
|
||||
if units:
|
||||
_exec(["journalctl", "-fu", *units])
|
||||
# One -u per unit: a bare second name would be taken as a journal match.
|
||||
_exec(["journalctl", "-f", *(f"--unit={u}" for u in units)])
|
||||
# journalctl takes unit globs, so the default needs no unit list of its own.
|
||||
_exec(["journalctl", "-f", "-u", "proxy-suite-*"])
|
||||
|
||||
|
||||
@@ -297,6 +297,10 @@ def _enabled(name):
|
||||
return lambda _: ctl.env(name) == "1"
|
||||
|
||||
|
||||
def _sub_url(row):
|
||||
return bool(row["user"]) and bool(ctl.env("INBOUNDS_SUB_BASE_URL"))
|
||||
|
||||
|
||||
def _zapret_toggle(row, _, states):
|
||||
return ["zapret", "off" if states.get("proxy-suite-zapret") == "active" else "on"]
|
||||
|
||||
@@ -412,8 +416,9 @@ TABS = [
|
||||
Action("c", "copy share link", lambda r, *_: _link(r), when=ROW, mode="copy"),
|
||||
Action("Q", "share link as QR", lambda r, *_: _link(r, "--qr"), when=ROW, mode="dialog"),
|
||||
Action("s", "subscription URL", lambda r, *_: ["inbounds", "sub", r["user"]], when=lambda r: bool(r["user"]), mode="dialog"),
|
||||
Action("S", "subscription URL as QR", lambda r, *_: ["inbounds", "sub", r["user"], "--qr"], when=lambda r: bool(r["user"]), mode="dialog"),
|
||||
Action("y", "copy subscription URL", lambda r, *_: ["inbounds", "sub", r["user"]], when=lambda r: bool(r["user"]), mode="copy"),
|
||||
# Without subscriptions.baseUrl there is only a file path, with a hint after it: nothing to encode or copy.
|
||||
Action("S", "subscription URL as QR", lambda r, *_: ["inbounds", "sub", r["user"], "--qr"], when=_sub_url, mode="dialog"),
|
||||
Action("y", "copy subscription URL", lambda r, *_: ["inbounds", "sub", r["user"]], when=_sub_url, mode="copy"),
|
||||
Action("t", "traffic per user", lambda r, *_: ["inbounds", "stats"], mode="dialog"),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -607,7 +607,11 @@ class ProxyTui(App):
|
||||
|
||||
def perform(self, action, row):
|
||||
def with_text(text=""):
|
||||
argv = action.argv(row, text, self.states)
|
||||
try:
|
||||
argv = action.argv(row, text, self.states)
|
||||
except (ValueError, IndexError) as e: # an unbalanced quote in a typed command
|
||||
self.feedback(f"Cannot run that: {e}", False)
|
||||
return
|
||||
confirm = action.confirm(row) if callable(action.confirm) else action.confirm
|
||||
if confirm:
|
||||
self.push_screen(Confirm(f"proxy-ctl {shlex.join(argv)}"), lambda ok: ok and self.run_argv(action.mode, argv))
|
||||
|
||||
@@ -624,6 +624,7 @@ class StatusSnapshotTest(EnvTest):
|
||||
both = self.overall(socks="active", zapret="active", tun="active")
|
||||
self.assertEqual((both["base"], both["label"]), ("tunnel", "Proxy + traffic + zapret"))
|
||||
self.assertEqual(self.overall(awg_work="active"), {"base": "tunnel", "badge": "", "label": "AmneziaWG"})
|
||||
self.assertEqual(self.overall(tun="active")["label"], "TUN")
|
||||
|
||||
def test_badges(self):
|
||||
self.assertEqual(self.overall(socks="active", tun="failed")["badge"], "failed")
|
||||
|
||||
Reference in new issue
Block a user