more work on webhook, implement getMetadata endpoint for appview and link holds to a preferred appview

This commit is contained in:
Evan Jarrett
2026-02-22 22:49:33 -06:00
parent 1e04c91507
commit dc31ca2f35
29 changed files with 487 additions and 173 deletions
+10
View File
@@ -420,6 +420,16 @@
.vuln-box-low { background-color: oklch(80% 0.1 85); color: oklch(25% 0.05 85); }
}
/* ========================================
TOAST CONTAINER
======================================== */
#toast-container {
pointer-events: none;
}
#toast-container > * {
pointer-events: auto;
}
/* ========================================
SUPPORTER BADGE TEXT COLOR OVERRIDES
Unlayered — wins over DaisyUI's layered
+42
View File
@@ -711,6 +711,46 @@ document.addEventListener('DOMContentLoaded', () => {
}
});
// Toast notifications (auto-dismiss after 3s)
function showToast(message, type) {
let container = document.getElementById('toast-container');
if (!container) {
container = document.createElement('div');
container.id = 'toast-container';
container.className = 'toast toast-end toast-bottom z-50';
document.body.appendChild(container);
}
const alertClass = type === 'error' ? 'alert-error' : 'alert-success';
const toast = document.createElement('div');
toast.className = `alert ${alertClass} shadow-lg transition-opacity duration-300`;
toast.innerHTML = `<span>${message}</span>`;
container.appendChild(toast);
setTimeout(() => {
toast.style.opacity = '0';
setTimeout(() => toast.remove(), 300);
}, 3000);
}
// Test webhook via fetch + toast
async function testWebhook(rkey) {
try {
const resp = await fetch(`/api/webhooks/${rkey}/test`, {
method: 'POST',
credentials: 'include',
});
const text = await resp.text();
if (text.includes('class="success"') || (resp.ok && !text.includes('class="error"'))) {
showToast('Test webhook delivered successfully!', 'success');
} else {
showToast('Test delivery failed \u2014 check the webhook URL', 'error');
}
} catch {
showToast('Failed to reach server', 'error');
}
}
// Export functions that are called from templates via onclick handlers
window.setTheme = setTheme;
window.toggleSearch = toggleSearch;
@@ -720,3 +760,5 @@ window.toggleOfflineManifests = toggleOfflineManifests;
window.deleteManifest = deleteManifest;
window.closeManifestDeleteModal = closeManifestDeleteModal;
window.openVulnDetails = openVulnDetails;
window.showToast = showToast;
window.testWebhook = testWebhook;