mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
Fix current_endpoint shenanigans in web UI
This commit is contained in:
parent
e408acfa7d
commit
bb29d3b1a0
7 changed files with 5 additions and 16 deletions
|
|
@ -1260,7 +1260,7 @@ def upload_plugin():
|
|||
|
||||
@app.route("/plugins/<plugin>", methods=["GET", "POST"])
|
||||
@login_required
|
||||
def custom_plugin(plugin):
|
||||
def custom_plugin(plugin: str):
|
||||
message = ""
|
||||
if not plugin_id_rx.match(plugin):
|
||||
message = f'Invalid plugin id, "{plugin}" (must be between 1 and 64 characters, only letters, numbers, underscores and hyphens)'
|
||||
|
|
@ -1270,14 +1270,14 @@ def custom_plugin(plugin):
|
|||
return {"message": f'Invalid plugin id, "{plugin}" (must be between 1 and 64 characters, only letters, numbers, underscores and hyphens)'}, 400
|
||||
|
||||
if request.method == "GET":
|
||||
plugin_id = request.args.get("plugin_id")
|
||||
page = db.get_plugin_template(plugin_id)
|
||||
page = db.get_plugin_template(plugin)
|
||||
|
||||
if page:
|
||||
return render_template(
|
||||
Environment(loader=FileSystemLoader(join(sep, "usr", "share", "bunkerweb", "ui", "templates") + "/")).from_string(page.decode("utf-8")),
|
||||
dark_mode=app.config["DARK_MODE"],
|
||||
username=current_user.get_id(),
|
||||
current_endpoint=plugin,
|
||||
**app.jinja_env.globals,
|
||||
)
|
||||
|
||||
|
|
|
|||
2
src/ui/templates/head.html
vendored
2
src/ui/templates/head.html
vendored
|
|
@ -1,4 +1,4 @@
|
|||
{% set current_endpoint = url_for(request.endpoint)[1:].split("/")[-1].strip()
|
||||
{% set current_endpoint = current_endpoint or url_for(request.endpoint)[1:].split("/")[-1].strip()
|
||||
%}
|
||||
|
||||
<head>
|
||||
|
|
|
|||
2
src/ui/templates/header.html
vendored
2
src/ui/templates/header.html
vendored
|
|
@ -1,4 +1,4 @@
|
|||
{% set current_endpoint = url_for(request.endpoint)[1:].split("/")[-1].strip().replace('_', ' ').replace('-', ' ')
|
||||
{% set current_endpoint = current_endpoint or url_for(request.endpoint)[1:].split("/")[-1].strip().replace('_', ' ').replace('-', ' ')
|
||||
%}
|
||||
|
||||
<!-- header -->
|
||||
|
|
|
|||
3
src/ui/templates/menu.html
vendored
3
src/ui/templates/menu.html
vendored
|
|
@ -1,6 +1,3 @@
|
|||
{% set current_endpoint = url_for(request.endpoint)[1:].split("/")[-1].strip()
|
||||
%}
|
||||
|
||||
<!-- float button-->
|
||||
<button
|
||||
aria-controls="sidebar-menu"
|
||||
|
|
|
|||
3
src/ui/templates/navbar.html
vendored
3
src/ui/templates/navbar.html
vendored
|
|
@ -1,6 +1,3 @@
|
|||
{% set current_endpoint = url_for(request.endpoint)[1:].split("/")[-1].strip()
|
||||
%}
|
||||
|
||||
<div class="navigation-wrap bg-custom start-header start-style">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
|
|
|
|||
2
src/ui/templates/settings_plugins.html
vendored
2
src/ui/templates/settings_plugins.html
vendored
|
|
@ -1,5 +1,3 @@
|
|||
{% set current_endpoint = url_for(request.endpoint)[1:].split("/")[-1].strip().replace('_', '-')
|
||||
%}
|
||||
{% set global_config = config["CONFIG"].get_config() %}
|
||||
{% set plugins = config["CONFIG"].get_plugins() %}
|
||||
<!-- plugin item -->
|
||||
|
|
|
|||
3
src/ui/templates/settings_tabs.html
vendored
3
src/ui/templates/settings_tabs.html
vendored
|
|
@ -1,6 +1,3 @@
|
|||
|
||||
{% set current_endpoint = url_for(request.endpoint)[1:].split("/")[-1].strip().replace('_', '-')
|
||||
%}
|
||||
{% set plugins = config["CONFIG"].get_plugins() %}
|
||||
<div data-{{current_endpoint}}-tabs class="col-span-12 grid grid-cols-12 {% if current_endpoint == 'services' %}mb-4{% endif %}">
|
||||
<!-- desktop tabs -->
|
||||
|
|
|
|||
Loading…
Reference in a new issue