aboutsummaryrefslogtreecommitdiff
path: root/background/page_actions_server.js
diff options
context:
space:
mode:
Diffstat (limited to 'background/page_actions_server.js')
-rw-r--r--background/page_actions_server.js31
1 files changed, 9 insertions, 22 deletions
diff --git a/background/page_actions_server.js b/background/page_actions_server.js
index 58a0073..74783c9 100644
--- a/background/page_actions_server.js
+++ b/background/page_actions_server.js
@@ -1,5 +1,7 @@
/**
- * Hachette serving of page actions to content scripts
+ * This file is part of Haketilo.
+ *
+ * Function: Serving page actions to content scripts.
*
* Copyright (C) 2021 Wojtek Kosior
* Redistribution terms are gathered in the `copyright' file.
@@ -8,12 +10,12 @@
/*
* IMPORTS_START
* IMPORT get_storage
+ * IMPORT light_storage
* IMPORT TYPE_PREFIX
* IMPORT CONNECTION_TYPE
* IMPORT browser
* IMPORT listen_for_connection
* IMPORT sha256
- * IMPORT query_best
* IMPORT make_ajax_request
* IMPORTS_END
*/
@@ -21,23 +23,6 @@
var storage;
var handler;
-function send_actions(url, port)
-{
- const [pattern, settings] = query_best(storage, url);
- const repos = storage.get_all(TYPE_PREFIX.REPO);
-
- port.postMessage(["settings", [pattern, settings, repos]]);
-
- if (settings === undefined)
- return;
-
- let components = settings.components;
- let processed_bags = new Set();
-
- if (components !== undefined)
- send_scripts([components], port, processed_bags);
-}
-
// TODO: parallelize script fetching
async function send_scripts(components, port, processed_bags)
{
@@ -109,9 +94,11 @@ async function fetch_remote_script(script_data)
function handle_message(port, message, handler)
{
port.onMessage.removeListener(handler[0]);
- let url = message.url;
- console.log({url});
- send_actions(url, port);
+ console.debug(`Loading payload '${message.payload}'.`);
+
+ const processed_bags = new Set();
+
+ send_scripts([message.payload], port, processed_bags);
}
function new_connection(port)