zerochat 10.46.0__tar.gz → 10.47.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.
Potentially problematic release.
This version of zerochat might be problematic. Click here for more details.
- {zerochat-10.46.0/zerochat.egg-info → zerochat-10.47.0}/PKG-INFO +1 -1
- {zerochat-10.46.0 → zerochat-10.47.0}/pyproject.toml +1 -1
- {zerochat-10.46.0 → zerochat-10.47.0/zerochat.egg-info}/PKG-INFO +1 -1
- {zerochat-10.46.0 → zerochat-10.47.0}/zerochat.py +15 -5
- {zerochat-10.46.0 → zerochat-10.47.0}/LICENSE +0 -0
- {zerochat-10.46.0 → zerochat-10.47.0}/README.md +0 -0
- {zerochat-10.46.0 → zerochat-10.47.0}/setup.cfg +0 -0
- {zerochat-10.46.0 → zerochat-10.47.0}/zerochat.egg-info/SOURCES.txt +0 -0
- {zerochat-10.46.0 → zerochat-10.47.0}/zerochat.egg-info/dependency_links.txt +0 -0
- {zerochat-10.46.0 → zerochat-10.47.0}/zerochat.egg-info/entry_points.txt +0 -0
- {zerochat-10.46.0 → zerochat-10.47.0}/zerochat.egg-info/top_level.txt +0 -0
|
@@ -1164,7 +1164,7 @@ def parse_nonneg_int(value, label: str, default: int = 0) -> int:
|
|
|
1164
1164
|
|
|
1165
1165
|
|
|
1166
1166
|
|
|
1167
|
-
SOURCE_BACKEND_VERSION = "10.
|
|
1167
|
+
SOURCE_BACKEND_VERSION = "10.47.0"
|
|
1168
1168
|
|
|
1169
1169
|
|
|
1170
1170
|
def _read_source_version(filename: str) -> str | None:
|
|
@@ -4089,6 +4089,12 @@ MODERN_USER_AGENTS = (
|
|
|
4089
4089
|
DEFAULT_USER_AGENT = MODERN_USER_AGENTS[0]
|
|
4090
4090
|
|
|
4091
4091
|
|
|
4092
|
+
def sets_user_agent(config: dict) -> bool:
|
|
4093
|
+
"""Solo los motores de Playwright llevan el User-Agent de ZeroChat: los navegadores instalados y el
|
|
4094
|
+
del usuario son navegadores reales y actualizados que envían el suyo."""
|
|
4095
|
+
return config["mode"] == "own" and config["engine"] in OWN_BROWSER_ENGINES
|
|
4096
|
+
|
|
4097
|
+
|
|
4092
4098
|
def own_browser_profile_dir(engine: str) -> Path:
|
|
4093
4099
|
return get_data_dir() / "playwright" / "profile" / engine
|
|
4094
4100
|
|
|
@@ -4117,7 +4123,7 @@ def validate_browser_config(raw) -> dict:
|
|
|
4117
4123
|
if not isinstance(config["extensionToken"], str) or not _EXTENSION_TOKEN.match(config["extensionToken"]):
|
|
4118
4124
|
raise ValueError("extensionToken debe tener hasta 256 letras, cifras, guiones o guiones bajos")
|
|
4119
4125
|
config["userAgent"] = _validate_user_agent(config["userAgent"])
|
|
4120
|
-
if config["userAgentMode"] == "custom" and not config["userAgent"]:
|
|
4126
|
+
if sets_user_agent(config) and config["userAgentMode"] == "custom" and not config["userAgent"]:
|
|
4121
4127
|
raise ValueError("userAgent es obligatorio cuando userAgentMode es custom")
|
|
4122
4128
|
return config
|
|
4123
4129
|
|
|
@@ -4182,8 +4188,7 @@ def playwright_launch_args(config: dict, user_agent: str | None = None) -> list[
|
|
|
4182
4188
|
args = ["--browser=chrome", "--isolated", f"--executable-path={executable}"]
|
|
4183
4189
|
else:
|
|
4184
4190
|
args = [f"--browser={config['engine']}", "--isolated"]
|
|
4185
|
-
|
|
4186
|
-
if user_agent:
|
|
4191
|
+
if user_agent and sets_user_agent(config):
|
|
4187
4192
|
args.append(f"--user-agent={user_agent}")
|
|
4188
4193
|
if config["headless"]:
|
|
4189
4194
|
args.append("--headless")
|
|
@@ -11877,6 +11882,11 @@ class ZeroChatServerHandler(BaseHTTPRequestHandler):
|
|
|
11877
11882
|
if self._send_json_response(200, response_payload) and not quiet:
|
|
11878
11883
|
self._log_res(200, log_detail, (time.monotonic() - t0) * 1000, error_info=error_info)
|
|
11879
11884
|
|
|
11885
|
+
def _capture_browser_user_agent(self, grant):
|
|
11886
|
+
"""Solo un navegador autenticado da el User-Agent real: el runner de Node manda el de su fetch ("node")."""
|
|
11887
|
+
if grant.kind != "runner":
|
|
11888
|
+
capture_frontend_user_agent(self.headers.get("User-Agent", ""))
|
|
11889
|
+
|
|
11880
11890
|
def do_POST(self):
|
|
11881
11891
|
t0 = time.monotonic()
|
|
11882
11892
|
safe_path = sanitize_log_path(self.path)
|
|
@@ -11890,7 +11900,6 @@ class ZeroChatServerHandler(BaseHTTPRequestHandler):
|
|
|
11890
11900
|
self._log_res(403, safe_path, (time.monotonic() - t0) * 1000, f"Origen no permitido: '{origin}'")
|
|
11891
11901
|
return
|
|
11892
11902
|
|
|
11893
|
-
capture_frontend_user_agent(self.headers.get("User-Agent", ""))
|
|
11894
11903
|
mark_browser_active()
|
|
11895
11904
|
grant = self._resolve_grant()
|
|
11896
11905
|
# Una ejecución solo atiende a su runner: ni el token diario ni sesiones remotas, ni zerochat/login.
|
|
@@ -11908,6 +11917,7 @@ class ZeroChatServerHandler(BaseHTTPRequestHandler):
|
|
|
11908
11917
|
"error": {"code": -32000, "message": "Unauthorized: invalid or missing session token"}
|
|
11909
11918
|
}, safe_path, t0, "Token de sesión ausente o inválido")
|
|
11910
11919
|
return
|
|
11920
|
+
self._capture_browser_user_agent(grant)
|
|
11911
11921
|
|
|
11912
11922
|
req = self._read_rpc_request(safe_path, t0)
|
|
11913
11923
|
if req is None:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|