fix: Interpret relative URLs correctly. (#19)

Also update to latest version of Civet.
  Resolves #11.

Reviewed-on: #19
Co-authored-by: Glen Whitney <glen@studioinfinity.org>
Co-committed-by: Glen Whitney <glen@studioinfinity.org>
This commit is contained in:
Glen Whitney 2023-09-11 03:44:16 +00:00 committed by Glen Whitney
parent b5478254af
commit 765d4ff840
3 changed files with 9 additions and 8 deletions

View File

@ -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',

View File

@ -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:

View File

@ -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)