clash-controller 0.0.2__tar.gz → 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {clash_controller-0.0.2 → clash_controller-0.1.0}/PKG-INFO +3 -1
- {clash_controller-0.0.2 → clash_controller-0.1.0}/clash_controller/api.py +6 -1
- clash_controller-0.1.0/clash_controller/cli.py +1124 -0
- {clash_controller-0.0.2 → clash_controller-0.1.0}/clash_controller.egg-info/PKG-INFO +3 -1
- {clash_controller-0.0.2 → clash_controller-0.1.0}/clash_controller.egg-info/requires.txt +2 -0
- {clash_controller-0.0.2 → clash_controller-0.1.0}/pyproject.toml +4 -2
- clash_controller-0.0.2/clash_controller/cli.py +0 -814
- {clash_controller-0.0.2 → clash_controller-0.1.0}/README.md +0 -0
- {clash_controller-0.0.2 → clash_controller-0.1.0}/clash_controller/__init__.py +0 -0
- {clash_controller-0.0.2 → clash_controller-0.1.0}/clash_controller/__main__.py +0 -0
- {clash_controller-0.0.2 → clash_controller-0.1.0}/clash_controller.egg-info/SOURCES.txt +0 -0
- {clash_controller-0.0.2 → clash_controller-0.1.0}/clash_controller.egg-info/dependency_links.txt +0 -0
- {clash_controller-0.0.2 → clash_controller-0.1.0}/clash_controller.egg-info/entry_points.txt +0 -0
- {clash_controller-0.0.2 → clash_controller-0.1.0}/clash_controller.egg-info/top_level.txt +0 -0
- {clash_controller-0.0.2 → clash_controller-0.1.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: clash_controller
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 0.1.0
|
|
4
4
|
Summary: A controller for Clash
|
|
5
5
|
Author-email: Moha-Master <hongkongreporter@outlook.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -14,6 +14,8 @@ Description-Content-Type: text/markdown
|
|
|
14
14
|
Requires-Dist: requests
|
|
15
15
|
Requires-Dist: requests_unixsocket
|
|
16
16
|
Requires-Dist: InquirerPy
|
|
17
|
+
Requires-Dist: paramiko
|
|
18
|
+
Requires-Dist: scp
|
|
17
19
|
|
|
18
20
|
# Clash Controller
|
|
19
21
|
|
|
@@ -109,7 +109,7 @@ class ClashAPI:
|
|
|
109
109
|
# connection problems and the API is local, return the sentinel so
|
|
110
110
|
# caller can ask user to verify the outcome manually.
|
|
111
111
|
try:
|
|
112
|
-
longer_timeout =
|
|
112
|
+
longer_timeout = 15
|
|
113
113
|
if self.debug:
|
|
114
114
|
print(f"[DEBUG] ReadTimeout occurred, retrying with timeout={longer_timeout}")
|
|
115
115
|
response = do_request(longer_timeout)
|
|
@@ -133,6 +133,9 @@ class ClashAPI:
|
|
|
133
133
|
except requests.exceptions.RequestException as exc:
|
|
134
134
|
if self.debug:
|
|
135
135
|
print(f"[DEBUG] ReadTimeout retry failed: {exc}")
|
|
136
|
+
# Reload config may legitimately finish server-side while client times out.
|
|
137
|
+
if method.upper() == 'PUT' and endpoint.startswith('/configs'):
|
|
138
|
+
return None, self.SENT_BUT_DISCONNECTED
|
|
136
139
|
# If this is a local API, we conservatively cannot determine the final
|
|
137
140
|
# state (server may have applied the operation then closed the connection),
|
|
138
141
|
# so inform the caller to verify manually.
|
|
@@ -145,6 +148,8 @@ class ClashAPI:
|
|
|
145
148
|
# can prompt user to manually verify; otherwise return the error.
|
|
146
149
|
if self.debug:
|
|
147
150
|
print(f"[DEBUG] Connection error: {e}")
|
|
151
|
+
if method.upper() == 'PUT' and endpoint.startswith('/configs'):
|
|
152
|
+
return None, self.SENT_BUT_DISCONNECTED
|
|
148
153
|
if self._is_local():
|
|
149
154
|
return None, self.SENT_BUT_DISCONNECTED
|
|
150
155
|
return None, str(e)
|