From 3b752e6ca18fae3c4c134e4861d6b3f0383c2158 Mon Sep 17 00:00:00 2001 From: "Mr. For Example" <62230687+MrForExample@users.noreply.github.com> Date: Mon, 16 Sep 2024 17:58:37 -0600 Subject: [PATCH] Update gsVisualizer.js --- web/js/gsVisualizer.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/web/js/gsVisualizer.js b/web/js/gsVisualizer.js index 7a58c7d..6038717 100644 --- a/web/js/gsVisualizer.js +++ b/web/js/gsVisualizer.js @@ -23,6 +23,8 @@ window.addEventListener("resize", handleResize); var lastTimestamp = ""; var needUpdate = false; +let currentURL; +var url = location.protocol + '//' + location.host; function frameUpdate() { @@ -57,14 +59,14 @@ async function main(filepath="") { if (/^.+\.[a-zA-Z]+$/.test(filepath)){ let params = {"filepath": filepath}; - const url = api.apiURL('/viewfile?' + new URLSearchParams(params)); + currentURL = url + '/viewfile?' + new URLSearchParams(params); var splat = null; var fileExt = filepath.split('.').pop().toLowerCase(); if (fileExt == "ply"){ - splat = await SPLAT.PLYLoader.LoadAsync(url, scene, onProgress); + splat = await SPLAT.PLYLoader.LoadAsync(currentURL, scene, onProgress); } else if (fileExt == "splat") { - splat = await SPLAT.Loader.LoadAsync(url, scene, onProgress); + splat = await SPLAT.Loader.LoadAsync(currentURL, scene, onProgress); } else { throw new Error(`File extension name has to be either .ply or .splat, got .${fileExt}`); }