mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-13 13:04:30 -08:00
fix paths to host app in non-root side folder
This commit is contained in:
@@ -30,12 +30,12 @@ self.addEventListener('message', async function(e) {
|
||||
})
|
||||
|
||||
// Fake directory, http requests to this directory intercepted by service_worker
|
||||
const FILES_ROOT = '__leporello_files'
|
||||
const FILES_ROOT = new URL('.', globalThis.location).pathname + '__leporello_files/'
|
||||
|
||||
self.addEventListener("fetch", event => {
|
||||
const url = new URL(event.request.url)
|
||||
if(url.pathname.startsWith('/' + FILES_ROOT)) {
|
||||
const path = url.pathname.replace('/' + FILES_ROOT + '/', '')
|
||||
if(url.pathname.startsWith(FILES_ROOT)) {
|
||||
const path = url.pathname.replace(FILES_ROOT, '')
|
||||
|
||||
let file
|
||||
|
||||
|
||||
2
src/effects.js
vendored
2
src/effects.js
vendored
@@ -32,7 +32,7 @@ const load_external_imports = async state => {
|
||||
// Note that we use the same origin as current page (where Leporello
|
||||
// is hosted), so Leporello can access window object for custom
|
||||
// `html_file`
|
||||
window.location.origin + '/' + FILES_ROOT + '/' + u
|
||||
FILES_ROOT + '/' + u
|
||||
))
|
||||
)
|
||||
const modules = Object.fromEntries(
|
||||
|
||||
@@ -8,8 +8,6 @@ const EXAMPLE = `const fib = n =>
|
||||
: fib(n - 1) + fib(n - 2)
|
||||
fib(6)`
|
||||
|
||||
// Fake directory, http requests to this directory intercepted by service_worker
|
||||
export const FILES_ROOT = '__leporello_files'
|
||||
|
||||
const set_error_handler = (w, with_unhandled_rejection = true) => {
|
||||
// TODO err.message
|
||||
@@ -23,8 +21,11 @@ const set_error_handler = (w, with_unhandled_rejection = true) => {
|
||||
}
|
||||
}
|
||||
|
||||
// Fake directory, http requests to this directory intercepted by service_worker
|
||||
export const FILES_ROOT = new URL('./__leporello_files', globalThis.location)
|
||||
|
||||
const get_html_url = state => {
|
||||
const base = window.location.origin + '/' + FILES_ROOT + '/'
|
||||
const base = FILES_ROOT + '/'
|
||||
return state.html_file == ''
|
||||
? base + '__leporello_blank.html'
|
||||
: base + state.html_file + '?leporello'
|
||||
|
||||
Reference in New Issue
Block a user