mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
update modes page + fix
* now raw mode will show disabled settings (with a method like scheduler) * we can access every modes form services page * merge all modes in one route for better lisibility * update builder logic to fit new format
This commit is contained in:
parent
9c61778734
commit
d0e2ec69b7
24 changed files with 298 additions and 73 deletions
40
src/ui/builder/advanced_mode.py
Normal file
40
src/ui/builder/advanced_mode.py
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import base64
|
||||
import json
|
||||
|
||||
from .utils.form import get_forms, get_service_settings
|
||||
|
||||
|
||||
def advanced_mode_builder(templates: list[dict], plugins: list, global_config: dict, total_config: dict, service_name: str) -> str:
|
||||
"""Render forms with global config data.
|
||||
ATM we don't need templates but we need to pass at least one to the function (it will simply not override anything).
|
||||
"""
|
||||
|
||||
# We need
|
||||
settings = get_service_settings(service_name, global_config, total_config)
|
||||
builder = [
|
||||
{
|
||||
"type": "card",
|
||||
"containerColumns": {"pc": 12, "tablet": 12, "mobile": 12},
|
||||
"widgets": [
|
||||
{
|
||||
"type": "Title",
|
||||
"data": {
|
||||
"title": service_name,
|
||||
"type": "container",
|
||||
"lowercase": True,
|
||||
},
|
||||
},
|
||||
{
|
||||
"type": "Subtitle",
|
||||
"data": {"subtitle": "services_manage_subtitle", "type": "container", "subtitleClass": "mb-4"},
|
||||
},
|
||||
{
|
||||
"type": "Templates",
|
||||
"data": {
|
||||
"templates": get_forms(templates, plugins, settings, ("advanced",)),
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
return base64.b64encode(bytes(json.dumps(builder), "utf-8")).decode("ascii")
|
||||
40
src/ui/builder/easy_mode.py
Normal file
40
src/ui/builder/easy_mode.py
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import base64
|
||||
import json
|
||||
|
||||
from .utils.form import get_forms, get_service_settings
|
||||
|
||||
|
||||
def easy_mode_builder(templates: list[dict], plugins: list, global_config: dict, total_config: dict, service_name: str) -> str:
|
||||
"""Render forms with global config data.
|
||||
ATM we don't need templates but we need to pass at least one to the function (it will simply not override anything).
|
||||
"""
|
||||
|
||||
# We need
|
||||
settings = get_service_settings(service_name, global_config, total_config)
|
||||
builder = [
|
||||
{
|
||||
"type": "card",
|
||||
"containerColumns": {"pc": 12, "tablet": 12, "mobile": 12},
|
||||
"widgets": [
|
||||
{
|
||||
"type": "Title",
|
||||
"data": {
|
||||
"title": service_name,
|
||||
"type": "container",
|
||||
"lowercase": True,
|
||||
},
|
||||
},
|
||||
{
|
||||
"type": "Subtitle",
|
||||
"data": {"subtitle": "services_manage_subtitle", "type": "container", "subtitleClass": "mb-4"},
|
||||
},
|
||||
{
|
||||
"type": "Templates",
|
||||
"data": {
|
||||
"templates": get_forms(templates, plugins, settings, ("easy",)),
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
return base64.b64encode(bytes(json.dumps(builder), "utf-8")).decode("ascii")
|
||||
|
|
@ -18,11 +18,24 @@ def raw_mode_builder(templates: list[dict], plugins: list, global_config: dict,
|
|||
|
||||
# We need
|
||||
settings = get_service_settings(service_name, global_config, total_config)
|
||||
|
||||
builder = [
|
||||
{
|
||||
"type": "card",
|
||||
"containerColumns": {"pc": 12, "tablet": 12, "mobile": 12},
|
||||
"widgets": [
|
||||
{
|
||||
"type": "Title",
|
||||
"data": {
|
||||
"title": service_name,
|
||||
"type": "container",
|
||||
"lowercase": True,
|
||||
},
|
||||
},
|
||||
{
|
||||
"type": "Subtitle",
|
||||
"data": {"subtitle": "services_manage_subtitle", "type": "container", "subtitleClass": "mb-4"},
|
||||
},
|
||||
{
|
||||
"type": "Templates",
|
||||
"data": {
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ def services_action(
|
|||
"size": "normal",
|
||||
"attrs": {
|
||||
"role": "link",
|
||||
"data-link": f"services/{mode}/{server_name}",
|
||||
"data-link": f"modes?service_name={server_name}&mode={mode}" if mode != "create" else f"modes?mode={mode}",
|
||||
},
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -106,9 +106,11 @@ def set_raw(template: list, plugins_base: list, settings: dict) -> dict:
|
|||
for plugin in plugins:
|
||||
for setting, value in plugin.get("settings").items():
|
||||
|
||||
# avoid some methods from services_settings
|
||||
if setting in settings and settings[setting].get("method", "ui") not in ("ui", "default", "manual"):
|
||||
continue
|
||||
# we want to show none default value even if this is a disabled method
|
||||
|
||||
# if setting in settings and settings[setting].get("method", "ui") not in ("ui", "default", "manual") and :
|
||||
# continue
|
||||
|
||||
raw_value = None
|
||||
|
||||
# Start by setting template value if exists
|
||||
|
|
@ -130,6 +132,7 @@ def set_raw(template: list, plugins_base: list, settings: dict) -> dict:
|
|||
if raw_value:
|
||||
raw_settings[setting] = raw_value
|
||||
|
||||
print("raw_settings", raw_settings, flush=True)
|
||||
return raw_settings
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ import ButtonGroup from "@components/Widget/ButtonGroup.vue";
|
|||
import { useEqualStr } from "@utils/global.js";
|
||||
|
||||
/**
|
||||
* @name Builder/RawMode.vue
|
||||
* @description This component is lightweight builder containing only the necessary components to create the raw page.
|
||||
* @name Builder/Modes.vue
|
||||
* @description This component is lightweight builder containing only the necessary components to create a service mode page.
|
||||
* @example
|
||||
* [
|
||||
* {
|
||||
|
|
@ -103,6 +103,9 @@ function updateRaw(v) {
|
|||
* @returns {string} - The raw string
|
||||
*/
|
||||
function json2raw(json) {
|
||||
// return nothing case json is empty object
|
||||
if (Object.keys(json).length === 0) return "";
|
||||
|
||||
let dataStr = JSON.stringify(json);
|
||||
// Remove first and last curly brackets
|
||||
dataStr = dataStr.slice(1, -1);
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
<script setup>
|
||||
import { reactive, onBeforeMount, onMounted } from "vue";
|
||||
import DashboardLayout from "@components/Dashboard/Layout.vue";
|
||||
import BuilderRaw from "@components/Builder/RawMode.vue";
|
||||
import BuilderModes from "@components/Builder/Modes.vue";
|
||||
import { useGlobal } from "@utils/global";
|
||||
|
||||
/**
|
||||
* @name Page/Raw.vue
|
||||
* @description This component is the raw page.
|
||||
* @name Page/Modes.vue
|
||||
* @description This component is the modes page.
|
||||
* This page displays the raw form and additionnal actions to manage or create a service.
|
||||
*/
|
||||
|
||||
const raw = reactive({
|
||||
const modes = reactive({
|
||||
builder: "",
|
||||
});
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ onBeforeMount(() => {
|
|||
dataEl && !dataEl.getAttribute(dataAtt).includes(dataAtt)
|
||||
? JSON.parse(atob(dataEl.getAttribute(dataAtt)))
|
||||
: {};
|
||||
raw.builder = data;
|
||||
modes.builder = data;
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
|
|
@ -34,7 +34,7 @@ onMounted(() => {
|
|||
<template>
|
||||
<DashboardLayout>
|
||||
<div class="col-span-12 grid grid-cols-12 card">
|
||||
<BuilderRaw v-if="raw.builder" :builder="raw.builder" />
|
||||
<BuilderModes v-if="modes.builder" :builder="modes.builder" />
|
||||
</div>
|
||||
</DashboardLayout>
|
||||
</template>
|
||||
24
src/ui/client/dashboard/pages/modes/index.html
Normal file
24
src/ui/client/dashboard/pages/modes/index.html
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/x-icon" href="/img/favicon.ico" />
|
||||
<link rel="stylesheet" href="/css/style.css" />
|
||||
<link rel="stylesheet" href="/css/flag-icons.min.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>BunkerWeb | Raw mode</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="hidden" data-server-global='{"username" : "admin"}'></div>
|
||||
<div
|
||||
class="hidden"
|
||||
data-server-flash='[{"type" : "success", "title" : "title", "message" : "Success feedback"}, {"type" : "error", "title" : "title", "message" : "Error feedback"}, {"type" : "warning", "title" : "title", "message" : "Warning feedback"}, {"type" : "info", "title" : "title", "message" : "Info feedback"}]'
|
||||
></div>
|
||||
<div
|
||||
class="hidden"
|
||||
data-server-builder="W3sidHlwZSI6ICJjYXJkIiwgImNvbnRhaW5lckNvbHVtbnMiOiB7InBjIjogMTIsICJ0YWJsZXQiOiAxMiwgIm1vYmlsZSI6IDEyfSwgIndpZGdldHMiOiBbeyJ0eXBlIjogIlRpdGxlIiwgImRhdGEiOiB7InRpdGxlIjogImFwcDEuZXhhbXBsZS5jb20iLCAidHlwZSI6ICJjb250YWluZXIiLCAibG93ZXJjYXNlIjogdHJ1ZX19LCB7InR5cGUiOiAiU3VidGl0bGUiLCAiZGF0YSI6IHsic3VidGl0bGUiOiAic2VydmljZXNfbWFuYWdlX3N1YnRpdGxlIiwgInR5cGUiOiAiY29udGFpbmVyIiwgInN1YnRpdGxlQ2xhc3MiOiAibWItNCJ9fSwgeyJ0eXBlIjogIlRlbXBsYXRlcyIsICJkYXRhIjogeyJ0ZW1wbGF0ZXMiOiB7InJhdyI6IHsiZGVmYXVsdCI6IHt9fX19fV19XQ=="
|
||||
></div>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="modes.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
import { createApp } from "vue";
|
||||
import { createPinia } from "pinia";
|
||||
import { getI18n } from "@utils/lang.js";
|
||||
import Raw from "./Raw.vue";
|
||||
import Modes from "./Modes.vue";
|
||||
|
||||
const pinia = createPinia();
|
||||
|
||||
createApp(Raw)
|
||||
createApp(Modes)
|
||||
.use(pinia)
|
||||
.use(getI18n(["dashboard", "action", "inp", "icons", "services", "raw"]))
|
||||
.mount("#app");
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/x-icon" href="/img/favicon.ico" />
|
||||
<link rel="stylesheet" href="/css/style.css" />
|
||||
<link rel="stylesheet" href="/css/flag-icons.min.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>BunkerWeb | Raw mode</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="hidden" data-server-global='{"username" : "admin"}'></div>
|
||||
<div
|
||||
class="hidden"
|
||||
data-server-flash='[{"type" : "success", "title" : "title", "message" : "Success feedback"}, {"type" : "error", "title" : "title", "message" : "Error feedback"}, {"type" : "warning", "title" : "title", "message" : "Warning feedback"}, {"type" : "info", "title" : "title", "message" : "Info feedback"}]'
|
||||
></div>
|
||||
<div
|
||||
class="hidden"
|
||||
data-server-builder="W3sidHlwZSI6ICJjYXJkIiwgImNvbnRhaW5lckNvbHVtbnMiOiB7InBjIjogMTIsICJ0YWJsZXQiOiAxMiwgIm1vYmlsZSI6IDEyfSwgIndpZGdldHMiOiBbeyJ0eXBlIjogIlRpdGxlIiwgImRhdGEiOiB7InRpdGxlIjogImFwcDEuZXhhbXBsZS5jb20iLCAidHlwZSI6ICJjb250YWluZXIiLCAibG93ZXJjYXNlIjogdHJ1ZX19LCB7InR5cGUiOiAiU3VidGl0bGUiLCAiZGF0YSI6IHsic3VidGl0bGUiOiAic2VydmljZXNfbWFuYWdlX3N1YnRpdGxlIiwgInR5cGUiOiAiY29udGFpbmVyIiwgInN1YnRpdGxlQ2xhc3MiOiAibWItNCJ9fSwgeyJ0eXBlIjogIlRlbXBsYXRlcyIsICJkYXRhIjogeyJ0ZW1wbGF0ZXMiOiB7InJhdyI6IHsiZGVmYXVsdCI6IHsiU0VSVkVSX05BTUUiOiAiYXBwMS5leGFtcGxlLmNvbSIsICJDT1JTX0FMTE9XX09SSUdJTiI6ICJzZWxmIiwgIkNST1NTX09SSUdJTl9PUEVORVJfUE9MSUNZIjogInNhbWUtb3JpZ2luIiwgIkNST1NTX09SSUdJTl9FTUJFRERFUl9QT0xJQ1kiOiAicmVxdWlyZS1jb3JwIiwgIkNST1NTX09SSUdJTl9SRVNPVVJDRV9QT0xJQ1kiOiAic2FtZS1zaXRlIiwgIlJFTU9WRV9IRUFERVJTIjogIlNlcnZlciBFeHBlY3QtQ1QgWC1Qb3dlcmVkLUJ5IFgtQXNwTmV0LVZlcnNpb24gWC1Bc3BOZXRNdmMtVmVyc2lvbiBQdWJsaWMtS2V5LVBpbnMiLCAiS0VFUF9VUFNUUkVBTV9IRUFERVJTIjogIkNvbnRlbnQtU2VjdXJpdHktUG9saWN5IFBlcm1pc3Npb25zLVBvbGljeSBYLUZyYW1lLU9wdGlvbnMiLCAiU1RSSUNUX1RSQU5TUE9SVF9TRUNVUklUWSI6ICJtYXgtYWdlPTMxNTM2MDAwOyBpbmNsdWRlU3ViRG9tYWluczsgcHJlbG9hZCIsICJQRVJNSVNTSU9OU19QT0xJQ1kiOiAiYWNjZWxlcm9tZXRlcj0oKSwgYW1iaWVudC1saWdodC1zZW5zb3I9KCksIGF0dHJpYnV0aW9uLXJlcG9ydGluZz0oKSwgYXV0b3BsYXk9KCksIGJhdHRlcnk9KCksIGJsdWV0b290aD0oKSwgYnJvd3NpbmctdG9waWNzPSgpLCBjYW1lcmE9KCksIGNvbXB1dGUtcHJlc3N1cmU9KCksIGRpc3BsYXktY2FwdHVyZT0oKSwgZG9jdW1lbnQtZG9tYWluPSgpLCBlbmNyeXB0ZWQtbWVkaWE9KCksIGV4ZWN1dGlvbi13aGlsZS1ub3QtcmVuZGVyZWQ9KCksIGV4ZWN1dGlvbi13aGlsZS1vdXQtb2Ytdmlld3BvcnQ9KCksIGZ1bGxzY3JlZW49KCksIGdhbWVwYWQ9KCksIGdlb2xvY2F0aW9uPSgpLCBneXJvc2NvcGU9KCksIGhpZD0oKSwgaWRlbnRpdHktY3JlZGVudGlhbHMtZ2V0PSgpLCBpZGxlLWRldGVjdGlvbj0oKSwgbG9jYWwtZm9udHM9KCksIG1hZ25ldG9tZXRlcj0oKSwgbWljcm9waG9uZT0oKSwgbWlkaT0oKSwgb3RwLWNyZWRlbnRpYWxzPSgpLCBwYXltZW50PSgpLCBwaWN0dXJlLWluLXBpY3R1cmU9KCksIHB1YmxpY2tleS1jcmVkZW50aWFscy1jcmVhdGU9KCksIHB1YmxpY2tleS1jcmVkZW50aWFscy1nZXQ9KCksIHNjcmVlbi13YWtlLWxvY2s9KCksIHNlcmlhbD0oKSwgc3BlYWtlci1zZWxlY3Rpb249KCksIHN0b3JhZ2UtYWNjZXNzPSgpLCB1c2I9KCksIHdlYi1zaGFyZT0oKSwgd2luZG93LW1hbmFnZW1lbnQ9KCksIHhyLXNwYXRpYWwtdHJhY2tpbmc9KCkiLCAiTU9EU0VDVVJJVFlfQ1JTX1ZFUlNJT04iOiAiNCJ9fX19fV19XQ=="
|
||||
></div>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="raw.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
40
src/ui/client/tests/builder/advanced_mode.py
Normal file
40
src/ui/client/tests/builder/advanced_mode.py
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import base64
|
||||
import json
|
||||
|
||||
from .utils.form import get_forms, get_service_settings
|
||||
|
||||
|
||||
def advanced_mode_builder(templates: list[dict], plugins: list, global_config: dict, total_config: dict, service_name: str) -> str:
|
||||
"""Render forms with global config data.
|
||||
ATM we don't need templates but we need to pass at least one to the function (it will simply not override anything).
|
||||
"""
|
||||
|
||||
# We need
|
||||
settings = get_service_settings(service_name, global_config, total_config)
|
||||
builder = [
|
||||
{
|
||||
"type": "card",
|
||||
"containerColumns": {"pc": 12, "tablet": 12, "mobile": 12},
|
||||
"widgets": [
|
||||
{
|
||||
"type": "Title",
|
||||
"data": {
|
||||
"title": service_name,
|
||||
"type": "container",
|
||||
"lowercase": True,
|
||||
},
|
||||
},
|
||||
{
|
||||
"type": "Subtitle",
|
||||
"data": {"subtitle": "services_manage_subtitle", "type": "container", "subtitleClass": "mb-4"},
|
||||
},
|
||||
{
|
||||
"type": "Templates",
|
||||
"data": {
|
||||
"templates": get_forms(templates, plugins, settings, ("advanced",)),
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
return builder
|
||||
40
src/ui/client/tests/builder/easy_mode.py
Normal file
40
src/ui/client/tests/builder/easy_mode.py
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import base64
|
||||
import json
|
||||
|
||||
from .utils.form import get_forms, get_service_settings
|
||||
|
||||
|
||||
def easy_mode_builder(templates: list[dict], plugins: list, global_config: dict, total_config: dict, service_name: str) -> str:
|
||||
"""Render forms with global config data.
|
||||
ATM we don't need templates but we need to pass at least one to the function (it will simply not override anything).
|
||||
"""
|
||||
|
||||
# We need
|
||||
settings = get_service_settings(service_name, global_config, total_config)
|
||||
builder = [
|
||||
{
|
||||
"type": "card",
|
||||
"containerColumns": {"pc": 12, "tablet": 12, "mobile": 12},
|
||||
"widgets": [
|
||||
{
|
||||
"type": "Title",
|
||||
"data": {
|
||||
"title": service_name,
|
||||
"type": "container",
|
||||
"lowercase": True,
|
||||
},
|
||||
},
|
||||
{
|
||||
"type": "Subtitle",
|
||||
"data": {"subtitle": "services_manage_subtitle", "type": "container", "subtitleClass": "mb-4"},
|
||||
},
|
||||
{
|
||||
"type": "Templates",
|
||||
"data": {
|
||||
"templates": get_forms(templates, plugins, settings, ("easy",)),
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
return builder
|
||||
|
|
@ -263,7 +263,7 @@ def services_action(
|
|||
"size": "normal",
|
||||
"attrs": {
|
||||
"role": "link",
|
||||
"data-link": f"services/{mode}/{server_name}",
|
||||
"data-link": f"modes?service_name={server_name}&mode={mode}" if mode != "create" else f"modes?mode={mode}",
|
||||
},
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -106,9 +106,11 @@ def set_raw(template: list, plugins_base: list, settings: dict) -> dict:
|
|||
for plugin in plugins:
|
||||
for setting, value in plugin.get("settings").items():
|
||||
|
||||
# avoid some methods from services_settings
|
||||
if setting in settings and settings[setting].get("method", "ui") not in ("ui", "default", "manual"):
|
||||
continue
|
||||
# we want to show none default value even if this is a disabled method
|
||||
|
||||
# if setting in settings and settings[setting].get("method", "ui") not in ("ui", "default", "manual") and :
|
||||
# continue
|
||||
|
||||
raw_value = None
|
||||
|
||||
# Start by setting template value if exists
|
||||
|
|
@ -130,6 +132,7 @@ def set_raw(template: list, plugins_base: list, settings: dict) -> dict:
|
|||
if raw_value:
|
||||
raw_settings[setting] = raw_value
|
||||
|
||||
print("raw_settings", raw_settings, flush=True)
|
||||
return raw_settings
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ export default defineConfig({
|
|||
),
|
||||
jobs: resolve(__dirname, "./dashboard/pages/jobs/index.html"),
|
||||
services: resolve(__dirname, "./dashboard/pages/services/index.html"),
|
||||
raw: resolve(__dirname, "./dashboard/pages/raw/index.html"),
|
||||
modes: resolve(__dirname, "./dashboard/pages/modes/index.html"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -58,6 +58,8 @@ from builder.global_config import global_config_builder
|
|||
from builder.jobs import jobs_builder
|
||||
from builder.services import services_builder
|
||||
from builder.raw_mode import raw_mode_builder
|
||||
from builder.advanced_mode import advanced_mode_builder
|
||||
from builder.easy_mode import easy_mode_builder
|
||||
|
||||
from common_utils import get_version # type: ignore
|
||||
from logger import setup_logger # type: ignore
|
||||
|
|
@ -1278,40 +1280,51 @@ def update_service(config, variables, format_configs, server_name, old_server_na
|
|||
return redirect(url_for("loading", next=url_for(redirect_name, service_name=[server_name]), message=message))
|
||||
|
||||
|
||||
@app.route("/raw-mode", methods=["GET", "POST"])
|
||||
@app.route("/modes", methods=["GET", "POST"])
|
||||
@login_required
|
||||
def services_raw():
|
||||
def services_modes():
|
||||
if request.method == "POST":
|
||||
if DB.readonly:
|
||||
return handle_error("Database is in read-only mode", "services")
|
||||
|
||||
verify_data_in_form(
|
||||
data={"operation": ("edit", "new", "delete")},
|
||||
err_message="Invalid operation parameter on /services.",
|
||||
err_message="Invalid operation parameter on /easy-mode.",
|
||||
redirect_url="services",
|
||||
)
|
||||
|
||||
config, variables, format_configs, server_name, old_server_name, operation, is_draft, was_draft, is_draft_unchanged = get_service_data()
|
||||
update_service(config, variables, format_configs, server_name, old_server_name, operation, is_draft, was_draft, is_draft_unchanged, "raw-mode")
|
||||
|
||||
if not request.args.get("service_name"):
|
||||
return handle_error("Service name missing to access raw mode.", "services")
|
||||
if not request.args.get("mode"):
|
||||
return handle_error("Mode type is missing to access /modes.", "services")
|
||||
|
||||
service_name = request.args.get("service_name")
|
||||
mode = request.args.get("mode")
|
||||
total_config = DB.get_config(methods=True, with_drafts=True)
|
||||
service_names = total_config["SERVER_NAME"]["value"].split(" ")
|
||||
# Case new service
|
||||
service_names.append("new")
|
||||
|
||||
if service_name not in service_names:
|
||||
return handle_error("Service name not found to access raw mode.", "services")
|
||||
if service_name and service_name not in service_names:
|
||||
return handle_error("Service name not found to access advanced mode.", "services")
|
||||
|
||||
# Case new service
|
||||
if service_name is None:
|
||||
service_name = "new"
|
||||
|
||||
global_config = app.bw_config.get_config(global_only=True, methods=True)
|
||||
plugins = app.bw_config.get_plugins()
|
||||
|
||||
data_server_builder = raw_mode_builder(TEMPLATE_PLACEHOLDER, plugins, global_config, total_config, service_name)
|
||||
data_server_builder = None
|
||||
if mode == "raw":
|
||||
data_server_builder = raw_mode_builder(TEMPLATE_PLACEHOLDER, plugins, global_config, total_config, service_name)
|
||||
|
||||
return render_template("raw.html", data_server_builder=data_server_builder)
|
||||
if mode == "advanced":
|
||||
data_server_builder = advanced_mode_builder(TEMPLATE_PLACEHOLDER, plugins, global_config, total_config, service_name)
|
||||
|
||||
if mode == "easy":
|
||||
data_server_builder = easy_mode_builder(TEMPLATE_PLACEHOLDER, plugins, global_config, total_config, service_name)
|
||||
|
||||
return render_template("modes.html", data_server_builder=data_server_builder)
|
||||
|
||||
|
||||
@app.route("/services", methods=["GET", "POST"])
|
||||
|
|
|
|||
8
src/ui/templates/global-config.html
vendored
8
src/ui/templates/global-config.html
vendored
|
|
@ -7,10 +7,10 @@
|
|||
<link rel="stylesheet" href="css/flag-icons.min.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>BunkerWeb | Global config</title>
|
||||
<script type="module" crossorigin nonce="{{ script_nonce }}" src="assets/global_config-ZipVWR5H.js"></script>
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/Text-DFDYeVTT.js">
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/ButtonGroup-DCcRsx0h.js">
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/Templates-DXoMzjF2.js">
|
||||
<script type="module" crossorigin nonce="{{ script_nonce }}" src="assets/global_config-CZ0G5nSa.js"></script>
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/Text-BIcESj1V.js">
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/ButtonGroup-BydAGXrY.js">
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/Templates-DP-xygY2.js">
|
||||
<link rel="stylesheet" crossorigin href="assets/ButtonGroup-D2kv0NCW.css">
|
||||
</head>
|
||||
|
||||
|
|
|
|||
4
src/ui/templates/home.html
vendored
4
src/ui/templates/home.html
vendored
|
|
@ -7,8 +7,8 @@
|
|||
<link rel="stylesheet" href="css/flag-icons.min.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>BunkerWeb | Home</title>
|
||||
<script type="module" crossorigin nonce="{{ script_nonce }}" src="assets/home-CHWbh0BE.js"></script>
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/Text-DFDYeVTT.js">
|
||||
<script type="module" crossorigin nonce="{{ script_nonce }}" src="assets/home-NrasATfu.js"></script>
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/Text-BIcESj1V.js">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
|
|||
6
src/ui/templates/instances.html
vendored
6
src/ui/templates/instances.html
vendored
|
|
@ -7,9 +7,9 @@
|
|||
<link rel="stylesheet" href="css/flag-icons.min.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>BunkerWeb | Instances</title>
|
||||
<script type="module" crossorigin nonce="{{ script_nonce }}" src="assets/instances-Z0V9HaPQ.js"></script>
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/Text-DFDYeVTT.js">
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/ButtonGroup-DCcRsx0h.js">
|
||||
<script type="module" crossorigin nonce="{{ script_nonce }}" src="assets/instances-DxqGoKEC.js"></script>
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/Text-BIcESj1V.js">
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/ButtonGroup-BydAGXrY.js">
|
||||
<link rel="stylesheet" crossorigin href="assets/ButtonGroup-D2kv0NCW.css">
|
||||
</head>
|
||||
|
||||
|
|
|
|||
6
src/ui/templates/jobs.html
vendored
6
src/ui/templates/jobs.html
vendored
|
|
@ -7,9 +7,9 @@
|
|||
<link rel="stylesheet" href="css/flag-icons.min.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>BunkerWeb | Jobs</title>
|
||||
<script type="module" crossorigin nonce="{{ script_nonce }}" src="assets/jobs-6si0IGlk.js"></script>
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/Text-DFDYeVTT.js">
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/ButtonGroup-DCcRsx0h.js">
|
||||
<script type="module" crossorigin nonce="{{ script_nonce }}" src="assets/jobs-DeJBFKqF.js"></script>
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/Text-BIcESj1V.js">
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/ButtonGroup-BydAGXrY.js">
|
||||
<link rel="stylesheet" crossorigin href="assets/ButtonGroup-D2kv0NCW.css">
|
||||
</head>
|
||||
|
||||
|
|
|
|||
30
src/ui/templates/modes.html
vendored
Normal file
30
src/ui/templates/modes.html
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/x-icon" href="img/favicon.ico" />
|
||||
<link rel="stylesheet" href="css/style.css" />
|
||||
<link rel="stylesheet" href="css/flag-icons.min.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>BunkerWeb | Raw mode</title>
|
||||
<script type="module" crossorigin nonce="{{ script_nonce }}" src="assets/modes-5pzf6B6M.js"></script>
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/Text-BIcESj1V.js">
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/ButtonGroup-BydAGXrY.js">
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/Templates-DP-xygY2.js">
|
||||
<link rel="stylesheet" crossorigin href="assets/ButtonGroup-D2kv0NCW.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{% set data_server_flash = [] %}
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% for category, message in messages %}
|
||||
{% if data_server_flash.append({"type": "error" if category == "error" else "success", "title": "dashboard_error" if category == "error" else "dashboard_success", "message": message}) %}{% endif %}
|
||||
{% endfor %}
|
||||
{% endwith %}
|
||||
<div class='hidden' data-csrf-token='{{ csrf_token() }}'></div>
|
||||
<div class='hidden' data-server-global='{{data_server_global if data_server_global else {}}}'></div>
|
||||
<div class='hidden' data-server-flash='{{data_server_flash|tojson}}'></div>
|
||||
<div class='hidden' data-server-builder='{{data_server_builder}}'></div>
|
||||
<div id='app'></div>
|
||||
</body>
|
||||
</html>
|
||||
8
src/ui/templates/raw.html
vendored
8
src/ui/templates/raw.html
vendored
|
|
@ -7,10 +7,10 @@
|
|||
<link rel="stylesheet" href="css/flag-icons.min.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>BunkerWeb | Raw mode</title>
|
||||
<script type="module" crossorigin nonce="{{ script_nonce }}" src="assets/raw-BP5kN-1f.js"></script>
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/Text-DFDYeVTT.js">
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/ButtonGroup-DCcRsx0h.js">
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/Templates-DXoMzjF2.js">
|
||||
<script type="module" crossorigin nonce="{{ script_nonce }}" src="assets/raw-BuQHpnRe.js"></script>
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/Text-BIcESj1V.js">
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/ButtonGroup-BydAGXrY.js">
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/Templates-DP-xygY2.js">
|
||||
<link rel="stylesheet" crossorigin href="assets/ButtonGroup-D2kv0NCW.css">
|
||||
</head>
|
||||
|
||||
|
|
|
|||
6
src/ui/templates/services.html
vendored
6
src/ui/templates/services.html
vendored
|
|
@ -7,9 +7,9 @@
|
|||
<link rel="stylesheet" href="css/flag-icons.min.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>BunkerWeb | Services</title>
|
||||
<script type="module" crossorigin nonce="{{ script_nonce }}" src="assets/services-CQESo30B.js"></script>
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/Text-DFDYeVTT.js">
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/ButtonGroup-DCcRsx0h.js">
|
||||
<script type="module" crossorigin nonce="{{ script_nonce }}" src="assets/services-DZJyCK1K.js"></script>
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/Text-BIcESj1V.js">
|
||||
<link rel="modulepreload" crossorigin nonce="{{ script_nonce }}" href="assets/ButtonGroup-BydAGXrY.js">
|
||||
<link rel="stylesheet" crossorigin href="assets/ButtonGroup-D2kv0NCW.css">
|
||||
</head>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue