fix: extension builder preview was in reload loop (#3643)

This commit is contained in:
dni ⚡ 2025-12-09 09:21:38 +01:00 committed by GitHub
parent cacffc67ee
commit 327b9d7f63
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 8 deletions

View file

@ -76,8 +76,8 @@ async def extensions_builder_preview(
request, request,
"error.html", "error.html",
{ {
"err": f"Extension {ext_id} not found", "status_code": 404,
"message": "Please 'Refresh Preview' first.", "message": f"Extension {ext_id} not found, refresh Preview.",
}, },
status_code=HTTPStatus.NOT_FOUND, status_code=HTTPStatus.NOT_FOUND,
) )
@ -87,7 +87,6 @@ async def extensions_builder_preview(
html_file_path.as_posix(), html_file_path.as_posix(),
{ {
"user": user.json(), "user": user.json(),
"ajax": _is_ajax_request(request),
}, },
) )
@ -96,6 +95,7 @@ async def extensions_builder_preview(
"style-src 'self' 'unsafe-inline'; " "style-src 'self' 'unsafe-inline'; "
"script-src 'self' 'unsafe-inline' 'unsafe-eval'" "script-src 'self' 'unsafe-inline' 'unsafe-eval'"
) )
return response return response
@ -285,7 +285,3 @@ async def lnurlwallet(request: Request, lightning: str = ""):
return RedirectResponse( return RedirectResponse(
f"/wallet?usr={account.id}&wal={wallet.id}", f"/wallet?usr={account.id}&wal={wallet.id}",
) )
def _is_ajax_request(request: Request):
return request.headers.get("X-Requested-With", None) == "XMLHttpRequest"

File diff suppressed because one or more lines are too long

View file

@ -15,6 +15,7 @@ const DynamicComponent = {
const path = `/${name}/` const path = `/${name}/`
const routesPath = `/${name}/static/routes.json` const routesPath = `/${name}/static/routes.json`
if (this.$router.getRoutes().some(r => r.path === path)) return if (this.$router.getRoutes().some(r => r.path === path)) return
if (this.$route.fullPath.startsWith('/extensions/builder/preview')) return
fetch(routesPath) fetch(routesPath)
.then(async res => { .then(async res => {
if (!res.ok) throw new Error('No dynamic routes found') if (!res.ok) throw new Error('No dynamic routes found')