From d28571bed9c6974228c3cf50984d4c6080ce1ac0 Mon Sep 17 00:00:00 2001 From: Orazio <22700499+orazioedoardo@users.noreply.github.com> Date: Sun, 11 Aug 2024 09:47:07 +0200 Subject: [PATCH] Replace inline onclick with addEventListener inside .js file to be compatible with CSP Signed-off-by: Orazio <22700499+orazioedoardo@users.noreply.github.com> --- scripts/pi-hole/js/logout.js | 15 +++++++++++++++ scripts/pi-hole/lua/header_authenticated.lp | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 scripts/pi-hole/js/logout.js diff --git a/scripts/pi-hole/js/logout.js b/scripts/pi-hole/js/logout.js new file mode 100644 index 00000000..40f290ff --- /dev/null +++ b/scripts/pi-hole/js/logout.js @@ -0,0 +1,15 @@ +/* Pi-hole: A black hole for Internet advertisements + * (c) 2023 Pi-hole, LLC (https://pi-hole.net) + * Network-wide ad blocking via your own hardware. + * + * This file is copyright under the latest version of the EUPL. + * Please see LICENSE file for your rights under this license. */ + +/* global utils:false */ + +document.addEventListener("DOMContentLoaded", () => { + const logoutButton = document.getElementById("logout-button"); + logoutButton.addEventListener("click", () => { + utils.doLogout(); + }); +}); diff --git a/scripts/pi-hole/lua/header_authenticated.lp b/scripts/pi-hole/lua/header_authenticated.lp index f4a297f4..d27b80a2 100644 --- a/scripts/pi-hole/lua/header_authenticated.lp +++ b/scripts/pi-hole/lua/header_authenticated.lp @@ -9,6 +9,7 @@ ]]-- mg.include('header.lp','r') ?> + @@ -85,7 +86,7 @@ mg.include('header.lp','r') GitHub Pi-hole Releases - Log out + Log out