implementation start of rspam/antispam feature

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2024-01-05 15:37:04 +01:00
parent 63bbcd4e00
commit b15f99b1e1
59 changed files with 1739 additions and 865 deletions

View File

@@ -14,6 +14,9 @@ window.bootstrap = bootstrap;
import Chart from 'chart.js/auto';
window.Chart = Chart;
// set a default theme
window.$theme = 'Froxlor';
// Axios
import axios from 'axios';
window.axios = axios;

View File

@@ -8,13 +8,15 @@ export default function () {
history.back(1);
})
$('#copySysInfo').on('click', function (e) {
e.preventDefault();
navigator.clipboard.writeText($('#ccSysInfo').text().trim());
})
$('[data-bs-toggle="popover"]').each(function () {
new bootstrap.Popover($(this));
})
$('.copyClipboard').on('click', function (e) {
e.preventDefault();
const source_element = $(this).data('clipboard-source').text();
navigator.clipboard.writeText($('#' + source_element).text().trim());
})
});
}

View File

@@ -60,6 +60,8 @@
{{ _self.select(id, field) }}
{% elseif field.type == 'textarea' %}
{{ _self.textarea(id, field) }}
{% elseif field.type == 'longtext' %}
{{ _self.longtext(id, field) }}
{% elseif field.type == 'label' %}
{{ _self.plain(id, field) }}
{% elseif field.type == 'link' %}
@@ -155,6 +157,15 @@
{% endif %}
{% endmacro %}
{% macro longtext(id, field) %}
<div>
<div class="float-end">
<button class="btn btn-outline-secondary copyClipboard" data-clipboard-source="{{ id }}" style="--bs-btn-padding-y: .25rem; --bs-btn-padding-x: .5rem; --bs-btn-font-size: .5rem;" title="Copy to clipboard"><i class="fa-solid fa-copy"></i></button>
</div>
<p class="text-break" id="{{ id }}">{{ field.value|raw }}</p>
</div>
{% endmacro %}
{% macro input(id, field) %}
{% if field.next_to is defined %}
<div class="input-group">

View File

@@ -79,7 +79,8 @@
(dtype == 'bind' and get_setting('system.bind_enable') == '1' and get_setting('system.dns_server') == 'Bind') or
(dtype == 'powerdns' and get_setting('system.bind_enable') == '1' and get_setting('system.dns_server') == 'PowerDNS') or
(dtype == 'proftpd' and get_setting('system.ftpserver') == 'proftpd') or
(dtype == 'pureftpd' and get_setting('system.ftpserver') == 'pureftpd')
(dtype == 'pureftpd' and get_setting('system.ftpserver') == 'pureftpd') or
(dtype == 'rspamd' and get_setting('antispam.activated') == '1')
%}
{% set recommended = true %}
{% endif %}

View File

@@ -67,7 +67,7 @@
<i class="fa-solid fa-gears me-1"></i>
{{ lng('admin.systemdetails') }}
<div class="float-end">
<button id="copySysInfo" class="btn btn-outline-secondary" style="--bs-btn-padding-y: .25rem; --bs-btn-padding-x: .5rem; --bs-btn-font-size: .5rem;" title="Copy to clipboard"><i class="fa-solid fa-copy"></i></button>
<button id="copySysInfo" class="btn btn-outline-secondary copyClipboard" data-clipboard-source="ccSysInfo" style="--bs-btn-padding-y: .25rem; --bs-btn-padding-x: .5rem; --bs-btn-font-size: .5rem;" title="Copy to clipboard"><i class="fa-solid fa-copy"></i></button>
</div>
<div id="ccSysInfo" class="d-none">
- Froxlor: {{ call_static('\\Froxlor\\Froxlor', 'getVersionString') }}

View File

@@ -20,7 +20,7 @@
<nav class="navbar navbar-expand-md navbar-light p-0 {% if not block('heading') %}shadow-sm{% endif %}">
<div class="container-fluid gx-0">
<div>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#sidebar" aria-controls="sidebar" aria-expanded="false" aria-label="Toggle sidebar">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#sidebar" aria-controls="sidebar" aria-expanded="false" aria-label="Toggle sidebar">
<span class="navbar-toggler-icon"></span>
</button>
</div>
@@ -51,20 +51,30 @@
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarOpts">
<li>
<a class="dropdown-item" href="{{ linker({'section': 'index', 'page': 'profile'}) }}"><i class="fa-solid fa-user-gear"></i> {{ lng('panel.profile') }}</a>
<a class="dropdown-item" href="{{ linker({'section': 'index', 'page': 'profile'}) }}">
<i class="fa-solid fa-user-gear"></i> {{ lng('panel.profile') }}
</a>
</li>
{% if get_setting('2fa.enabled') == 1 %}
<li>
<a class="dropdown-item" href="{{ linker({'section': 'index', 'page': '2fa'}) }}"><i class="fa-solid fa-shield"></i> {{ lng('2fa.2fa') }}</a>
<a class="dropdown-item" href="{{ linker({'section': 'index', 'page': '2fa'}) }}">
<i class="fa-solid fa-shield"></i> {{ lng('2fa.2fa') }}
</a>
</li>
{% endif %}
{% if get_setting('api.enabled') == 1 and userinfo.api_allowed == 1 %}
<li><hr class="dropdown-divider"></li>
<li>
<a class="dropdown-item" href="{{ linker({'section': 'index', 'page': 'apikeys'}) }}"><i class="fa-solid fa-key"></i> {{ lng('menue.main.apikeys') }}</a>
<hr class="dropdown-divider">
</li>
<li>
<a class="dropdown-item" href="https://docs.froxlor.org/latest/api-guide/" rel="external" target="_blank"><i class="fa-solid fa-circle-info"></i> {{ lng('menue.main.apihelp') }}</a>
<a class="dropdown-item" href="{{ linker({'section': 'index', 'page': 'apikeys'}) }}">
<i class="fa-solid fa-key"></i> {{ lng('menue.main.apikeys') }}
</a>
</li>
<li>
<a class="dropdown-item" href="https://docs.froxlor.org/latest/api-guide/" rel="external" target="_blank">
<i class="fa-solid fa-circle-info"></i> {{ lng('menue.main.apihelp') }}
</a>
</li>
{% endif %}
</ul>
@@ -105,6 +115,14 @@
</section>
{% endif %}
{% block errors %}
{% if call_static('\\Froxlor\\ErrorBag', 'hasErrors') %}
{% for error in call_static('\\Froxlor\\ErrorBag', 'getErrors') %}
{{ error|raw }}
{% endfor %}
{% endif %}
{% endblock %}
<section class="flex-grow-1 p-3 p-lg-5">
{% block content %}{% endblock %}
</section>