2e487b187eac96ac63c8bd0f5e3c28d5ed06d828

Author
Septs <github@septs.pw>
Committer
GitHub <noreply@github.com>
Date

Message

feat(shell-proxy): enable unexported `DEFAULT_PROXY` setting (#9774)

Diff

 1diff --git a/plugins/shell-proxy/proxy.py b/plugins/shell-proxy/proxy.py
 2index d2e5361cb67c06c0c12bd1f4cd288822ceee0a8e..97f4cf8738a51b68e8344267cdf5abadce1a4ec8 100755
 3--- a/plugins/shell-proxy/proxy.py
 4+++ b/plugins/shell-proxy/proxy.py
 5@@ -9,8 +9,9 @@ user_proxy = os.environ.get("CONFIG_PROXY", os.path.expandvars("$HOME/.config/pr
 6 
 7 
 8 def get_http_proxy():
 9-    if "DEFAULT_PROXY" in os.environ:
10-        return os.environ["DEFAULT_PROXY"]
11+    default_proxy = os.environ.get("DEFAULT_PROXY")
12+    if default_proxy:
13+        return default_proxy
14     if os.path.isfile(user_proxy):
15         return check_output(user_proxy).decode("utf-8").strip()
16     raise Exception("Not found, Proxy configuration")
17diff --git a/plugins/shell-proxy/shell-proxy.plugin.zsh b/plugins/shell-proxy/shell-proxy.plugin.zsh
18index fd0e2fe79716294dd615292e7cd15c0df1ef1918..315ade665c15a7ab899728ab5dd10095e66d1ffa 100644
19--- a/plugins/shell-proxy/shell-proxy.plugin.zsh
20+++ b/plugins/shell-proxy/shell-proxy.plugin.zsh
21@@ -4,7 +4,7 @@
22 __PROXY__="${0:A:h}/proxy.py"
23 
24 proxy() {
25-	source <("$__PROXY__" "$1")
26+	source <(env "DEFAULT_PROXY=$DEFAULT_PROXY" "$__PROXY__" "$1")
27 }
28 
29 _proxy() {