mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 02:54:26 +00:00
- Fix oauth2.enabled: replace Jinja2 group_names expression with literal true - Set oauth2.shared: false to deploy role-local oauth2-proxy instance - Add allowed_groups for RBAC administrator access control - Add javascript service for logout button injection - Remove variant 1 (standalone mode) - pihole always requires Keycloak - Delete compose.override.yml.j2 (--ssl-insecure-skip-verify no longer needed) - Fix javascript.js.j2: wrap redirect in DOMContentLoaded to fix DOM timing - Add TEST_E2E_PLAYWRIGHT_WAIT_ENABLED: false for oauth2-protected app
40 lines
1.1 KiB
Django/Jinja
40 lines
1.1 KiB
Django/Jinja
{% raw %}
|
|
(function () {
|
|
function redirectIfAccessDenied() {
|
|
if (document.querySelector('p') && document.body.innerText.includes("your Pi-hole")) {
|
|
window.location.replace("/admin/");
|
|
}
|
|
}
|
|
|
|
function injectLogoutButton() {
|
|
if (document.getElementById("oauth2-logout-btn")) return;
|
|
var navbar = document.querySelector(".navbar-custom-menu .navbar-nav");
|
|
if (!navbar) return;
|
|
var li = document.createElement("li");
|
|
var a = document.createElement("a");
|
|
a.id = "oauth2-logout-btn";
|
|
a.href = "/oauth2/sign_out";
|
|
a.title = "Logout";
|
|
a.style.cursor = "pointer";
|
|
a.innerHTML = '<i class="fa fa-sign-out"></i> Logout';
|
|
li.appendChild(a);
|
|
navbar.appendChild(li);
|
|
}
|
|
|
|
if (document.readyState === "loading") {
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
redirectIfAccessDenied();
|
|
injectLogoutButton();
|
|
}, { once: true });
|
|
} else {
|
|
redirectIfAccessDenied();
|
|
injectLogoutButton();
|
|
}
|
|
|
|
new MutationObserver(injectLogoutButton).observe(document.documentElement, {
|
|
childList: true,
|
|
subtree: true,
|
|
});
|
|
})();
|
|
{% endraw %}
|