Update app.py
Browse files
app.py
CHANGED
|
@@ -219,16 +219,25 @@ async def pac(
|
|
| 219 |
if not entry:
|
| 220 |
raise HTTPException(503, "No proxy available")
|
| 221 |
|
| 222 |
-
|
| 223 |
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
|
|
|
|
|
|
| 229 |
|
| 230 |
-
|
|
|
|
|
|
|
| 231 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 232 |
|
| 233 |
|
| 234 |
@app.post("/feedback")
|
|
|
|
| 219 |
if not entry:
|
| 220 |
raise HTTPException(503, "No proxy available")
|
| 221 |
|
| 222 |
+
raw = entry.proxy_url # ex: socks5://185.194.217.97:1080
|
| 223 |
|
| 224 |
+
# Détection du type + nettoyage
|
| 225 |
+
if raw.startswith("socks5://"):
|
| 226 |
+
proto = "SOCKS5"
|
| 227 |
+
clean = raw.replace("socks5://", "")
|
| 228 |
+
else:
|
| 229 |
+
proto = "PROXY"
|
| 230 |
+
clean = raw.replace("http://", "")
|
| 231 |
|
| 232 |
+
pac_script = f"""function FindProxyForURL(url, host) {{
|
| 233 |
+
return "{proto} {clean}; DIRECT";
|
| 234 |
+
}}"""
|
| 235 |
|
| 236 |
+
return PlainTextResponse(
|
| 237 |
+
pac_script,
|
| 238 |
+
media_type="application/x-ns-proxy-autoconfig",
|
| 239 |
+
headers={"Cache-Control": "no-cache, no-store, must-revalidate"}
|
| 240 |
+
)
|
| 241 |
|
| 242 |
|
| 243 |
@app.post("/feedback")
|