summaryrefslogtreecommitdiff
path: root/background
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2021-08-06 17:17:45 +0200
committerWojtek Kosior <koszko@koszko.org>2021-08-06 17:17:45 +0200
commit792fbe187bdffca4a748e88d66ea29f8936ae5c8 (patch)
tree5ccc504bd06cbae6bba12bc4f2e060fa2ad96ec3 /background
parent90896bcfeb4e55c78d9a15700a6a4580f0df6365 (diff)
downloadbrowser-extension-792fbe187bdffca4a748e88d66ea29f8936ae5c8.tar.gz
browser-extension-792fbe187bdffca4a748e88d66ea29f8936ae5c8.zip
Facilitate installation of scripts from the repository
This commit includes: * removal of page_info_server * running of storage client in popup context * extraction of some common CSS to a separate file * extraction of scripts import view to a separate file * addition of a facility to conveniently clone complex structures from DOM (in DOM_helpers.js) * addition of hydrilla repo url to default settings * other minor changes and of course changes related to the actual installation of scripts from the repo
Diffstat (limited to 'background')
-rw-r--r--background/main.js2
-rw-r--r--background/page_info_server.js72
2 files changed, 0 insertions, 74 deletions
diff --git a/background/main.js b/background/main.js
index ffa814e..7c50fd5 100644
--- a/background/main.js
+++ b/background/main.js
@@ -12,7 +12,6 @@
* IMPORT start_storage_server
* IMPORT start_page_actions_server
* IMPORT start_policy_injector
- * IMPORT start_page_info_server
* IMPORT browser
* IMPORTS_END
*/
@@ -20,7 +19,6 @@
start_storage_server();
start_page_actions_server();
start_policy_injector();
-start_page_info_server();
async function init_ext(install_details)
{
diff --git a/background/page_info_server.js b/background/page_info_server.js
deleted file mode 100644
index e915011..0000000
--- a/background/page_info_server.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * part of Hachette
- * Serving of storage data corresponding to requested urls (server side).
- *
- * Copyright (C) 2021 Wojtek Kosior
- * Redistribution terms are gathered in the `copyright' file.
- */
-
-/*
- * IMPORTS_START
- * IMPORT listen_for_connection
- * IMPORT get_storage
- * IMPORT query_all
- * IMPORT TYPE_PREFIX
- * IMPORT CONNECTION_TYPE
- * IMPORT url_matches
- * IMPORTS_END
- */
-
-var storage;
-
-function handle_change(connection_data, change)
-{
- if (change.prefix !== TYPE_PREFIX.PAGE)
- return;
-
- connection_data.port.postMessage(["change", change]);
-}
-
-async function handle_subscription(connection_data, message)
-{
- const [action, url] = message;
- if (action === "unsubscribe") {
- connection_data.subscribed.delete(url);
- return;
- }
-
- connection_data.subscribed.add(url);
- connection_data.port.postMessage(["new_url", query_all(storage, url)]);
-}
-
-function new_connection(port)
-{
- console.log("new page info connection!");
-
- const connection_data = {
- subscribed : new Set(),
- port
- };
-
- let _handle_change = change => handle_change(connection_data, change);
-
- storage.add_change_listener(_handle_change);
-
- port.onMessage.addListener(m => handle_subscription(connection_data, m));
- port.onDisconnect.addListener(
- () => storage.remove_change_listener(_handle_change)
- );
-}
-
-async function start_page_info_server()
-{
- storage = await get_storage();
-
- listen_for_connection(CONNECTION_TYPE.PAGE_INFO, new_connection);
-}
-
-/*
- * EXPORTS_START
- * EXPORT start_page_info_server
- * EXPORTS_END
- */