From 2f49691e703de2dcf80b923ddcd7879c40a77879 Mon Sep 17 00:00:00 2001 From: manatlan Date: Thu, 7 Nov 2024 11:02:49 +0100 Subject: [PATCH] Update runners.py interaction path agnostic (use the real path where the page is served ("coder" compliant)) --- htagweb/runners.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htagweb/runners.py b/htagweb/runners.py index 9d4aab4..24ba796 100644 --- a/htagweb/runners.py +++ b/htagweb/runners.py @@ -273,7 +273,7 @@ async def handle(self, request, jslib += "\nasync function _write_(x) {return x}\n" pparano="" - + jslib += "let webroot = document.location.pathname || '/';" if is_http_only: # interactions use HTTP POST @@ -281,7 +281,7 @@ async def handle(self, request, async function interact( o ) { let body = await _write_(JSON.stringify(o)); - let req=await window.fetch("/_/%(fqn)s%(pparano)s",{method:"POST", body: body, mode: 'cors', credentials: 'include', referrerPolicy: "origin"}); + let req=await window.fetch(webroot + "_/%(fqn)s%(pparano)s",{method:"POST", body: body, mode: 'cors', credentials: 'include', referrerPolicy: "origin"}); let actions=await req.text(); action( await _read_(actions) ); } @@ -301,7 +301,7 @@ async def handle(self, request, let retryms=500; function connect() { - _WS_= new WebSocket("//"+location.host+"/_/%(fqn)s%(pparano)s"); + _WS_= new WebSocket("//" + location.host + webroot + "_/%(fqn)s%(pparano)s"); _WS_.onopen=function(evt) { console.log("** WS connected") document.body.classList.remove("htagoff");