mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
precommit + fix select setting overflow + report page data
This commit is contained in:
parent
48bc6c95bc
commit
4846e409dc
23 changed files with 90 additions and 34 deletions
|
|
@ -10,7 +10,7 @@
|
|||
<div class="core-card">
|
||||
<h5 class="core-card-title">INFO</h5>
|
||||
<div class="core-card-text-container">
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
</div>
|
||||
<p class="core-card-text mt-4 mb-2">More information available <a href="https://docs.bunkerweb.io/{{ bw_version }}/security-tuning/#antibot" class="hover:brightness-90 cursor-pointer mt-2 underline text-primary">in the documentation</a>.</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<div class="core-card">
|
||||
<h5 class="core-card-title">INFO</h5>
|
||||
<div class="core-card-text-container">
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
</div>
|
||||
<p class="core-card-text mt-4 mb-2">More information available <a href="https://docs.bunkerweb.io/{{ bw_version }}/security-tuning/#backup-and-restore" class="hover:brightness-90 cursor-pointer mt-2 underline text-primary">in the documentation</a>.</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@
|
|||
<div class="core-card">
|
||||
<h5 class="core-card-title">INFO</h5>
|
||||
<div class="core-card-text-container">
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
</div>
|
||||
<p class="core-card-text mt-4 mb-2">More information available
|
||||
<p class="core-card-text mt-4 mb-2">More information available
|
||||
<a href="https://docs.bunkerweb.io/{{ bw_version }}/security-tuning/#bad-behavior" class="hover:brightness-90 cursor-pointer mt-2 underline text-primary">
|
||||
in the documentation
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<div class="core-card">
|
||||
<h5 class="core-card-title">INFO</h5>
|
||||
<div class="core-card-text-container">
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
</div>
|
||||
<p class="core-card-text mt-4 mb-2">More information available <a href="https://docs.bunkerweb.io/{{ bw_version }}/security-tuning/#blacklisting" class="hover:brightness-90 cursor-pointer mt-2 underline text-primary">in the documentation</a>.</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<div class="core-card">
|
||||
<h5 class="core-card-title">INFO</h5>
|
||||
<div class="core-card-text-container">
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
</div>
|
||||
<p class="core-card-text mt-4 mb-2">More information available <a href="https://docs.bunkerweb.io/{{ bw_version }}/security-tuning/#bunkernet" class="hover:brightness-90 cursor-pointer mt-2 underline text-primary">in the documentation</a>.</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<div class="core-card">
|
||||
<h5 class="core-card-title">INFO</h5>
|
||||
<div class="core-card-text-container">
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
</div>
|
||||
<p class="core-card-text mt-4 mb-2">More information available <a href="https://docs.bunkerweb.io/{{ bw_version }}/security-tuning/#cors" class="hover:brightness-90 cursor-pointer mt-2 underline text-primary">in the documentation</a>.</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<div class="core-card">
|
||||
<h5 class="core-card-title">INFO</h5>
|
||||
<div class="core-card-text-container">
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
</div>
|
||||
<p class="core-card-text mt-4 mb-2">More information available <a href="https://docs.bunkerweb.io/{{ bw_version }}/security-tuning/#country" class="hover:brightness-90 cursor-pointer mt-2 underline text-primary">in the documentation</a>.</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<div class="core-card">
|
||||
<h5 class="core-card-title">INFO</h5>
|
||||
<div class="core-card-text-container">
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
</div>
|
||||
<p class="core-card-text mt-4 mb-2">More information available <a href="https://docs.bunkerweb.io/{{ bw_version }}/security-tuning/#dnsbl" class="hover:brightness-90 cursor-pointer mt-2 underline text-primary">in the documentation</a>.</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
<div class="core-card">
|
||||
<h5 class="core-card-title">INFO</h5>
|
||||
<div class="core-card-text-container">
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
</div>
|
||||
<p class="core-card-text mt-4 mb-2">More information available <a href="https://docs.bunkerweb.io/{{ bw_version }}/settings/#errors" class="hover:brightness-90 cursor-pointer mt-2 underline text-primary">in the documentation</a>.</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<div class="core-card">
|
||||
<h5 class="core-card-title">INFO</h5>
|
||||
<div class="core-card-text-container">
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
</div>
|
||||
<p class="core-card-text mt-4 mb-2">More information available <a href="https://docs.bunkerweb.io/{{ bw_version }}/security-tuning/#greylisting" class="hover:brightness-90 cursor-pointer mt-2 underline text-primary">in the documentation</a>.</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<div class="core-card">
|
||||
<h5 class="core-card-title">INFO</h5>
|
||||
<div class="core-card-text-container">
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
</div>
|
||||
<p class="core-card-text mt-4 mb-2">More information available <a href="https://docs.bunkerweb.io/{{ bw_version }}/security-tuning/#limiting" class="hover:brightness-90 cursor-pointer mt-2 underline text-primary">in the documentation</a>.</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<div class="core-card">
|
||||
<h5 class="core-card-title">INFO</h5>
|
||||
<div class="core-card-text-container">
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
</div>
|
||||
<p class="core-card-text mt-4 mb-2">More information available <a href="https://docs.bunkerweb.io/{{ bw_version }}/settings/#miscellaneous" class="hover:brightness-90 cursor-pointer mt-2 underline text-primary">in the documentation</a>.</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<div class="core-card">
|
||||
<h5 class="core-card-title">INFO</h5>
|
||||
<div class="core-card-text-container">
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
</div>
|
||||
<p class="core-card-text mt-4 mb-2">More information available <a href="https://docs.bunkerweb.io/{{ bw_version }}/settings/#redis" class="hover:brightness-90 cursor-pointer mt-2 underline text-primary">in the documentation</a>.</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<div class="core-card">
|
||||
<h5 class="core-card-title">INFO</h5>
|
||||
<div class="core-card-text-container">
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
</div>
|
||||
<p class="core-card-text mt-4 mb-2">More information available <a href="https://docs.bunkerweb.io/{{ bw_version }}/security-tuning/#reverse-scan" class="hover:brightness-90 cursor-pointer mt-2 underline text-primary">in the documentation</a>.</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<div class="core-card">
|
||||
<h5 class="core-card-title">INFO</h5>
|
||||
<div class="core-card-text-container">
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
<p data-info class="core-card-text">{{plugin.get('description')}}</p>
|
||||
</div>
|
||||
<p class="core-card-text mt-4 mb-2">More information available <a href="https://docs.bunkerweb.io/{{ bw_version }}/security-tuning/#whitelisting" class="hover:brightness-90 cursor-pointer mt-2 underline text-primary">in the documentation</a>.</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -401,7 +401,7 @@ def inject_variables():
|
|||
pro_expire=metadata["pro_expire"].strftime("%d-%m-%Y") if metadata["pro_expire"] else "Unknown",
|
||||
pro_overlapped=metadata["pro_overlapped"],
|
||||
plugins=app.config["CONFIG"].get_plugins(),
|
||||
bw_version="1.5.7"
|
||||
bw_version="1.5.7",
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -54,9 +54,29 @@ class Checkbox {
|
|||
class Select {
|
||||
constructor() {
|
||||
this.init();
|
||||
this.openDropdownEls = [];
|
||||
}
|
||||
|
||||
init() {
|
||||
// Add event listener to close dropdown if scroll event is triggered on window
|
||||
window.addEventListener("scroll", () => {
|
||||
if (!this.openDropdownEls.length) return;
|
||||
|
||||
this.elsToRemove = [];
|
||||
this.openDropdownEls.forEach((dropdown) => {
|
||||
const btn = dropdown
|
||||
.closest("div[data-setting-container]")
|
||||
.querySelector("button[data-setting-select]");
|
||||
btn.click();
|
||||
// Add dropdown to remove list
|
||||
this.elsToRemove.push(dropdown);
|
||||
});
|
||||
// Update openDropdownEls array deleting all dropdowns that were closed using elsToRemove array
|
||||
this.openDropdownEls = this.openDropdownEls.filter(
|
||||
(dropdown) => !this.elsToRemove.includes(dropdown),
|
||||
);
|
||||
});
|
||||
|
||||
window.addEventListener("click", (e) => {
|
||||
//CASE NO BTN SELECT CLICKED
|
||||
try {
|
||||
|
|
@ -164,6 +184,18 @@ class Select {
|
|||
dropdownEl.classList.toggle("hidden");
|
||||
dropdownEl.classList.toggle("flex");
|
||||
dropdownChevron.classList.toggle("rotate-180");
|
||||
// case open, we want to move dropdown position next to his data-select-container
|
||||
if (!dropdownEl.classList.contains("hidden")) {
|
||||
this.openDropdownEls.push(dropdownEl);
|
||||
const selectContainer = btn.closest("div[data-select-container]");
|
||||
const selectContainerRect = selectContainer.getBoundingClientRect();
|
||||
const top = selectContainerRect.top + selectContainerRect.height;
|
||||
const left = selectContainerRect.left;
|
||||
const width = selectContainerRect.width;
|
||||
dropdownEl.style.top = `${top}px`;
|
||||
dropdownEl.style.left = `${left}px`;
|
||||
dropdownEl.style.width = `${width}px`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ class TabsSelect {
|
|||
);
|
||||
const combobox = dropdown.querySelector("[data-combobox]");
|
||||
if (combobox) {
|
||||
// simulate clear combobox wit keyboard
|
||||
// simulate clear combobox with keyboard
|
||||
combobox.value = "";
|
||||
}
|
||||
dropdown.classList.toggle("hidden");
|
||||
|
|
|
|||
11
src/ui/templates/reports.html
vendored
11
src/ui/templates/reports.html
vendored
|
|
@ -3,8 +3,12 @@
|
|||
{% set methods = ["all"] %}
|
||||
{% set codes = ["all"] %}
|
||||
{% set reasons = ["all"] %}
|
||||
{% set reasons_count = {} %}
|
||||
{% set code_count = {} %}
|
||||
{% set countries = ["all"] %}
|
||||
{% for report in reports %}
|
||||
reasons_count[report["reason"]] = reasons_count.get(report["reason"], 0) + 1
|
||||
code_count[report["status"]] = code_count.get(report["status"], 0) + 1
|
||||
{% if report["method"] not in methods %}
|
||||
{% if methods.append(report["method"]) %}{% endif %}
|
||||
{% endif %}
|
||||
|
|
@ -18,6 +22,11 @@
|
|||
{% if countries.append(report["country"]) %}{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% set top_reason = max(reasons_count, key=reasons_count.get) %}
|
||||
{% set top_code = max(code_count, key=code_count.get) %}
|
||||
{% set total_report = reports|length %}
|
||||
|
||||
<div class="{% if reports|length == 0 %}w-full overflow-hidden grid grid-cols-12 max-h-100 sm:max-h-125 col-span-12 p-4 relative break-words {% else %}hidden{% endif %} ">
|
||||
<div class="col-span-12 flex flex-col justify-center items-center h-fit">
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
|
|
@ -35,7 +44,7 @@
|
|||
{% if reports|length != 0 %}
|
||||
{% set reports_info = [
|
||||
{"name" : "REPORTING TOTAL", "data" : total_report|string},
|
||||
{"name" : "TOP REASON", "data" : total_reason|string},
|
||||
{"name" : "TOP REASON", "data" : top_reason|string},
|
||||
{"name" : "TOP STATUS CODE", "data" : top_code|string},
|
||||
] %}
|
||||
<div class=" h-fit col-span-12 md:col-span-4 3xl:col-span-3 p-4 relative min-w-0 break-words bg-white shadow-xl dark:bg-slate-850 dark:shadow-dark-xl rounded-2xl bg-clip-border">
|
||||
|
|
|
|||
4
src/ui/templates/settings_plugins.html
vendored
4
src/ui/templates/settings_plugins.html
vendored
|
|
@ -192,7 +192,7 @@
|
|||
<div id="{{ value['id'] }}-dropdown"
|
||||
role="listbox"
|
||||
data-setting-select-dropdown="{{ value['id'] }}"
|
||||
class="hidden z-[20] absolute h-full flex-col w-full mt-2">
|
||||
class="hidden z-[20] fixed h-full flex-col mt-2 max-h-[250px] overflow-auto">
|
||||
{% for item in value['select'] %}
|
||||
{% if global_config[setting]['value'] and
|
||||
global_config[setting]['value'] == item or not global_config[setting]['value']
|
||||
|
|
@ -417,7 +417,7 @@
|
|||
<div id="{{ value['id'] }}-dropdown"
|
||||
role="listbox"
|
||||
data-setting-select-dropdown="{{ value['id'] }}"
|
||||
class="hidden z-[20] absolute h-full flex-col w-full mt-2">
|
||||
class="hidden z-[20] fixed h-full flex-col mt-2 max-h-[250px] overflow-auto">
|
||||
{% for item in value['select'] %}
|
||||
{% if value['default'] == item %}
|
||||
<button role="option"
|
||||
|
|
|
|||
6
src/ui/templates/setup.html
vendored
6
src/ui/templates/setup.html
vendored
|
|
@ -128,7 +128,7 @@
|
|||
Username<strong class="required-mark">*</strong>
|
||||
</h5>
|
||||
<label class="sr-only" for="admin_username">Username</label>
|
||||
<input tabindex="1"
|
||||
<input tabindex="1"
|
||||
type="text"
|
||||
id="admin_username"
|
||||
name="admin_username"
|
||||
|
|
@ -164,7 +164,7 @@
|
|||
Confirm Password<strong class="required-mark">*</strong>
|
||||
</h5>
|
||||
<label class="sr-only" for="admin_password_check">Confirm Password</label>
|
||||
<input tabindex="1"
|
||||
<input tabindex="1"
|
||||
type="password"
|
||||
id="admin_password_check"
|
||||
name="admin_password_check"
|
||||
|
|
@ -264,7 +264,7 @@
|
|||
Server name<strong class="required-mark">*</strong>
|
||||
</h5>
|
||||
<label class="sr-only" for="server_name">server name</label>
|
||||
<input tabindex="1"
|
||||
<input tabindex="1"
|
||||
type="text"
|
||||
id="server_name"
|
||||
name="server_name"
|
||||
|
|
|
|||
|
|
@ -23,8 +23,12 @@ try:
|
|||
select_combobox.send_keys("no plugin matching normally")
|
||||
|
||||
# All tabs should be hidden
|
||||
total_tabs = DRIVER.execute_script(f"""return document?.querySelector('[data-tab-select-dropdown]')?.querySelectorAll('[data-tab-select-handler]').length""")
|
||||
hidden_tabs = DRIVER.execute_script(f"""return document?.querySelector('[data-tab-select-dropdown]')?.querySelectorAll('button[data-tab-select-handler][class*="hidden"]').length""")
|
||||
total_tabs = DRIVER.execute_script(
|
||||
f"""return document?.querySelector('[data-tab-select-dropdown]')?.querySelectorAll('[data-tab-select-handler]').length"""
|
||||
)
|
||||
hidden_tabs = DRIVER.execute_script(
|
||||
f"""return document?.querySelector('[data-tab-select-dropdown]')?.querySelectorAll('button[data-tab-select-handler][class*="hidden"]').length"""
|
||||
)
|
||||
|
||||
if total_tabs != hidden_tabs:
|
||||
log_error("All tabs should be hidden.")
|
||||
|
|
@ -37,7 +41,9 @@ try:
|
|||
# Show only one tab
|
||||
select_combobox.send_keys("blacklist")
|
||||
|
||||
hidden_tabs = DRIVER.execute_script(f"""return document?.querySelector('[data-tab-select-dropdown]')?.querySelectorAll('button[data-tab-select-handler][class*="hidden"]').length""")
|
||||
hidden_tabs = DRIVER.execute_script(
|
||||
f"""return document?.querySelector('[data-tab-select-dropdown]')?.querySelectorAll('button[data-tab-select-handler][class*="hidden"]').length"""
|
||||
)
|
||||
|
||||
if hidden_tabs != total_tabs - 1:
|
||||
log_error("Only one tab should be visible.")
|
||||
|
|
@ -54,7 +60,9 @@ try:
|
|||
log_error("Combobox input should be empty.")
|
||||
exit(1)
|
||||
|
||||
hidden_tabs = DRIVER.execute_script(f"""return document?.querySelector('[data-tab-select-dropdown]')?.querySelectorAll('button[data-tab-select-handler][class*="hidden"]').length""")
|
||||
hidden_tabs = DRIVER.execute_script(
|
||||
f"""return document?.querySelector('[data-tab-select-dropdown]')?.querySelectorAll('button[data-tab-select-handler][class*="hidden"]').length"""
|
||||
)
|
||||
|
||||
if hidden_tabs:
|
||||
log_error("All tabs should be visible.")
|
||||
|
|
@ -121,7 +129,7 @@ try:
|
|||
# Reset
|
||||
input_keyword.send_keys(Keys.CONTROL, "a")
|
||||
input_keyword.send_keys(Keys.BACKSPACE)
|
||||
|
||||
|
||||
log_info("Matching a setting done, try context global filter ...")
|
||||
|
||||
select_context = safe_get_element(DRIVER, By.XPATH, "//button[@data-global-config-setting-select='context']")
|
||||
|
|
|
|||
|
|
@ -69,8 +69,12 @@ try:
|
|||
select_combobox.send_keys("no plugin matching normally")
|
||||
|
||||
# All tabs should be hidden
|
||||
total_tabs = DRIVER.execute_script(f"""return document?.querySelector('[data-tab-select-dropdown]')?.querySelectorAll('[data-tab-select-handler]').length""")
|
||||
hidden_tabs = DRIVER.execute_script(f"""return document?.querySelector('[data-tab-select-dropdown]')?.querySelectorAll('button[data-tab-select-handler][class*="hidden"]').length""")
|
||||
total_tabs = DRIVER.execute_script(
|
||||
f"""return document?.querySelector('[data-tab-select-dropdown]')?.querySelectorAll('[data-tab-select-handler]').length"""
|
||||
)
|
||||
hidden_tabs = DRIVER.execute_script(
|
||||
f"""return document?.querySelector('[data-tab-select-dropdown]')?.querySelectorAll('button[data-tab-select-handler][class*="hidden"]').length"""
|
||||
)
|
||||
|
||||
if total_tabs != hidden_tabs:
|
||||
log_error("All tabs should be hidden.")
|
||||
|
|
@ -83,7 +87,9 @@ try:
|
|||
# Show only one tab
|
||||
select_combobox.send_keys("blacklist")
|
||||
|
||||
hidden_tabs = DRIVER.execute_script(f"""return document?.querySelector('[data-tab-select-dropdown]')?.querySelectorAll('button[data-tab-select-handler][class*="hidden"]').length""")
|
||||
hidden_tabs = DRIVER.execute_script(
|
||||
f"""return document?.querySelector('[data-tab-select-dropdown]')?.querySelectorAll('button[data-tab-select-handler][class*="hidden"]').length"""
|
||||
)
|
||||
|
||||
if hidden_tabs != total_tabs - 1:
|
||||
log_error("Only one tab should be visible.")
|
||||
|
|
@ -100,7 +106,9 @@ try:
|
|||
log_error("Combobox input should be empty.")
|
||||
exit(1)
|
||||
|
||||
hidden_tabs = DRIVER.execute_script(f"""return document?.querySelector('[data-tab-select-dropdown]')?.querySelectorAll('button[data-tab-select-handler][class*="hidden"]').length""")
|
||||
hidden_tabs = DRIVER.execute_script(
|
||||
f"""return document?.querySelector('[data-tab-select-dropdown]')?.querySelectorAll('button[data-tab-select-handler][class*="hidden"]').length"""
|
||||
)
|
||||
|
||||
if hidden_tabs:
|
||||
log_error("All tabs should be visible.")
|
||||
|
|
@ -446,7 +454,6 @@ try:
|
|||
|
||||
log_info("Service app3.example.com is present, trying service card filters...")
|
||||
|
||||
|
||||
# Set keyword with no matching settings
|
||||
input_card_keyword = safe_get_element(DRIVER, By.ID, "service-name-keyword")
|
||||
input_card_keyword.send_keys("dqz48 é84 dzq 584dz5qd4")
|
||||
|
|
|
|||
Loading…
Reference in a new issue