update instances and jobs pages

* add new list data in instances
* update jobs page adding history modal
* avoid objet key access on Title and Subtitle
* update gitignore to add logs build
This commit is contained in:
Jordan Blasenhauer 2024-08-07 16:20:27 +02:00
parent 9d485d2e91
commit 9713f9ba90
21 changed files with 2266 additions and 2322 deletions

View file

@ -43,6 +43,8 @@ def instances_builder(instances: List[Instance]) -> str:
instance = instance_widget(
containerColumns={"pc": 6, "tablet": 6, "mobile": 12},
pairs=[
{"key": "instances_name", "value": instance.name},
{"key": "instances_type", "value": instance.type},
{"key": "instances_method", "value": instance.method},
{"key": "instances_creation_date", "value": instance.creation_date.strftime("%d-%m-%Y %H:%M:%S")},
{"key": "instances_last_seen", "value": instance.last_seen.strftime("%d-%m-%Y %H:%M:%S")},

View file

@ -29,14 +29,14 @@ def jobs_builder(jobs):
"widgets": [
title_widget("jobs_title"),
table_widget(
positions=[2, 2, 1, 1, 1, 2, 3],
positions=[3, 2, 1, 1, 1, 1, 3],
header=[
"jobs_table_name",
"jobs_table_plugin_id",
"jobs_table_interval",
"jobs_table_reload",
"jobs_table_success",
"jobs_table_last_run_date",
"jobs_table_history",
"jobs_table_cache_downloadable",
],
items=jobs_list,
@ -46,7 +46,7 @@ def jobs_builder(jobs):
"filterName": "keyword",
"type": "keyword",
"value": "",
"keys": ["name", "plugin_id", "last_run"],
"keys": ["name", "plugin_id"],
"field": {
"id": "jobs-keyword",
"value": "",
@ -150,22 +150,100 @@ def get_jobs_list(jobs):
# loop on each value
for k, v in value.items():
# override widget type for some keys
if k in ("reload", "success"):
if k in ("reload", "history"):
is_success = v if k == "reload" else v[0].get("success")
item.append(
{
k: "success" if v else "failed",
k: "success" if is_success else "failed",
"type": "Icons",
"data": {
"iconName": "check" if v else "cross",
"iconName": "check" if is_success else "cross",
},
}
)
continue
if k in ("plugin_id", "every", "last_run"):
if k not in ("history"):
continue
if k in ("plugin_id", "every"):
item.append({k: v, "type": "Text", "data": {"text": v}})
continue
if k in ("history"):
items = []
for hist in v:
items.append(
[
{
"type": "Text",
"data": {
"text": hist["start_date"],
},
},
{
"type": "Text",
"data": {
"text": hist["end_date"],
},
},
{
"type": "Icons",
"data": {
"iconName": "check" if hist["success"] else "cross",
},
},
]
)
item.append(
{
"type": "Button",
"data": {
"id": f"open-modal-history-{k}",
"text": "jobs_history",
"hideText": True,
"color": "blue",
"size": "normal",
"iconName": "document",
"iconColor": "white",
"modal": {
"widgets": [
{"type": "Title", "data": {"title": key}},
{"type": "Subtitle", "data": {"subtitle": "jobs_history_subtitle"}},
{
"type": "Table",
"data": {
"title": "jobs_history_table_title",
"minWidth": "",
"header": [
"jobs_table_start_run",
"jobs_table_end_run",
"jobs_table_success",
],
"positions": [5, 5, 2],
"items": items,
},
},
{
"type": "ButtonGroup",
"data": {
"buttons": [
{
"id": f"close-history-{k}",
"text": "action_close",
"color": "close",
"size": "normal",
"attrs": {"data-close-modal": ""},
}
]
},
},
]
},
},
}
)
if k in ("cache") and len(v) <= 0:
item.append({k: v, "type": "Text", "data": {"text": ""}})
continue
@ -201,7 +279,7 @@ def get_jobs_list(jobs):
},
"overflowAttrEl": "data-table-body",
"containerClass": "table download-cache-file",
"maxBtnChars": 12,
"maxBtnChars": 16,
"popovers": [
{
"iconName": "info",

View file

@ -1,5 +1,6 @@
# Logs
logs
!pages/logs
*.log
npm-debug.log*
yarn-debug.log*
@ -7,6 +8,7 @@ yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr

View file

@ -312,7 +312,7 @@ function closeTab(e) {
/**
* @name addEntry
* @description When clicking add entry or key "Enter", will add the current input value to list.
* @param {e} e - The event object.
* @param {event} e - The event object.
* @returns {void}
*/
function addEntry(e) {

View file

@ -76,7 +76,7 @@ const subtitleEl = ref(null);
onMounted(() => {
subtitle.class =
props.subtitleClass || subtitleEl.value.closest("[data-is]")
props.subtitleClass || subtitleEl?.value?.closest("[data-is]")
? `subtitle-${subtitleEl.value
.closest("[data-is]")
.getAttribute("data-is")}`

View file

@ -1,5 +1,6 @@
<script setup>
import { computed, onMounted, reactive, ref } from "vue";
/**
* @name Widget/Title.vue
* @description This component is a general title wrapper.
@ -83,7 +84,7 @@ onMounted(() => {
!nextSibling || !nextSibling.hasAttribute("data-subtitle") ? false : true;
title.class =
props.titleClass || titleEl.value.closest("[data-is]")
props.titleClass || titleEl?.value?.closest("[data-is]")
? `title-${titleEl.value.closest("[data-is]").getAttribute("data-is")}`
: "title-card";
});

View file

@ -213,9 +213,13 @@
"jobs_table_plugin_id": "Plugin id",
"jobs_table_interval": "Interval",
"jobs_table_reload": "Reload",
"jobs_table_history": "History",
"jobs_table_success": "Success",
"jobs_table_last_run_date": "Last run date",
"jobs_table_start_run": "Start run date",
"jobs_table_end_run": "End run date",
"jobs_table_cache_downloadable": "Cache (downloadable)",
"jobs_history_subtitle": "Job history details.",
"jobs_history_table_title": "Job history list with start run date, end run date and success state.",
"plugins_pro_plugin_desc": "Pro plugin",
"plugins_core_plugin_desc": "Core plugin",
"plugins_external_plugin_desc": "External plugin",

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,66 @@
<script setup>
import { reactive, onBeforeMount, onMounted } from "vue";
import DashboardLayout from "@components/Dashboard/Layout.vue";
import BuilderLogs from "@components/Builder/Logs.vue";
import { useGlobal } from "@utils/global";
/**
* @name Page/Logs.vue
* @description This component is the logd page.
This page allow to choose log files and view the logs.
*/
const logs = reactive({
builder: "",
});
onBeforeMount(() => {
// Get builder data
const dataAtt = "data-server-builder";
const dataEl = document.querySelector(`[${dataAtt}]`);
const data =
dataEl && !dataEl.getAttribute(dataAtt).includes(dataAtt)
? JSON.parse(atob(dataEl.getAttribute(dataAtt)))
: {};
logs.builder = data;
});
/**
* @name getLogContent
* @description Redirect to the same page but with log name as query parameter to get the content of the log.
* @returns {void}
*/
function getLogContent() {
window.addEventListener(
"click",
(e) => {
// Case not wanted element
if (!e.target.hasAttribute("data-setting-value")) return;
if (
!e.target.closest("[data-field-container]").querySelector("[data-log]")
)
return;
const value = e.target.getAttribute("data-setting-value");
const url = `${location.href}/logs?file=${value}`;
// go to url
location.href = url;
},
true
);
}
onMounted(() => {
// Set the page title
useGlobal();
getLogContent();
});
</script>
<template>
<DashboardLayout>
<div class="col-span-12 grid grid-cols-12 card">
<BuilderLogs v-if="logs.builder" :builder="logs.builder" />
</div>
</DashboardLayout>
</template>

View 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 | Logs</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="W3sidHlwZSI6ICJjYXJkIiwgImNvbnRhaW5lckNvbHVtbnMiOiB7InBjIjogMTIsICJ0YWJsZXQiOiAxMiwgIm1vYmlsZSI6IDEyfSwgIndpZGdldHMiOiBbeyJ0eXBlIjogIlRpdGxlIiwgImRhdGEiOiB7InRpdGxlIjogImxvZ3NfdGl0bGUifX0sIHsidHlwZSI6ICJGaWVsZHMiLCAiZGF0YSI6IHsic2V0dGluZyI6IHsiaWQiOiAibG9ncy1zZWxlY3QtZmlsZSIsICJsYWJlbCI6ICJsb2dzX3NlbGVjdF9maWxlIiwgImlucFR5cGUiOiAic2VsZWN0IiwgIm5hbWUiOiAibG9ncy1zZWxlY3QtZmlsZSIsICJvbmx5RG93biI6IHRydWUsICJ2YWx1ZSI6ICIiLCAidmFsdWVzIjogWyJmaWxlMSIsICJmaWxlMiJdLCAiY29sdW1ucyI6IHsicGMiOiA0LCAidGFibGV0IjogNiwgIm1vYmlsZSI6IDEyfSwgIm1heEJ0bkNoYXJzIjogMjAsICJhdHRycyI6IHsiZGF0YS1sb2ciOiAidHJ1ZSJ9LCAicG9wb3ZlcnMiOiBbeyJpY29uTmFtZSI6ICJpbmZvIiwgInRleHQiOiAibG9nc19zZWxlY3RfZmlsZV9pbmZvIn1dfX19LCB7InR5cGUiOiAiRmllbGRzIiwgImRhdGEiOiB7InNldHRpbmciOiB7ImNvbnRhaW5lckNsYXNzIjogIm10LTQiLCAiaWQiOiAibG9ncy1maWxlLWNvbnRlbnQiLCAibGFiZWwiOiAibG9nc19maWxlX2NvbnRlbnQiLCAiaW5wVHlwZSI6ICJlZGl0b3IiLCAibmFtZSI6ICJsb2dzLWZpbGUtY29udGVudCIsICJ2YWx1ZSI6ICJnZWZlc2Zlc2ZzZWZlcyIsICJjb2x1bW5zIjogeyJwYyI6IDEyLCAidGFibGV0IjogMTIsICJtb2JpbGUiOiAxMn19fX1dfV0"
></div>
<div id="app"></div>
<script type="module" src="logs.js"></script>
</body>
</html>

View file

@ -0,0 +1,11 @@
import { createApp } from "vue";
import { createPinia } from "pinia";
import { getI18n } from "@utils/lang.js";
import Logs from "./Logs.vue";
const pinia = createPinia();
createApp(Logs)
.use(pinia)
.use(getI18n(["dashboard", "action", "inp", "icons", "logs"]))
.mount("#app");

View file

@ -161,7 +161,7 @@ function useEqualStr(type, compare) {
* @name useDataLinkAttr
* @description Check from event if the target has a data-link attribute. Case it is, it will be used to redirect the user to the define link.
* This is useful to avoid using the <a> tag and use a <div> or <button> instead.
* @param {e} event - The event to attach the function logic
* @param {event} e - The event to attach the function logic
* @returns {void}
*/
function useDataLinkAttr(e) {

View file

@ -1285,6 +1285,10 @@ body {
@apply break-word dark:text-gray-300 col-span-12 break-words w-full max-w-[80%] sm:max-w-[800px] leading-normal text-[1.1rem] mb-0;
}
.subtitle-modal {
@apply break-word dark:text-gray-300 col-span-12 break-words w-full max-w-[80%] sm:max-w-[800px] leading-normal text-[1.05rem] mb-0;
}
.subtitle-void {
@apply break-word text-gray-300 col-span-12 break-words w-full max-w-[80%] sm:max-w-[800px] leading-normal text-[1.1rem] mb-0;
}

File diff suppressed because one or more lines are too long

View file

@ -1,7 +1,7 @@
from .utils.widgets import instance_widget
def instances_builder(instances: list) -> str:
def instances_builder(instances: List[Instance]) -> str:
"""
It returns the needed format from data to render the instances page in JSON format for the Vue.js builder
"""
@ -11,18 +11,18 @@ def instances_builder(instances: list) -> str:
# setup actions buttons
actions = (
["restart", "stop"]
if instance._type == "local" and instance.health
if instance.hostname in ("localhost", "127.0.0.1") and instance.status == "up"
else (
["reload", "stop"]
if not instance._type == "local" and instance.health
else ["start"] if instance._type == "local" and not instance.health else []
if instance.hostname not in ("localhost", "127.0.0.1") and instance.status == "up"
else ["start"] if instance.hostname in ("localhost", "127.0.0.1") and instance.status != "up" else []
)
)
buttons = [
{
"attrs": {
"data-submit-form": f"""{{"INSTANCE_ID" : "{instance._id}", "operation" : "{action}" }}""",
"data-submit-form": f"""{{"INSTANCE_ID" : "{instance.hostname}", "operation" : "{action}" }}""",
},
"text": f"action_{action}",
"color": "success" if action == "start" else "error" if action == "stop" else "warning",
@ -33,12 +33,14 @@ def instances_builder(instances: list) -> str:
instance = instance_widget(
containerColumns={"pc": 6, "tablet": 6, "mobile": 12},
pairs=[
{"key": "instances_hostname", "value": instance.hostname},
{"key": "instances_type", "value": instance._type},
{"key": "instances_status", "value": "instances_active" if instance.health else "instances_inactive"},
{"key": "instances_name", "value": instance.name},
{"key": "instances_type", "value": instance.type},
{"key": "instances_method", "value": instance.method},
{"key": "instances_creation_date", "value": instance.creation_date.strftime("%d-%m-%Y %H:%M:%S")},
{"key": "instances_last_seen", "value": instance.last_seen.strftime("%d-%m-%Y %H:%M:%S")},
],
status="success" if instance.health else "error",
title=instance.name,
status="success" if instance.status == "up" else "error",
title=instance.hostname,
buttons=buttons,
)

View file

@ -22,14 +22,14 @@ def jobs_builder(jobs):
"widgets": [
title_widget("jobs_title"),
table_widget(
positions=[2, 2, 1, 1, 1, 2, 3],
positions=[3, 2, 1, 1, 1, 1, 3],
header=[
"jobs_table_name",
"jobs_table_plugin_id",
"jobs_table_interval",
"jobs_table_reload",
"jobs_table_success",
"jobs_table_last_run_date",
"jobs_table_history",
"jobs_table_cache_downloadable",
],
items=jobs_list,
@ -39,7 +39,7 @@ def jobs_builder(jobs):
"filterName": "keyword",
"type": "keyword",
"value": "",
"keys": ["name", "plugin_id", "last_run"],
"keys": ["name", "plugin_id"],
"field": {
"id": "jobs-keyword",
"value": "",
@ -143,22 +143,100 @@ def get_jobs_list(jobs):
# loop on each value
for k, v in value.items():
# override widget type for some keys
if k in ("reload", "success"):
if k in ("reload", "history"):
is_success = v if k == "reload" else v[0].get("success")
item.append(
{
k: "success" if v else "failed",
k: "success" if is_success else "failed",
"type": "Icons",
"data": {
"iconName": "check" if v else "cross",
"iconName": "check" if is_success else "cross",
},
}
)
continue
if k in ("plugin_id", "every", "last_run"):
if k not in ("history"):
continue
if k in ("plugin_id", "every"):
item.append({k: v, "type": "Text", "data": {"text": v}})
continue
if k in ("history"):
items = []
for hist in v:
items.append(
[
{
"type": "Text",
"data": {
"text": hist["start_date"],
},
},
{
"type": "Text",
"data": {
"text": hist["end_date"],
},
},
{
"type": "Icons",
"data": {
"iconName": "check" if hist["success"] else "cross",
},
},
]
)
item.append(
{
"type": "Button",
"data": {
"id": f"open-modal-history-{k}",
"text": "jobs_history",
"hideText": True,
"color": "blue",
"size": "normal",
"iconName": "document",
"iconColor": "white",
"modal": {
"widgets": [
{"type": "Title", "data": {"title": key}},
{"type": "Subtitle", "data": {"subtitle": "jobs_history_subtitle"}},
{
"type": "Table",
"data": {
"title": "jobs_history_table_title",
"minWidth": "",
"header": [
"jobs_table_start_run",
"jobs_table_end_run",
"jobs_table_success",
],
"positions": [5, 5, 2],
"items": items,
},
},
{
"type": "ButtonGroup",
"data": {
"buttons": [
{
"id": f"close-history-{k}",
"text": "action_close",
"color": "close",
"size": "normal",
"attrs": {"data-close-modal": ""},
}
]
},
},
]
},
},
}
)
if k in ("cache") and len(v) <= 0:
item.append({k: v, "type": "Text", "data": {"text": ""}})
continue
@ -194,7 +272,7 @@ def get_jobs_list(jobs):
},
"overflowAttrEl": "data-table-body",
"containerClass": "table download-cache-file",
"maxBtnChars": 12,
"maxBtnChars": 16,
"popovers": [
{
"iconName": "info",

File diff suppressed because it is too large Load diff

View file

@ -9,120 +9,130 @@ jobs = {
"plugin_id": "misc",
"every": "day",
"reload": False,
"success": True,
"last_run": "2024/06/14, 01:33:11 PM",
"history": [{"start_date": "07/08/2024, 01:10:03 PM", "end_date": "07/08/2024, 01:10:04 PM", "success": True}],
"cache": [],
},
"backup-data": {
"plugin_id": "backup",
"every": "day",
"reload": False,
"success": True,
"last_run": "2024/06/14, 01:33:10 PM",
"history": [{"start_date": "07/08/2024, 01:10:02 PM", "end_date": "07/08/2024, 01:10:03 PM", "success": True}],
"cache": [],
},
"blacklist-download": {
"plugin_id": "blacklist",
"every": "hour",
"reload": True,
"success": True,
"last_run": "2024/06/14, 01:33:09 PM",
"history": [{"start_date": "07/08/2024, 01:10:01 PM", "end_date": "07/08/2024, 01:10:02 PM", "success": True}],
"cache": [],
},
"bunkernet-data": {
"plugin_id": "bunkernet",
"every": "day",
"reload": True,
"success": True,
"last_run": "2024/06/14, 01:33:11 PM",
"history": [{"start_date": "07/08/2024, 01:10:02 PM", "end_date": "07/08/2024, 01:10:03 PM", "success": True}],
"cache": [],
},
"bunkernet-register": {
"plugin_id": "bunkernet",
"every": "hour",
"reload": True,
"success": True,
"last_run": "2024/06/14, 01:33:09 PM",
"history": [{"start_date": "07/08/2024, 01:10:02 PM", "end_date": "07/08/2024, 01:10:02 PM", "success": True}],
"cache": [],
},
"certbot-new": {
"plugin_id": "letsencrypt",
"every": "once",
"reload": False,
"success": True,
"last_run": "2024/06/14, 01:33:08 PM",
"history": [{"start_date": "07/08/2024, 01:10:02 PM", "end_date": "07/08/2024, 01:10:03 PM", "success": True}],
"cache": [],
},
"certbot-renew": {
"plugin_id": "letsencrypt",
"every": "day",
"reload": True,
"success": True,
"last_run": "2024/06/14, 01:33:09 PM",
"history": [{"start_date": "07/08/2024, 01:10:03 PM", "end_date": "07/08/2024, 01:10:03 PM", "success": True}],
"cache": [],
},
"cleanup-excess-jobs-runs": {
"plugin_id": "db",
"every": "day",
"reload": False,
"history": [{"start_date": "07/08/2024, 01:10:02 PM", "end_date": "07/08/2024, 01:10:03 PM", "success": True}],
"cache": [],
},
"coreruleset-nightly": {
"plugin_id": "modsecurity",
"every": "day",
"reload": True,
"success": True,
"last_run": "2024/06/14, 01:33:09 PM",
"history": [{"start_date": "07/08/2024, 01:10:01 PM", "end_date": "07/08/2024, 01:10:03 PM", "success": True}],
"cache": [],
},
"custom-cert": {
"plugin_id": "customcert",
"every": "day",
"reload": True,
"success": True,
"last_run": "2024/06/14, 01:33:10 PM",
"history": [{"start_date": "07/08/2024, 01:10:02 PM", "end_date": "07/08/2024, 01:10:03 PM", "success": True}],
"cache": [],
},
"default-server-cert": {
"plugin_id": "misc",
"every": "once",
"reload": False,
"success": True,
"last_run": "2024/06/14, 01:33:10 PM",
"history": [{"start_date": "07/08/2024, 01:10:02 PM", "end_date": "07/08/2024, 01:10:03 PM", "success": True}],
"cache": [
{
"service_id": None,
"file_name": "default-server-cert.pem",
"last_update": "2024/06/14, 01:33:10 PM",
"last_update": "07/08/2024, 01:10:03 PM",
"checksum": "203da9e16dabe522a3080c3b9efc5c2dc8054f47e98d995fe1812f4c498b4feb519ef080b7dfeaba0095c1393793815c23f22072daf5703b02762504b211db20",
},
{
"service_id": None,
"file_name": "default-server-cert.key",
"last_update": "2024/06/14, 01:33:10 PM",
"last_update": "07/08/2024, 01:10:03 PM",
"checksum": "7f86b1fffb8fe2011365d76e5a0955344a03c3bdb7b04aff13f8ad5b6178804290c0cd6c8f29dda9e981e3193cf5acda2a92f72312d514514305b8485667d573",
},
],
},
"download-crs-plugins": {
"plugin_id": "modsecurity",
"every": "day",
"reload": True,
"history": [{"start_date": "07/08/2024, 01:10:03 PM", "end_date": "07/08/2024, 01:10:03 PM", "success": True}],
"cache": [],
},
"download-plugins": {
"plugin_id": "misc",
"every": "once",
"reload": False,
"success": True,
"last_run": "2024/06/14, 01:33:13 PM",
"history": [
{"start_date": "07/08/2024, 01:10:04 PM", "end_date": "07/08/2024, 01:10:05 PM", "success": True},
{"start_date": "07/08/2024, 01:09:59 PM", "end_date": "07/08/2024, 01:10:00 PM", "success": True},
],
"cache": [],
},
"download-pro-plugins": {
"plugin_id": "pro",
"every": "day",
"reload": True,
"success": True,
"last_run": "2024/06/14, 01:33:10 PM",
"history": [
{"start_date": "07/08/2024, 01:10:02 PM", "end_date": "07/08/2024, 01:10:04 PM", "success": True},
{"start_date": "07/08/2024, 01:10:00 PM", "end_date": "07/08/2024, 01:10:01 PM", "success": False},
],
"cache": [],
},
"failover-backup": {
"plugin_id": "jobs",
"every": "once",
"reload": False,
"success": True,
"last_run": "2024/06/14, 01:33:16 PM",
"history": [{"start_date": "07/08/2024, 01:10:07 PM", "end_date": "07/08/2024, 01:10:08 PM", "success": True}],
"cache": [
{
"service_id": None,
"file_name": "folder:/var/tmp/bunkerweb/failover.tgz",
"last_update": "2024/06/14, 01:33:27 PM",
"last_update": "07/08/2024, 01:10:14 PM",
"checksum": "d22a7a696d4b44bcef6a3ac06b2d7e2b2de128243000f58202c0e82b0bf54510ade7329eca14ca478a28d46201410ea1fd8002349b7b9aa51dd0d07d2fb2f51e",
}
],
},
@ -130,21 +140,20 @@ jobs = {
"plugin_id": "greylist",
"every": "hour",
"reload": True,
"success": True,
"last_run": "2024/06/14, 01:33:09 PM",
"history": [{"start_date": "07/08/2024, 01:10:02 PM", "end_date": "07/08/2024, 01:10:03 PM", "success": True}],
"cache": [],
},
"mmdb-asn": {
"plugin_id": "jobs",
"every": "day",
"reload": True,
"success": True,
"last_run": "2024/06/14, 01:33:14 PM",
"history": [{"start_date": "07/08/2024, 01:10:04 PM", "end_date": "07/08/2024, 01:10:06 PM", "success": True}],
"cache": [
{
"service_id": None,
"file_name": "asn.mmdb",
"last_update": "2024/06/14, 01:33:13 PM",
"last_update": "07/08/2024, 01:10:05 PM",
"checksum": "0beed65a84e63cf5dd6753ecc1aa6399dddaf5eb24fb22839f4cd72cbc9805cddf72be068649d111a3c21e2ac7de4a6f930c859286a25a7e937da017406d2596",
}
],
},
@ -152,13 +161,13 @@ jobs = {
"plugin_id": "jobs",
"every": "day",
"reload": True,
"success": True,
"last_run": "2024/06/14, 01:33:12 PM",
"history": [{"start_date": "07/08/2024, 01:10:02 PM", "end_date": "07/08/2024, 01:10:04 PM", "success": True}],
"cache": [
{
"service_id": None,
"file_name": "country.mmdb",
"last_update": "2024/06/14, 01:33:11 PM",
"last_update": "07/08/2024, 01:10:03 PM",
"checksum": "5f0d2e2c92840747886924adc1e6ff3668882990e0cd8a4d60750fe1bddb66c3e175c8717d073b48ebda41cce4c505d434dc2a6a469823fcd41c62c4f875b212",
}
],
},
@ -166,26 +175,26 @@ jobs = {
"plugin_id": "realip",
"every": "hour",
"reload": True,
"success": True,
"last_run": "2024/06/14, 01:33:09 PM",
"history": [{"start_date": "07/08/2024, 01:10:02 PM", "end_date": "07/08/2024, 01:10:03 PM", "success": True}],
"cache": [],
},
"self-signed": {
"plugin_id": "selfsigned",
"every": "day",
"reload": True,
"success": True,
"last_run": "2024/06/14, 01:33:10 PM",
"history": [{"start_date": "07/08/2024, 01:10:02 PM", "end_date": "07/08/2024, 01:10:03 PM", "success": True}],
"cache": [
{
"service_id": "www.example.com",
"file_name": "cert.pem",
"last_update": "2024/06/14, 01:33:10 PM",
"last_update": "07/08/2024, 01:10:03 PM",
"checksum": "fc33700719f6a58336e3c3b735ad3fdf0b15ebd0afbe6b4a3b02a4a92e0ab4f1761409a7a1d1ca965d59b4196a81c1d150a12ae0170f7bb3a1bc7cf02300fbe9",
},
{
"service_id": "www.example.com",
"file_name": "key.pem",
"last_update": "2024/06/14, 01:33:10 PM",
"last_update": "07/08/2024, 01:10:03 PM",
"checksum": "0e6eee34ab7b2a41cb21e49ebd35ce29a1b8d12b55aad3911b6357c73792eef7084fbb4eeba8bff73eb7a8789b5f486f6edb6d4b1c38a54bd0dcee1bf438f23d",
},
],
},
@ -193,21 +202,18 @@ jobs = {
"plugin_id": "jobs",
"every": "day",
"reload": False,
"success": True,
"last_run": "2024/06/14, 01:33:15 PM",
"history": [{"start_date": "07/08/2024, 01:10:06 PM", "end_date": "07/08/2024, 01:10:07 PM", "success": True}],
"cache": [],
},
"whitelist-download": {
"plugin_id": "whitelist",
"every": "hour",
"reload": True,
"success": True,
"last_run": "2024/06/14, 01:33:09 PM",
"history": [{"start_date": "07/08/2024, 01:10:02 PM", "end_date": "07/08/2024, 01:10:02 PM", "success": True}],
"cache": [],
},
}
output = jobs_builder(jobs)
# store on a file

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

View file

@ -1172,7 +1172,6 @@ def get_service_data(page_name: str):
config = DB.get_config(methods=True, with_drafts=True)
# Check variables
variables = deepcopy(request.form.to_dict())
print(variables, flush=True)
mode = None
try:
mode = variables.pop("mode")
@ -1322,8 +1321,8 @@ def services_modes():
config, variables, format_configs, server_name, old_server_name, operation, is_draft, was_draft, is_draft_unchanged, mode = get_service_data("modes")
message = update_service(config, variables, format_configs, server_name, old_server_name, operation, is_draft, was_draft, is_draft_unchanged)
print(message, flush=True)
print("mode", mode, "service name", server_name, flush=True)
# print(message, flush=True)
# print("mode", mode, "service name", server_name, flush=True)
# TODO: redirect to /mode?service_name=my_service&mode=my_mode
# Following is not working :
# return redirect(url_for("loading", next=url_for("modes", mode=mode, service_name=server_name), message=message))