Disallow internal domains from being claimed

This commit is contained in:
Raven Scott
2025-12-26 17:48:50 -05:00
parent 02a11bc025
commit 10d7d52079
7 changed files with 119 additions and 8 deletions
+1 -1
View File
@@ -1154,7 +1154,7 @@
</dialog> </dialog>
</div> </div>
<div id="notifications" class="fixed bottom-4 right-4 flex flex-col-reverse space-y-2 z-50"></div> <div id="notifications" class="fixed bottom-4 right-4 flex flex-col-reverse space-y-2" style="z-index: 99999;"></div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/xterm.js"></script> <script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/xterm.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@xterm/[email protected]/lib/addon-fit.js"></script> <script src="https://cdn.jsdelivr.net/npm/@xterm/[email protected]/lib/addon-fit.js"></script>
+35
View File
@@ -1254,3 +1254,38 @@ dialog button.bg-primary:hover {
transform: rotate(360deg); transform: rotate(360deg);
} }
} }
/* Ensure notifications are always visible above modals and dialogs */
#notifications {
z-index: 99999 !important;
position: fixed !important;
}
#notifications > * {
position: relative;
z-index: inherit;
}
/* Notifications inside dialogs - appear above backdrop */
/* These are direct children of dialog, so they're in the dialog's stacking context above ::backdrop */
dialog > .dialog-notifications {
position: fixed !important;
bottom: 1rem !important;
right: 1rem !important;
z-index: 100000 !important;
pointer-events: none !important;
display: flex !important;
flex-direction: column-reverse !important;
gap: 0.5rem !important;
overflow: visible !important;
/* Try to escape any parent transforms by resetting transform */
transform: translateZ(0) !important;
/* Ensure it's not affected by dialog's position/transform */
isolation: isolate !important;
}
dialog > .dialog-notifications > * {
pointer-events: auto !important;
position: relative !important;
z-index: inherit !important;
}
+14 -2
View File
@@ -24,7 +24,17 @@ async function submitAddDomain() {
body: JSON.stringify({ domain, hash, ssl }) body: JSON.stringify({ domain, hash, ssl })
}); });
if (!response.ok) { if (!response.ok) {
throw new Error(await response.text()); const errorText = await response.text();
let errorMessage = errorText;
// Try to parse as JSON and extract the message
try {
const errorJson = JSON.parse(errorText);
errorMessage = errorJson.message || errorText;
} catch (e) {
// If not JSON, use the text as-is
errorMessage = errorText;
}
throw new Error(errorMessage);
} }
if (window.showNotification) window.showNotification('Domain added successfully'); if (window.showNotification) window.showNotification('Domain added successfully');
const modal = document.getElementById('addDomainModal'); const modal = document.getElementById('addDomainModal');
@@ -35,7 +45,9 @@ async function submitAddDomain() {
if (window.genericFetch) window.genericFetch('domains', true); if (window.genericFetch) window.genericFetch('domains', true);
} catch (err) { } catch (err) {
console.error('Failed to add domain:', err); console.error('Failed to add domain:', err);
if (window.showNotification) window.showNotification('Failed to add domain: ' + err.message, 'error'); // Display just the error message, not the full error object
const errorMessage = err.message || 'An unknown error occurred';
if (window.showNotification) window.showNotification(errorMessage, 'error');
} }
} }
@@ -1,6 +1,27 @@
// Notification and confirmation dialog functions // Notification and confirmation dialog functions
function showNotification(message, type = 'success') { function showNotification(message, type = 'success') {
const container = document.getElementById('notifications'); // Check if any dialog is open
const openDialog = document.querySelector('dialog[open]');
// If a dialog is open, append notifications directly to the dialog element
// This ensures they appear above the backdrop since they're children of the dialog
// Otherwise, use the regular notifications container
let container;
if (openDialog) {
// Check if notification container already exists in the dialog
let dialogNotificationContainer = openDialog.querySelector('.dialog-notifications');
if (!dialogNotificationContainer) {
dialogNotificationContainer = document.createElement('div');
dialogNotificationContainer.className = 'dialog-notifications';
// Append directly to dialog element (not inside content)
// This ensures it's in the dialog's stacking context above the backdrop
openDialog.appendChild(dialogNotificationContainer);
}
container = dialogNotificationContainer;
} else {
container = document.getElementById('notifications');
}
if (!container) return; if (!container) return;
const notification = document.createElement('div'); const notification = document.createElement('div');
let bgColor = 'bg-green-500'; let bgColor = 'bg-green-500';
@@ -13,6 +34,7 @@ function showNotification(message, type = 'success') {
bgColor, bgColor,
'transition-all', 'duration-300', 'opacity-0', 'transform', 'translate-y-4' 'transition-all', 'duration-300', 'opacity-0', 'transform', 'translate-y-4'
); );
notification.style.cssText = 'pointer-events: auto;';
notification.textContent = message; notification.textContent = message;
container.appendChild(notification); container.appendChild(notification);
setTimeout(() => { setTimeout(() => {
@@ -24,6 +46,10 @@ function showNotification(message, type = 'success') {
notification.classList.add('opacity-0', 'translate-y-4'); notification.classList.add('opacity-0', 'translate-y-4');
setTimeout(() => { setTimeout(() => {
notification.remove(); notification.remove();
// Clean up dialog notification container if empty
if (openDialog && container.classList.contains('dialog-notifications') && container.children.length === 0) {
container.remove();
}
}, 300); }, 300);
}, 3000); }, 3000);
} }
+1 -1
View File
@@ -782,7 +782,7 @@
</div> </div>
<div id="status-indicator" class="fixed top-4 right-4 px-4 py-2 bg-blue-500 text-white rounded-lg shadow-md"></div> <div id="status-indicator" class="fixed top-4 right-4 px-4 py-2 bg-blue-500 text-white rounded-lg shadow-md"></div>
<div id="notifications" class="fixed bottom-4 right-4 flex flex-col-reverse space-y-2 z-50"></div> <div id="notifications" class="fixed bottom-4 right-4 flex flex-col-reverse space-y-2" style="z-index: 99999;"></div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/xterm.js"></script> <script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/xterm.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@xterm/[email protected]/lib/addon-fit.js"></script> <script src="https://cdn.jsdelivr.net/npm/@xterm/[email protected]/lib/addon-fit.js"></script>
+14 -2
View File
@@ -24,7 +24,17 @@ async function submitAddDomain() {
body: JSON.stringify({ domain, hash, ssl }) body: JSON.stringify({ domain, hash, ssl })
}); });
if (!response.ok) { if (!response.ok) {
throw new Error(await response.text()); const errorText = await response.text();
let errorMessage = errorText;
// Try to parse as JSON and extract the message
try {
const errorJson = JSON.parse(errorText);
errorMessage = errorJson.message || errorText;
} catch (e) {
// If not JSON, use the text as-is
errorMessage = errorText;
}
throw new Error(errorMessage);
} }
if (window.showNotification) window.showNotification('Domain added successfully'); if (window.showNotification) window.showNotification('Domain added successfully');
const modal = document.getElementById('addDomainModal'); const modal = document.getElementById('addDomainModal');
@@ -35,7 +45,9 @@ async function submitAddDomain() {
if (window.genericFetch) window.genericFetch('domains', true); if (window.genericFetch) window.genericFetch('domains', true);
} catch (err) { } catch (err) {
console.error('Failed to add domain:', err); console.error('Failed to add domain:', err);
if (window.showNotification) window.showNotification('Failed to add domain: ' + err.message, 'error'); // Display just the error message, not the full error object
const errorMessage = err.message || 'An unknown error occurred';
if (window.showNotification) window.showNotification(errorMessage, 'error');
} }
} }
+27 -1
View File
@@ -1,6 +1,27 @@
// Notification and confirmation dialog functions // Notification and confirmation dialog functions
function showNotification(message, type = 'success') { function showNotification(message, type = 'success') {
const container = document.getElementById('notifications'); // Check if any dialog is open
const openDialog = document.querySelector('dialog[open]');
// If a dialog is open, append notifications directly to the dialog element
// This ensures they appear above the backdrop since they're children of the dialog
// Otherwise, use the regular notifications container
let container;
if (openDialog) {
// Check if notification container already exists in the dialog
let dialogNotificationContainer = openDialog.querySelector('.dialog-notifications');
if (!dialogNotificationContainer) {
dialogNotificationContainer = document.createElement('div');
dialogNotificationContainer.className = 'dialog-notifications';
// Append directly to dialog element (not inside content)
// This ensures it's in the dialog's stacking context above the backdrop
openDialog.appendChild(dialogNotificationContainer);
}
container = dialogNotificationContainer;
} else {
container = document.getElementById('notifications');
}
if (!container) return; if (!container) return;
const notification = document.createElement('div'); const notification = document.createElement('div');
let bgColor = 'bg-green-500'; let bgColor = 'bg-green-500';
@@ -13,6 +34,7 @@ function showNotification(message, type = 'success') {
bgColor, bgColor,
'transition-all', 'duration-300', 'opacity-0', 'transform', 'translate-y-4' 'transition-all', 'duration-300', 'opacity-0', 'transform', 'translate-y-4'
); );
notification.style.cssText = 'pointer-events: auto;';
notification.textContent = message; notification.textContent = message;
container.appendChild(notification); container.appendChild(notification);
setTimeout(() => { setTimeout(() => {
@@ -24,6 +46,10 @@ function showNotification(message, type = 'success') {
notification.classList.add('opacity-0', 'translate-y-4'); notification.classList.add('opacity-0', 'translate-y-4');
setTimeout(() => { setTimeout(() => {
notification.remove(); notification.remove();
// Clean up dialog notification container if empty
if (openDialog && container.classList.contains('dialog-notifications') && container.children.length === 0) {
container.remove();
}
}, 300); }, 300);
}, 3000); }, 3000);
} }