Fix trade recovery, local web isolation and backtest risk accounting

This commit is contained in:
Igol committed 2026-10-22 21:49:20 +03:00
1 parent 5c6b0dc54a
commit 6aa76064dc
29 files changed
+2662 -1693

No files matched your search

+4 -1
View File
@@ -11,6 +11,7 @@ program than the engine's python.exe) and add pythonw.exe to the VPN's app exclu
from __future__ import annotations
import sys
from request_security import trusted_request
import urllib.error
import urllib.request
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
@@ -26,12 +27,14 @@ class Proxy(BaseHTTPRequestHandler):
pass
def _forward(self, method: str) -> None:
if not self.client_address[0].startswith("127.") and self.client_address[0] != "::1":
if not trusted_request(self, command=method == "POST"):
self.send_error(403, "only from this computer")
return
length = int(self.headers.get("Content-Length") or 0)
body = self.rfile.read(length) if length else None
headers = {k: v for k, v in self.headers.items() if k.lower() not in HOP_HEADERS}
# Preserve the validated authority so the engine can compare the browser Origin.
headers["Host"] = self.headers["Host"]
req = urllib.request.Request(ENGINE + self.path, data=body, method=method, headers=headers)
try:
with urllib.request.urlopen(req, timeout=30) as resp: