diff --git a/src/background.ts b/src/background.ts index 414d823a..a0cf9411 100644 --- a/src/background.ts +++ b/src/background.ts @@ -2,6 +2,34 @@ import browser from "webextension-polyfill"; import type { SettingsState } from "@/types/storage"; import { fetchNews } from "./background/news"; +interface PrivacyPolicyResponse { + last_updated: string; + whatsnew_html: string; +} + +async function fetchPrivacyPolicy(sendResponse: (response?: any) => void) { + try { + const response = await fetch("https://betterseqta.org/api/policy/privacy", { + method: "GET", + headers: { + "Accept": "application/json", + }, + }); + + if (!response.ok) { + console.error("[BetterSEQTA+] Failed to fetch privacy policy:", response.status); + sendResponse({ error: `HTTP ${response.status}`, data: null }); + return; + } + + const data = await response.json() as PrivacyPolicyResponse; + sendResponse({ error: null, data }); + } catch (error) { + console.error("[BetterSEQTA+] Error fetching privacy policy:", error); + sendResponse({ error: String(error), data: null }); + } +} + function reloadSeqtaPages() { const result = browser.tabs.query({}); function open(tabs: any) { @@ -56,6 +84,10 @@ browser.runtime.onMessage.addListener( fetchNews(request.source ?? "australia", sendResponse); return true; + case "fetchPrivacyPolicy": + fetchPrivacyPolicy(sendResponse); + return true; + default: console.log("Unknown request type"); } diff --git a/src/exampleprivacyresponse.json b/src/exampleprivacyresponse.json new file mode 100644 index 00000000..e51df1e0 --- /dev/null +++ b/src/exampleprivacyresponse.json @@ -0,0 +1,4 @@ +{ + "last_updated": "2024-06-15T12:00:00Z", + "whatsnew_html": "
It has come to our attention that several schools have expressed concerns about BetterSEQTA+. This is very disheartening, so we have decided to release a statement on the situation.
To view our privacy policy, please click the shield icon in the settings menu, or click here.
We never collect any information from you, and aim to provide the best features possible.
Show the privacy notification popup on next page load
+Important Information
++ It has come to our attention that several schools have expressed concerns about BetterSEQTA+. This is very disheartening, so we have decided to release a statement on the situation. +
++ To view our privacy policy, please click the shield icon in the settings menu, or click here. +
++ We never collect any information from you, and aim to provide the best features possible. +
+Our commitment to your privacy
+At BetterSEQTA+, we take your privacy seriously. We want to be completely transparent about how we handle your data.
+ +We never collect any information from you. BetterSEQTA+ is designed to work entirely on your device. All processing happens locally in your browser, and we do not send any data to external servers.
+ +BetterSEQTA+ uses your browser's local storage to save your preferences and settings. This data remains on your device and is never transmitted anywhere. You can clear this data at any time through your browser's settings.
+ +BetterSEQTA+ is an open-source project. You can review our code on GitHub to verify our privacy practices. We believe in transparency and encourage you to inspect the code yourself.
+ +We are committed to providing the best features possible while respecting your privacy. We understand that schools and students have concerns about data privacy, and we want to assure you that BetterSEQTA+ is designed with privacy as a core principle.
+ +If you have any questions or concerns about our privacy practices, please reach out to us through our GitHub repository.
+