diff options
author | jahoti <jahoti@tilde.team> | 2021-12-03 00:00:00 +0000 |
---|---|---|
committer | jahoti <jahoti@tilde.team> | 2021-12-03 00:00:00 +0000 |
commit | d16e763e240a2aefe3d4490cddff61893a35a1ea (patch) | |
tree | 1e90890a39798f6cd9a1c0886d1234ccc187f5b3 /background/page_actions_server.js | |
parent | 591c48a6903bbf324361610f81c628302cae7049 (diff) | |
parent | 93dd73600e91eb19e11f5ca57f9429a85cf0150f (diff) | |
download | browser-extension-d16e763e240a2aefe3d4490cddff61893a35a1ea.tar.gz browser-extension-d16e763e240a2aefe3d4490cddff61893a35a1ea.zip |
Merge branch 'koszko' into jahoti
Diffstat (limited to 'background/page_actions_server.js')
-rw-r--r-- | background/page_actions_server.js | 31 |
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) |