Enhance DNS discovery, validation & transfers

Add comprehensive DNS management and input validation, plus safer transfer and logging behavior.

- Add CronHelper utilities for cron scripts and unify logging/formatting.
- Improve InputValidator: sanitizeDomainInput and validateRootDomain (handles multi-level TLDs) and use throughout domain import/create flows to reject subdomains.
- DomainController: refactor DNS refresh to support quick/deep discovery (background deep scans), add endpoints to discover, add/delete/bulk-delete DNS records, import BIND zone files, enrich IP metadata via enrichIpDetails, and strengthen bulk import/reporting messages.
- DnsRecord model: add source column handling (discovered/manual/imported), avoid auto-deleting manual/imported records, and add helpers for deleting, bulk deleting, manual adding and importing zone records.
- Tag, NotificationGroup and Domain transfer logic: unlink groups when ownership changes, remove tags that belong to other users, add audit logging via Logger and improved bulk transfer reporting. TagController/View: show transferable users for admins and skip global tags on transfer.
- Notification channels (Discord, Mattermost, etc.) and EmailHelper: allow explicit subjects and improve payload fields based on notification type.
- Add new migration 029_add_dns_record_source.sql and wire it into the installer; update migrations detection.
- Add new views/partials for confirm/import/transfer modals, update various domain/group/tag templates, and update cron scripts and routes for discovery.

These changes preserve manual/imported DNS records, improve root-domain validation, enable background deep discovery, and add better logging/audit trails for transfers and imports.
This commit is contained in:
Hosteroid
2026-03-10 22:54:28 +02:00
parent 5365af00fd
commit a265a58456
46 changed files with 3130 additions and 1494 deletions

View File

@@ -396,7 +396,7 @@ function getSelectedUserIds() {
return Array.from(checkboxes).map(cb => cb.value);
}
function bulkToggleStatus(action) {
async function bulkToggleStatus(action) {
const userIds = getSelectedUserIds();
if (userIds.length === 0) {
@@ -405,9 +405,8 @@ function bulkToggleStatus(action) {
}
const actionText = action === 'active' ? 'activate' : 'deactivate';
if (!confirm(`Are you sure you want to ${actionText} ${userIds.length} user(s)?`)) {
return;
}
var ok = await confirmAction({ message: 'Are you sure you want to ' + actionText + ' ' + userIds.length + ' user(s)?', title: actionText.charAt(0).toUpperCase() + actionText.slice(1) + ' Users', icon: action === 'active' ? 'fa-user-check text-green-500' : 'fa-user-slash text-orange-500' });
if (!ok) return;
const form = document.createElement('form');
form.method = 'POST';
@@ -450,10 +449,9 @@ function toggleUserStatus(userId) {
form.submit();
}
function deleteUser(userId) {
if (!confirm('Are you sure you want to delete this user? This action cannot be undone.')) {
return;
}
async function deleteUser(userId) {
var ok = await confirmAction({ message: 'Are you sure you want to delete this user? This action cannot be undone.' });
if (!ok) return;
const form = document.createElement('form');
form.method = 'POST';
@@ -469,7 +467,7 @@ function deleteUser(userId) {
form.submit();
}
function bulkDeleteUsers() {
async function bulkDeleteUsers() {
const userIds = getSelectedUserIds();
if (userIds.length === 0) {
@@ -477,9 +475,8 @@ function bulkDeleteUsers() {
return;
}
if (!confirm(`Are you sure you want to delete ${userIds.length} user(s)? This action cannot be undone.`)) {
return;
}
var ok = await confirmAction({ message: 'Are you sure you want to delete ' + userIds.length + ' user(s)? This action cannot be undone.' });
if (!ok) return;
const form = document.createElement('form');
form.method = 'POST';

View File

@@ -48,12 +48,12 @@
<form method="POST" action="/users/{{ user.id }}/toggle-status" class="inline">
{{ csrf_field() }}
{% if isActive %}
<button type="submit" onclick="return confirm('Deactivate this user?')" class="px-4 py-2 bg-orange-600 text-white rounded-lg hover:bg-orange-700 transition-colors text-sm font-medium">
<button type="submit" onclick="return confirmClick(event, 'Deactivate this user?', { title: 'Deactivate', icon: 'fa-user-slash text-orange-500', confirmClass: 'bg-orange-600 hover:bg-orange-700' })" class="px-4 py-2 bg-orange-600 text-white rounded-lg hover:bg-orange-700 transition-colors text-sm font-medium">
<i class="fas fa-user-slash mr-2"></i>
Deactivate
</button>
{% else %}
<button type="submit" onclick="return confirm('Activate this user?')" class="px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors text-sm font-medium">
<button type="submit" onclick="return confirmClick(event, 'Activate this user?', { title: 'Activate', icon: 'fa-user-check text-green-500', confirmClass: 'bg-green-600 hover:bg-green-700' })" class="px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors text-sm font-medium">
<i class="fas fa-user-check mr-2"></i>
Activate
</button>
@@ -61,7 +61,7 @@
</form>
<form method="POST" action="/users/{{ user.id }}/delete" class="inline">
{{ csrf_field() }}
<button type="submit" onclick="return confirm('Are you sure you want to delete this user? This action cannot be undone.')" class="px-4 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700 transition-colors text-sm font-medium">
<button type="submit" onclick="return confirmClick(event, 'Are you sure you want to delete this user? This action cannot be undone.')" class="px-4 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700 transition-colors text-sm font-medium">
<i class="fas fa-trash mr-2"></i>
Delete
</button>
@@ -529,8 +529,15 @@
{{ domain.statusText }}
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-600 dark:text-slate-400">
{{ domain.group_name|default('—') }}
<td class="px-6 py-4 whitespace-nowrap text-sm">
{% if domain.group_name %}
<span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-medium bg-blue-100 dark:bg-blue-500/20 text-blue-800 dark:text-blue-400">
<i class="fas fa-bell mr-1"></i>
{{ domain.group_name }}
</span>
{% else %}
<span class="text-gray-400 dark:text-slate-500">No Group</span>
{% endif %}
</td>
</tr>
{% endfor %}