From 9d94889a4575c52608cf772fa645d836252fedeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 19 Jun 2023 18:31:13 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20gcv:=20Fix=20URL=20for=20skipunt?= =?UTF-8?q?il=20check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Needs to take the current base url and possible path prefixes into account. Closes #4829 --- .../plugins/gcodeviewer/static/js/viewer/worker.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/octoprint/plugins/gcodeviewer/static/js/viewer/worker.js b/src/octoprint/plugins/gcodeviewer/static/js/viewer/worker.js index 5ab1e537e..8c8c06de8 100644 --- a/src/octoprint/plugins/gcodeviewer/static/js/viewer/worker.js +++ b/src/octoprint/plugins/gcodeviewer/static/js/viewer/worker.js @@ -4,10 +4,18 @@ * Time: 12:18 PM */ +// base url to use for API calls; it's the worker location minus the worker.js path +var baseUrl = self.location.href.substring( + 0, + self.location.href.length - "/plugin/gcodeviewer/static/js/viewer/worker.js".length +); + // raw path suitable for fetch() var url; + // path relative to Local var path; + var firstReport; var toolOffsets = [{x: 0, y: 0}]; var g90InfluencesExtruder = false; @@ -455,7 +463,9 @@ var doParse = async function () { // if skipUntil is set, get skipUntilPresent skipUntilPresent = false; if (skipUntil !== undefined && skipUntil !== "") { - result = await fetch("/plugin/gcodeviewer/skipuntilcheck/local/" + path); + result = await fetch( + baseUrl + "/plugin/gcodeviewer/skipuntilcheck/local/" + path + ); if (result.ok) { response = await result.json(); skipUntilPresent = response.present;