devlinker 1.3.5__tar.gz → 1.3.6__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.
- {devlinker-1.3.5 → devlinker-1.3.6}/PKG-INFO +1 -1
- {devlinker-1.3.5 → devlinker-1.3.6}/devlinker/proxy.py +30 -4
- {devlinker-1.3.5 → devlinker-1.3.6}/devlinker.egg-info/PKG-INFO +1 -1
- {devlinker-1.3.5 → devlinker-1.3.6}/pyproject.toml +1 -1
- {devlinker-1.3.5 → devlinker-1.3.6}/LICENSE +0 -0
- {devlinker-1.3.5 → devlinker-1.3.6}/README.md +0 -0
- {devlinker-1.3.5 → devlinker-1.3.6}/devlinker/__init__.py +0 -0
- {devlinker-1.3.5 → devlinker-1.3.6}/devlinker/config.py +0 -0
- {devlinker-1.3.5 → devlinker-1.3.6}/devlinker/detection_state.py +0 -0
- {devlinker-1.3.5 → devlinker-1.3.6}/devlinker/detector.py +0 -0
- {devlinker-1.3.5 → devlinker-1.3.6}/devlinker/detector_ai.py +0 -0
- {devlinker-1.3.5 → devlinker-1.3.6}/devlinker/doctor.py +0 -0
- {devlinker-1.3.5 → devlinker-1.3.6}/devlinker/fix.py +0 -0
- {devlinker-1.3.5 → devlinker-1.3.6}/devlinker/fixer.py +0 -0
- {devlinker-1.3.5 → devlinker-1.3.6}/devlinker/global_state.py +0 -0
- {devlinker-1.3.5 → devlinker-1.3.6}/devlinker/inspect.py +0 -0
- {devlinker-1.3.5 → devlinker-1.3.6}/devlinker/logger.py +0 -0
- {devlinker-1.3.5 → devlinker-1.3.6}/devlinker/main.py +0 -0
- {devlinker-1.3.5 → devlinker-1.3.6}/devlinker/monitor.py +0 -0
- {devlinker-1.3.5 → devlinker-1.3.6}/devlinker/runner.py +0 -0
- {devlinker-1.3.5 → devlinker-1.3.6}/devlinker/share.py +0 -0
- {devlinker-1.3.5 → devlinker-1.3.6}/devlinker/tunnel.py +0 -0
- {devlinker-1.3.5 → devlinker-1.3.6}/devlinker.egg-info/SOURCES.txt +0 -0
- {devlinker-1.3.5 → devlinker-1.3.6}/devlinker.egg-info/dependency_links.txt +0 -0
- {devlinker-1.3.5 → devlinker-1.3.6}/devlinker.egg-info/entry_points.txt +0 -0
- {devlinker-1.3.5 → devlinker-1.3.6}/devlinker.egg-info/requires.txt +0 -0
- {devlinker-1.3.5 → devlinker-1.3.6}/devlinker.egg-info/top_level.txt +0 -0
- {devlinker-1.3.5 → devlinker-1.3.6}/setup.cfg +0 -0
- {devlinker-1.3.5 → devlinker-1.3.6}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: devlinker
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.6
|
|
4
4
|
Summary: A lightweight proxy that combines your frontend and backend into one link for easy development and sharing.
|
|
5
5
|
Author-email: Mani <mani1028@users.noreply.github.com>
|
|
6
6
|
Requires-Python: >=3.7
|
|
@@ -142,6 +142,30 @@ def _build_target_ws_url(port: int, path: str, query: str) -> str:
|
|
|
142
142
|
|
|
143
143
|
|
|
144
144
|
async def _forward_http(request: Request) -> Response:
|
|
145
|
+
# Serve instant loader for local/LAN users unless X-DevLinker-Instant header is present
|
|
146
|
+
client_ip = request.client.host if request.client else None
|
|
147
|
+
def is_local_network(ip):
|
|
148
|
+
if not ip:
|
|
149
|
+
return False
|
|
150
|
+
if ip.startswith("127.") or ip == "localhost" or ip == "::1":
|
|
151
|
+
return False
|
|
152
|
+
if ip.startswith("192.168.") or ip.startswith("10."):
|
|
153
|
+
return True
|
|
154
|
+
if ip.startswith("172."):
|
|
155
|
+
try:
|
|
156
|
+
second = int(ip.split(".")[1])
|
|
157
|
+
return 16 <= second <= 31
|
|
158
|
+
except Exception:
|
|
159
|
+
return False
|
|
160
|
+
return False
|
|
161
|
+
is_local = is_local_network(client_ip)
|
|
162
|
+
is_instant = request.headers.get("x-devlinker-instant") == "1"
|
|
163
|
+
if is_local and not is_instant and request.method == "GET":
|
|
164
|
+
import os
|
|
165
|
+
loader_path = os.path.join(os.path.dirname(__file__), "devlinker_loader_instant.html")
|
|
166
|
+
with open(loader_path, encoding="utf-8") as f:
|
|
167
|
+
loader_html = f.read()
|
|
168
|
+
return Response(content=loader_html, status_code=200, media_type="text/html")
|
|
145
169
|
from devlinker.logger import print_warning, print_fix
|
|
146
170
|
from devlinker.detector_ai import DevLinkerAI
|
|
147
171
|
|
|
@@ -207,18 +231,20 @@ async def _forward_http(request: Request) -> Response:
|
|
|
207
231
|
for s in ai_suggestions:
|
|
208
232
|
print_fix(s)
|
|
209
233
|
|
|
210
|
-
# Only inject loader for HTML responses, not localhost
|
|
234
|
+
# Only inject loader for HTML responses, not localhost/loopback, but DO inject for LAN/WiFi clients
|
|
211
235
|
headers = _filter_response_headers(dict(upstream.headers))
|
|
212
236
|
content_type = headers.get("content-type", "")
|
|
213
237
|
is_html = "text/html" in content_type
|
|
214
|
-
is_public = not
|
|
238
|
+
is_public = client_ip and not is_local and (not client_ip.startswith("127.") and client_ip != "localhost" and client_ip != "::1")
|
|
215
239
|
content = upstream.content
|
|
216
|
-
if is_html and is_public:
|
|
240
|
+
if is_html and (is_local or is_public):
|
|
217
241
|
try:
|
|
218
242
|
html = content.decode(upstream.encoding or "utf-8", errors="replace")
|
|
219
243
|
# Only inject if </body> exists
|
|
220
244
|
if "</body>" in html:
|
|
221
|
-
|
|
245
|
+
import os
|
|
246
|
+
loader_file = "devlinker_loader_snippet.html" if is_public else "devlinker_loader_minimal.html"
|
|
247
|
+
with open(os.path.join(os.path.dirname(__file__), loader_file), encoding="utf-8") as f:
|
|
222
248
|
loader = f.read()
|
|
223
249
|
html = html.replace("</body>", loader + "</body>")
|
|
224
250
|
content = html.encode(upstream.encoding or "utf-8")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: devlinker
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.6
|
|
4
4
|
Summary: A lightweight proxy that combines your frontend and backend into one link for easy development and sharing.
|
|
5
5
|
Author-email: Mani <mani1028@users.noreply.github.com>
|
|
6
6
|
Requires-Python: >=3.7
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "devlinker"
|
|
7
|
-
version = "1.3.
|
|
7
|
+
version = "1.3.6"
|
|
8
8
|
description = "A lightweight proxy that combines your frontend and backend into one link for easy development and sharing."
|
|
9
9
|
authors = [
|
|
10
10
|
{ name = "Mani", email = "mani1028@users.noreply.github.com" }
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|