From 6f695daddceff036cb969eed268e9ada7741dc8a Mon Sep 17 00:00:00 2001 From: Frankie B Date: Fri, 12 Jul 2024 22:43:15 +0100 Subject: [PATCH] Use the current hostname in schemeSwap.js instead of hard coding it --- public/js/schemeSwap.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/js/schemeSwap.js b/public/js/schemeSwap.js index f51443d..044df0f 100644 --- a/public/js/schemeSwap.js +++ b/public/js/schemeSwap.js @@ -26,10 +26,11 @@ function getCookie(cname) { * @param {number} exdays Cookie lifespan (days) */ function setCookie(cname, cvalue, exdays) { + const hostname = window.location.hostname; const d = new Date(); d.setTime(d.getTime() + (exdays*24*60*60*1000)); let expires = "expires="+ d.toUTCString(); - document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/;SameSite=Strict;Domain=.diskfloppy.me"; + document.cookie = `${cname}=${cvalue};${expires};path=/;SameSite=Strict;Domain=${hostname}` } /**