diff options
author | Ruben Rodriguez <ruben@trisquel.info> | 2022-09-08 20:18:54 -0400 |
---|---|---|
committer | Ruben Rodriguez <ruben@trisquel.info> | 2022-09-08 20:18:54 -0400 |
commit | 5da28b0f8771834ae208d61431d632875e9f8e7d (patch) | |
tree | 688ecaff26197bad8abde617b4947b11d617309e /data/extensions/jid1-KtlZuoiikVfFew@jetpack/common/Storage.js | |
parent | 4a87716686104266a9cccc2d83cc249e312f3673 (diff) |
Updated extensions:
* Upgraded Privacy Redirect to 1.1.49 and configured to use the 10 most reliable invidious instances
* Removed ViewTube
* Added torproxy@icecat.gnu based on 'Proxy toggle' extension
* Added jShelter 0.11.1
* Upgraded LibreJS to 7.21.0
* Upgraded HTTPS Everywhere to 2021.7.13
* Upgraded SubmitMe to 1.9
Diffstat (limited to 'data/extensions/jid1-KtlZuoiikVfFew@jetpack/common/Storage.js')
-rw-r--r-- | data/extensions/jid1-KtlZuoiikVfFew@jetpack/common/Storage.js | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/common/Storage.js b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/common/Storage.js index 62b7b19..6254d66 100644 --- a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/common/Storage.js +++ b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/common/Storage.js @@ -23,7 +23,7 @@ A tiny wrapper around extensions storage API, supporting CSV serialization for retro-compatibility */ -"use strict"; +'use strict'; var Storage = { ARRAY: { @@ -34,7 +34,7 @@ var Storage = { return array ? new Set(array) : new Set(); }, async save(key, list) { - return await browser.storage.local.set({[key]: [...list]}); + return await browser.storage.local.set({ [key]: [...list] }); }, }, @@ -45,7 +45,7 @@ var Storage = { }, async save(key, list) { - return await browser.storage.local.set({[key]: [...list].join(",")}); + return await browser.storage.local.set({ [key]: [...list].join(',') }); } } }; @@ -68,20 +68,20 @@ class ListStore { static inlineItem(url) { // here we simplify and hash inline script references - return url.startsWith("inline:") ? url - : url.startsWith("view-source:") - && url.replace(/^view-source:[\w-+]+:\/+([^/]+).*#line\d+/,"inline://$1#") - .replace(/\n[^]*/, s => s.replace(/\s+/g, ' ').substring(0, 16) + "…" + hash(s.trim())); + return url.startsWith('inline:') ? url + : url.startsWith('view-source:') + && url.replace(/^view-source:[\w-+]+:\/+([^/]+).*#line\d+/, 'inline://$1#') + .replace(/\n[^]*/, s => s.replace(/\s+/g, ' ').substring(0, 16) + '…' + hash(s.trim())); } static hashItem(hash) { - return hash.startsWith("(") ? hash : `(${hash})`; + return hash.startsWith('(') ? hash : `(${hash})`; } static urlItem(url) { - let queryPos = url.indexOf("?"); + let queryPos = url.indexOf('?'); return queryPos === -1 ? url : url.substring(0, queryPos); } static siteItem(url) { - if (url.endsWith("/*")) return url; + if (url.endsWith('/*')) return url; try { return `${new URL(url).origin}/*`; } catch (e) { @@ -133,13 +133,13 @@ class ListStore { } } -function hash(source){ - var shaObj = new jssha("SHA-256","TEXT") - shaObj.update(source); - return shaObj.getHash("HEX"); +function hash(source) { + var shaObj = new jssha('SHA-256', 'TEXT') + shaObj.update(source); + return shaObj.getHash('HEX'); } -if (typeof module === "object") { +if (typeof module === 'object') { module.exports = { ListStore, Storage, hash }; var jssha = require('jssha'); } |