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', url: 'https://code.studioinfinity.org/glen/archematics.git',
}, },
devDependencies: { devDependencies: {
'@danielx/civet': '^0.6.31', '@danielx/civet': '^0.6.36',
'@types/jquery': '^3.5.18', '@types/jquery': '^3.5.18',
'http-server': '^14.1.1', 'http-server': '^14.1.1',
typescript: '^5.2.2', typescript: '^5.2.2',

View File

@ -11,8 +11,8 @@ dependencies:
devDependencies: devDependencies:
'@danielx/civet': '@danielx/civet':
specifier: ^0.6.31 specifier: ^0.6.36
version: 0.6.31(typescript@5.2.2) version: 0.6.36(typescript@5.2.2)
'@types/jquery': '@types/jquery':
specifier: ^3.5.18 specifier: ^3.5.18
version: 3.5.18 version: 3.5.18
@ -32,8 +32,8 @@ packages:
'@jridgewell/trace-mapping': 0.3.9 '@jridgewell/trace-mapping': 0.3.9
dev: true dev: true
/@danielx/civet@0.6.31(typescript@5.2.2): /@danielx/civet@0.6.36(typescript@5.2.2):
resolution: {integrity: sha512-nI+/CbAqlM4uKN3BGmOIJgCeEv8MsGs2sC7Vx9nUrqXFJi9KPMWUhGIDb+hp/PodjgzRw0iH2bbSzW17KeiyoA==} resolution: {integrity: sha512-ApMaq2YyXfiM0xpcFWRZffVLgqxrYu3UWS5A0sWViK+RMeamVp6J0iGUeUsQFCF2Gd9+ldEPzWgUThzUcfQKnA==}
engines: {node: '>=19 || ^18.6.0 || ^16.17.0'} engines: {node: '>=19 || ^18.6.0 || ^16.17.0'}
hasBin: true hasBin: true
peerDependencies: peerDependencies:

View File

@ -15,9 +15,10 @@ else if url.includes '.wrl'
// Need to obtain the text and check what level it is // Need to obtain the text and check what level it is
response := await fetch url response := await fetch url
text .= await response.text() text .= await response.text()
if /#\s*VRML\s*V?1./i.test(text) if /#\s*VRML\s*V?1[.]/i.test text
text = convert(text) text = convert text
browser.baseURL = url
scene := await browser.createX3DFromString text scene := await browser.createX3DFromString text
browser.replaceWorld(scene) browser.replaceWorld scene
site.after(canvas) site.after(canvas)