mirror of
https://github.com/hyzendust/hyzendust.github.io.git
synced 2026-06-30 23:12:16 +02:00
Fix: uninotes guard
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
||||
<!doctype html><html class=html lang=en-us dir=ltr><head><meta name=generator content="Hugo 0.162.0"><meta charset=utf-8><meta name=viewport content="width=device-width"><title>Freedoms4</title><link rel=stylesheet href=/css/style.min.34d0accb85f8ec23ceee8c29eef5907823b531d8acb9e6bdf45a3b37ad028d30.css integrity="sha256-NNCsy4X47CPO7owp7vWQeCO1Mdisuea99Fo7N60CjTA=" crossorigin=anonymous><link rel=icon href=/favicon.ico><meta name=description content="Freedoms4"><meta property="og:url" content="https://freedoms4.org/"><meta property="og:site_name" content="Freedoms4"><meta property="og:title" content="Home"><meta property="og:description" content="Freedoms4"><meta property="og:locale" content="en_us"><meta property="og:type" content="website"><meta itemprop=name content="Home"><meta itemprop=description content="Freedoms4"><meta itemprop=datePublished content="2026-03-01T18:11:14+00:00"><meta itemprop=dateModified content="2026-03-01T18:11:14+00:00"><meta itemprop=wordCount content="197"><link rel=alternate type=application/rss+xml href=/index.xml title=Freedoms4><link rel=stylesheet href=/css/custom.css><script>(function(){var e=localStorage.getItem("theme");e&&document.documentElement.setAttribute("data-theme",e),localStorage.getItem("f4_username")==="hyzen"&&document.documentElement.classList.add("hyzen-user")})()</script><script async src=https://plausible.freedoms4.org/js/pa-5BKl0z0RLzwrclKq4y-qk.js></script><script>(window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arguments)},plausible.init=plausible.init||function(e){plausible.o=e||{}}),plausible.init()</script></head><body class=body><header class=header><div class=brand><img src=/logo.png alt="Freedoms4 logo"><h1>Freedoms4</h1><div class=brand__actions><button class=theme-toggle id=theme-toggle aria-label="Toggle theme" title="Toggle dark/light mode">
|
||||
<!doctype html><html class=html lang=en-us dir=ltr><head><meta name=generator content="Hugo 0.163.0"><meta charset=utf-8><meta name=viewport content="width=device-width"><title>Freedoms4</title><link rel=stylesheet href=/css/style.min.34d0accb85f8ec23ceee8c29eef5907823b531d8acb9e6bdf45a3b37ad028d30.css integrity="sha256-NNCsy4X47CPO7owp7vWQeCO1Mdisuea99Fo7N60CjTA=" crossorigin=anonymous><link rel=icon href=/favicon.ico><meta name=description content="Freedoms4"><meta property="og:url" content="https://freedoms4.org/"><meta property="og:site_name" content="Freedoms4"><meta property="og:title" content="Home"><meta property="og:description" content="Freedoms4"><meta property="og:locale" content="en_us"><meta property="og:type" content="website"><meta itemprop=name content="Home"><meta itemprop=description content="Freedoms4"><meta itemprop=datePublished content="2026-03-01T18:11:14+00:00"><meta itemprop=dateModified content="2026-03-01T18:11:14+00:00"><meta itemprop=wordCount content="197"><link rel=alternate type=application/rss+xml href=/index.xml title=Freedoms4><link rel=stylesheet href=/css/custom.css><script>(function(){var e=localStorage.getItem("theme");e&&document.documentElement.setAttribute("data-theme",e),localStorage.getItem("f4_username")==="hyzen"&&document.documentElement.classList.add("hyzen-user")})()</script><script async src=https://plausible.freedoms4.org/js/pa-5BKl0z0RLzwrclKq4y-qk.js></script><script>(window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arguments)},plausible.init=plausible.init||function(e){plausible.o=e||{}}),plausible.init()</script></head><body class=body><header class=header><div class=brand><img src=/logo.png alt="Freedoms4 logo"><h1>Freedoms4</h1><div class=brand__actions><button class=theme-toggle id=theme-toggle aria-label="Toggle theme" title="Toggle dark/light mode">
|
||||
<svg class="theme-toggle__sun" viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><path d="M12 7c-2.76.0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zM2 13h2c.55.0 1-.45 1-1s-.45-1-1-1H2c-.55.0-1 .45-1 1s.45 1 1 1zm18 0h2c.55.0 1-.45 1-1s-.45-1-1-1h-2c-.55.0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58c-.39-.39-1.03-.39-1.41.0-.39.39-.39 1.03.0 1.41l1.06 1.06c.39.39 1.03.39 1.41.0s.39-1.03.0-1.41L5.99 4.58zm12.37 12.37c-.39-.39-1.03-.39-1.41.0-.39.39-.39 1.03.0 1.41l1.06 1.06c.39.39 1.03.39 1.41.0.39-.39.39-1.03.0-1.41l-1.06-1.06zm1.06-12.37-1.06 1.06c-.39.39-.39 1.03.0 1.41s1.03.39 1.41.0l1.06-1.06c.39-.39.39-1.03.0-1.41s-1.03-.39-1.41.0zM7.05 18.36l-1.06 1.06c-.39.39-.39 1.03.0 1.41s1.03.39 1.41.0l1.06-1.06c.39-.39.39-1.03.0-1.41s-1.03-.39-1.41.0z"/></svg>
|
||||
<svg class="theme-toggle__moon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"/></svg></button><div class=brand__auth><input type=checkbox id=auth-dropdown class=brand__auth-check>
|
||||
<label class=brand__auth-toggle for=auth-dropdown tabindex=0 aria-label="Account options"><svg viewBox="0 0 24 24" width="12" height="12" fill="currentColor"><path d="M12 12c2.7.0 4.8-2.1 4.8-4.8S14.7 2.4 12 2.4 7.2 4.5 7.2 7.2 9.3 12 12 12zm0 2.4c-3.2.0-9.6 1.6-9.6 4.8v2.4h19.2v-2.4c0-3.2-6.4-4.8-9.6-4.8z"/></svg></label><div class=brand__auth-links><a href=/login/ class="auth-link auth-link--login">Login</a>
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
(function () {
|
||||
// ── UniNotes auth guard ──
|
||||
if (window.location.pathname.indexOf('/uninotes/') === 0) {
|
||||
if (localStorage.getItem('f4_username') !== 'hyzen') {
|
||||
sessionStorage.setItem('f4_login_next', window.location.pathname);
|
||||
window.location.replace('/login/');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var path = window.location.pathname;
|
||||
if (path === '/login/' || path === '/signup/') return;
|
||||
|
||||
@@ -27,7 +36,7 @@
|
||||
})
|
||||
.then(function (data) {
|
||||
if (!data.valid) {
|
||||
// DB gone, user deleted, or session invalid — log out immediately
|
||||
// Session invalid — clear localStorage and reload to update UI
|
||||
localStorage.removeItem('f4_username');
|
||||
localStorage.removeItem('f4_login_time');
|
||||
localStorage.removeItem('f4_session_fails');
|
||||
@@ -37,10 +46,6 @@
|
||||
}
|
||||
})
|
||||
.catch(function () {
|
||||
// Backend completely unreachable — force logout immediately
|
||||
localStorage.removeItem('f4_username');
|
||||
localStorage.removeItem('f4_login_time');
|
||||
localStorage.removeItem('f4_session_fails');
|
||||
window.location.reload();
|
||||
// Backend unreachable — do NOT log out, just ignore silently
|
||||
});
|
||||
})();
|
||||
|
||||
@@ -191,7 +191,13 @@
|
||||
}
|
||||
|
||||
isAdmin = !!data.is_admin;
|
||||
username = data.username || null;
|
||||
username = data.logged_in ? (data.username || null) : null;
|
||||
// Keep localStorage in sync with what the server says
|
||||
if (!data.logged_in && localStorage.getItem('f4_username')) {
|
||||
localStorage.removeItem('f4_username');
|
||||
localStorage.removeItem('f4_login_time');
|
||||
localStorage.removeItem('f4_session_fails');
|
||||
}
|
||||
|
||||
// ── Render comments first ──
|
||||
if (!data.comments.length) {
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
(function () {
|
||||
// ── UniNotes auth guard ──
|
||||
if (window.location.pathname.indexOf('/uninotes/') === 0) {
|
||||
if (localStorage.getItem('f4_username') !== 'hyzen') {
|
||||
sessionStorage.setItem('f4_login_next', window.location.pathname);
|
||||
window.location.replace('/login/');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var path = window.location.pathname;
|
||||
if (path === '/login/' || path === '/signup/') return;
|
||||
|
||||
@@ -27,7 +36,7 @@
|
||||
})
|
||||
.then(function (data) {
|
||||
if (!data.valid) {
|
||||
// DB gone, user deleted, or session invalid — log out immediately
|
||||
// Session invalid — clear localStorage and reload to update UI
|
||||
localStorage.removeItem('f4_username');
|
||||
localStorage.removeItem('f4_login_time');
|
||||
localStorage.removeItem('f4_session_fails');
|
||||
@@ -37,10 +46,6 @@
|
||||
}
|
||||
})
|
||||
.catch(function () {
|
||||
// Backend completely unreachable — force logout immediately
|
||||
localStorage.removeItem('f4_username');
|
||||
localStorage.removeItem('f4_login_time');
|
||||
localStorage.removeItem('f4_session_fails');
|
||||
window.location.reload();
|
||||
// Backend unreachable — do NOT log out, just ignore silently
|
||||
});
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user