diff options
author | Wojtek Kosior <koszko@koszko.org> | 2021-08-06 17:17:45 +0200 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2021-08-06 17:17:45 +0200 |
commit | 792fbe187bdffca4a748e88d66ea29f8936ae5c8 (patch) | |
tree | 5ccc504bd06cbae6bba12bc4f2e060fa2ad96ec3 /common/misc.js | |
parent | 90896bcfeb4e55c78d9a15700a6a4580f0df6365 (diff) | |
download | browser-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 'common/misc.js')
-rw-r--r-- | common/misc.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/common/misc.js b/common/misc.js index a59ec14..7158d32 100644 --- a/common/misc.js +++ b/common/misc.js @@ -12,6 +12,7 @@ * IMPORT browser * IMPORT is_chrome * IMPORT TYPE_NAME + * IMPORT TYPE_PREFIX * IMPORTS_END */ @@ -154,6 +155,18 @@ function sign_policy(policy, now, hours_offset) { return gen_unique(time + policy); } +/* Regexes and objest to use as/in schemas for parse_json_with_schema(). */ +const nonempty_string_matcher = /.+/; + +const matchers = { + sha256: /^[0-9a-f]{64}$/, + nonempty_string: nonempty_string_matcher, + component: [ + new RegExp(`^[${TYPE_PREFIX.SCRIPT}${TYPE_PREFIX.BAG}]$`), + nonempty_string_matcher + ] +}; + /* * EXPORTS_START * EXPORT gen_nonce @@ -165,5 +178,6 @@ function sign_policy(policy, now, hours_offset) { * EXPORT nice_name * EXPORT open_in_settings * EXPORT is_privileged_url + * EXPORT matchers * EXPORTS_END */ |