diff options
author | Frankie B <git@diskfloppy.me> | 2024-07-12 22:43:15 +0100 |
---|---|---|
committer | Frankie B <git@diskfloppy.me> | 2024-07-12 22:43:15 +0100 |
commit | 217b24c1e8d5a9f61bd469ab8091d59dbadf44c3 (patch) | |
tree | 2c70bd73709ae717af79fb2ffbd276ec644fae3c /public/js/schemeSwap.js | |
parent | 33fec5e18928bf0753c4e01350013931ea302e91 (diff) |
Use the current hostname in schemeSwap.js instead of hard coding it
Diffstat (limited to 'public/js/schemeSwap.js')
-rw-r--r-- | public/js/schemeSwap.js | 3 |
1 files changed, 2 insertions, 1 deletions
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}` } /** |