Add dynamic privacy policy notification with API fetch

Implements fetching the privacy policy from the BetterSEQTA+ API and displays a notification if the policy has been updated. Adds sanitization for HTML content, updates settings state to track last shown timestamp, and provides a manual trigger in settings. Refactors notification logic for improved security and maintainability.
This commit is contained in:
StroepWafel
2025-11-29 19:47:30 +10:30
parent fd86e57442
commit 2c077bc755
6 changed files with 193 additions and 26 deletions
+5 -5
View File
@@ -24,7 +24,7 @@ import loading from "@/seqta/ui/Loading";
import { SendNewsPage } from "@/seqta/utils/SendNewsPage";
import { loadHomePage } from "@/seqta/utils/Loaders/LoadHomePage";
import { OpenWhatsNewPopup } from "@/seqta/utils/Openers/OpenWhatsNewPopup";
import { showPrivacyNotification } from "@/seqta/utils/Openers/OpenPrivacyNotification";
import { checkAndShowPrivacyNotification } from "@/seqta/utils/Openers/OpenPrivacyNotification";
import { updateTimetableTimes } from "@/seqta/utils/updateTimetableTimes";
@@ -94,10 +94,10 @@ export async function finishLoad() {
console.error("Error during loading cleanup:", err);
}
// Show privacy statement notification on first open of this version (before what's new)
if (!settingsState.privacyStatementShown && !document.getElementById("whatsnewbk")) {
showPrivacyNotification();
settingsState.privacyStatementShown = true;
// Check and show privacy statement notification (before what's new)
// This will check the API and compare timestamps
if (!document.getElementById("privacy-notification")) {
await checkAndShowPrivacyNotification();
}
if (settingsState.justupdated && !document.getElementById("whatsnewbk") && !document.getElementById("privacy-notification")) {