diff --git a/manifest.json b/manifest.json index d89d4ed..f96e82c 100644 --- a/manifest.json +++ b/manifest.json @@ -25,9 +25,7 @@ }, "background": { - "scripts": ["scripts/report-slop.js"], - "persistent": false, - "type": "module" + "page": "pages/background_page.html" }, "content_scripts": [ diff --git a/pages/background_page.html b/pages/background_page.html new file mode 100644 index 0000000..9e62123 --- /dev/null +++ b/pages/background_page.html @@ -0,0 +1,13 @@ + + + + + + + Slop Farmer + + +
+ +
+ \ No newline at end of file diff --git a/scripts/report-slop.js b/scripts/report-slop.js index 9e8329d..d1ea358 100644 --- a/scripts/report-slop.js +++ b/scripts/report-slop.js @@ -1,4 +1,5 @@ const API_URL = "http://localhost:8000" +let access_token function setup_storage_db() { /* create indexeddb object store to retain objects in the form of @@ -186,7 +187,16 @@ async function message_listener(message, sender) { } } +function get_access_token() { + access_token = localStorage.getItem("accessToken") + if (!access_token) { + // get an access token from the API + } + return access_token +} + browser.runtime.onInstalled.addListener(on_install_handler) +browser.runtime.onStartup.addListener(get_access_token) browser.pageAction.onClicked.addListener(on_button_clicked_handler) browser.webNavigation.onCommitted.addListener(update_page_action_icon) browser.runtime.onMessage.addListener(message_listener)