fix: dynamic extension loading did not use cache key (#3641)
This commit is contained in:
parent
b7fdf99a8d
commit
cacffc67ee
4 changed files with 10 additions and 4 deletions
|
|
@ -113,6 +113,7 @@ def template_renderer(additional_folders: list | None = None) -> Jinja2Templates
|
|||
"LNBITS_EXT_BUILDER": settings.lnbits_extensions_builder_activate_non_admins,
|
||||
"LNBITS_CURRENCIES": list(currencies.keys()),
|
||||
"LNBITS_ALLOWED_CURRENCIES": settings.lnbits_allowed_currencies,
|
||||
"CACHE_KEY": settings.server_startup_time,
|
||||
}
|
||||
|
||||
t.env.globals["WINDOW_SETTINGS"] = window_settings
|
||||
|
|
|
|||
2
lnbits/static/bundle.min.js
vendored
2
lnbits/static/bundle.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -1,8 +1,13 @@
|
|||
window._lnbitsUtils = {
|
||||
url_for(url) {
|
||||
const _url = new URL(url, window.location.origin)
|
||||
_url.searchParams.set('v', WINDOW_SETTINGS.CACHE_KEY)
|
||||
return _url.toString()
|
||||
},
|
||||
loadScript(src) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const script = document.createElement('script')
|
||||
script.src = src
|
||||
script.src = this.url_for(src)
|
||||
script.onload = () => {
|
||||
resolve()
|
||||
}
|
||||
|
|
@ -13,7 +18,7 @@ window._lnbitsUtils = {
|
|||
})
|
||||
},
|
||||
async loadTemplate(url) {
|
||||
return fetch(url)
|
||||
return fetch(this.url_for(url))
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to load template from ${url}`)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<link
|
||||
rel="apple-touch-icon"
|
||||
href="{{ LNBITS_APPLE_TOUCH_ICON if LNBITS_APPLE_TOUCH_ICON else static_url_for('static', 'images/maskable_icon.png') }}"
|
||||
href="{{ LNBITS_APPLE_TOUCH_ICON or static_url_for('static', 'images/maskable_icon.png') }}"
|
||||
/>
|
||||
{% if web_manifest %}
|
||||
<link async="async" rel="manifest" href="{{ web_manifest }}" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue