Authenticate the RPM smoke control connection

This commit is contained in:
Codex committed 2026-11-29 21:45:52 +01:00
1 parent 971b9c05f7
commit 05464b264e
1 file changed
+5 -1
+5 -1
View File
@@ -3,6 +3,7 @@
import json
import os
from pathlib import Path
import secrets
import socket
import subprocess
import time
@@ -26,7 +27,9 @@ fixture = results / "original-smoke.svg"
fixture.write_text('<svg xmlns="http://www.w3.org/2000/svg" width="200" height="140">'
'<rect x="20" y="20" width="160" height="100" rx="12" fill="#2463eb"/>'
'<circle cx="100" cy="70" r="30" fill="#ffcc33"/></svg>')
env = dict(os.environ, VECTORCRAFT_NO_PREFS="1", XDG_RUNTIME_DIR="/tmp/vectorcraft-runtime")
token = secrets.token_hex(32)
env = dict(os.environ, VECTORCRAFT_NO_PREFS="1", XDG_RUNTIME_DIR="/tmp/vectorcraft-runtime",
VECTORCRAFT_CONTROL_TOKEN=token)
Path(env["XDG_RUNTIME_DIR"]).mkdir(mode=0o700, exist_ok=True)
with (results / "gui.log").open("w") as log:
app = subprocess.Popen([
@@ -48,6 +51,7 @@ with (results / "gui.log").open("w") as log:
channel.settimeout(30)
with channel, channel.makefile("rwb") as stream:
for request_id, method, params in (
(0, "auth", {"token": token}),
(1, "ui.inspect", {}),
):
stream.write((json.dumps(dict(id=request_id, method=method, params=params)) + "\n").encode())