From 765d4ff84022ae57a709a913188260b290cc0d3a Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Mon, 11 Sep 2023 03:44:16 +0000 Subject: [PATCH] fix: Interpret relative URLs correctly. (#19) Also update to latest version of Civet. Resolves #11. Reviewed-on: https://code.studioinfinity.org/glen/archematics/pulls/19 Co-authored-by: Glen Whitney Co-committed-by: Glen Whitney --- package.json5 | 2 +- pnpm-lock.yaml | 8 ++++---- src/giveAwrl.civet | 7 ++++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/package.json5 b/package.json5 index 630af6b..726cdf6 100644 --- a/package.json5 +++ b/package.json5 @@ -33,7 +33,7 @@ url: 'https://code.studioinfinity.org/glen/archematics.git', }, devDependencies: { - '@danielx/civet': '^0.6.31', + '@danielx/civet': '^0.6.36', '@types/jquery': '^3.5.18', 'http-server': '^14.1.1', typescript: '^5.2.2', diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b5e9b8a..d2d7801 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,8 +11,8 @@ dependencies: devDependencies: '@danielx/civet': - specifier: ^0.6.31 - version: 0.6.31(typescript@5.2.2) + specifier: ^0.6.36 + version: 0.6.36(typescript@5.2.2) '@types/jquery': specifier: ^3.5.18 version: 3.5.18 @@ -32,8 +32,8 @@ packages: '@jridgewell/trace-mapping': 0.3.9 dev: true - /@danielx/civet@0.6.31(typescript@5.2.2): - resolution: {integrity: sha512-nI+/CbAqlM4uKN3BGmOIJgCeEv8MsGs2sC7Vx9nUrqXFJi9KPMWUhGIDb+hp/PodjgzRw0iH2bbSzW17KeiyoA==} + /@danielx/civet@0.6.36(typescript@5.2.2): + resolution: {integrity: sha512-ApMaq2YyXfiM0xpcFWRZffVLgqxrYu3UWS5A0sWViK+RMeamVp6J0iGUeUsQFCF2Gd9+ldEPzWgUThzUcfQKnA==} engines: {node: '>=19 || ^18.6.0 || ^16.17.0'} hasBin: true peerDependencies: diff --git a/src/giveAwrl.civet b/src/giveAwrl.civet index 8597353..29c5e5b 100644 --- a/src/giveAwrl.civet +++ b/src/giveAwrl.civet @@ -15,9 +15,10 @@ else if url.includes '.wrl' // Need to obtain the text and check what level it is response := await fetch url text .= await response.text() - if /#\s*VRML\s*V?1./i.test(text) - text = convert(text) + if /#\s*VRML\s*V?1[.]/i.test text + text = convert text + browser.baseURL = url scene := await browser.createX3DFromString text - browser.replaceWorld(scene) + browser.replaceWorld scene site.after(canvas)