diff --git a/lnbits/core/templates/index.html b/lnbits/core/templates/index.html deleted file mode 100644 index 6cd686af4..000000000 --- a/lnbits/core/templates/index.html +++ /dev/null @@ -1,3 +0,0 @@ -{% extends "base.html" %} {% from "macros.jinja" import window_vars with context -%} {% block scripts %} {{ window_vars(user) }} {% endblock %} {% block page %}{% -endblock %} diff --git a/lnbits/core/templates/index_public.html b/lnbits/core/templates/index_public.html deleted file mode 100644 index bd50c957f..000000000 --- a/lnbits/core/templates/index_public.html +++ /dev/null @@ -1,3 +0,0 @@ -{% extends "public.html" %} {% from "macros.jinja" import window_vars with -context %} {% block scripts %} {{ window_vars() }} {% endblock %} {% block page -%} {% endblock %} diff --git a/lnbits/core/views/generic.py b/lnbits/core/views/generic.py index d5fe0d45a..e073a5c4f 100644 --- a/lnbits/core/views/generic.py +++ b/lnbits/core/views/generic.py @@ -200,7 +200,7 @@ async def index( ) -> HTMLResponse: return template_renderer().TemplateResponse( request, - "index.html", + "base.html", { "user": user.json(), }, @@ -211,7 +211,7 @@ async def index( @generic_router.get("/node/public") @generic_router.get("/first_install", dependencies=[Depends(check_first_install)]) async def index_public(request: Request) -> HTMLResponse: - return template_renderer().TemplateResponse(request, "index.html", {"public": True}) + return template_renderer().TemplateResponse(request, "base.html", {"public": True}) @generic_router.get("/uuidv4/{hex_value}") diff --git a/lnbits/helpers.py b/lnbits/helpers.py index 8bcb2a013..88a001b34 100644 --- a/lnbits/helpers.py +++ b/lnbits/helpers.py @@ -55,7 +55,6 @@ def static_url_for(static: str, path: str) -> str: def template_renderer(additional_folders: list | None = None) -> Jinja2Templates: folders = [ "lnbits/templates", - "lnbits/core/templates", settings.extension_builder_working_dir_path.as_posix(), ] diff --git a/lnbits/templates/base.html b/lnbits/templates/base.html index e015f6c96..1f6023ce3 100644 --- a/lnbits/templates/base.html +++ b/lnbits/templates/base.html @@ -90,6 +90,9 @@ {% if not public %} window.g.isPublicPage = false {% endif %} + window.app = Vue.createApp({ + el: '#vue', + }) {% endif %} diff --git a/lnbits/templates/error.html b/lnbits/templates/error.html index 47f57b274..7bd6374d4 100644 --- a/lnbits/templates/error.html +++ b/lnbits/templates/error.html @@ -1,6 +1,4 @@ -{% extends "public.html" %} {% from "macros.jinja" import window_vars with -context %} {% block scripts %} {{ window_vars() }} {% endblock %} {% block -page_container %} +{% extends "base.html" %} {% block page_container %} - //Needed for Vue to create the app on first load (although called on every page, its only loaded once) - window.app = Vue.createApp({ - el: '#vue', - mixins: [window.windowMixin] - }) + {%- endmacro %} diff --git a/lnbits/core/templates/service-worker.js b/lnbits/templates/service-worker.js similarity index 100% rename from lnbits/core/templates/service-worker.js rename to lnbits/templates/service-worker.js