Now gets keywords.txt from repo on git.wbell.dev

This commit is contained in:
2026-02-25 15:13:52 +00:00
parent 8390c0a43e
commit 36c004b802
4 changed files with 65 additions and 25 deletions

34
background.js Normal file
View File

@@ -0,0 +1,34 @@
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
if (request.type === "GET_KEYWORDS") {
const remoteUrl = "https://git.wbell.dev/TussockyJoker/Aula-Fixer/raw/branch/main/keywords.txt";
const localUrl = chrome.runtime.getURL("keywords.txt");
// remote
fetch(remoteUrl)
.then(response => {
if (!response.ok) throw new Error("Remote fetch failed");
return response.text();
})
.then(text => {
console.log("Loaded remote keywords");
sendResponse({ success: true, data: text });
})
.catch(() => {
console.warn("Remote failed, loading local fallback");
// local
fetch(localUrl)
.then(response => response.text())
.then(text => {
console.log("Loaded local fallback keywords");
sendResponse({ success: true, data: text });
})
.catch(error => {
sendResponse({ success: false, error: error.toString() });
});
});
return true;
}
});