Skip to content

Commit

Permalink
Implement managed storage
Browse files Browse the repository at this point in the history
  • Loading branch information
AliasIO committed Aug 9, 2023
1 parent a7b0e77 commit 58d1dac
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/drivers/webextension/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@ const Utils = {
*/
async getOption(name, defaultValue = null) {
try {
try {
const managed = await Utils.promisify(
chrome.storage.managed,
'get',
name
)

if (managed[name] !== undefined) {
return managed[name]
}
} catch {
// Continue
}

const option = await Utils.promisify(chrome.storage.local, 'get', name)

if (option[name] !== undefined) {
Expand Down
8 changes: 7 additions & 1 deletion src/drivers/webextension/manifest-v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,11 @@
"optional_permissions": [
"downloads"
],
"content_security_policy": "script-src 'self'; object-src 'self'"
"content_security_policy": "script-src 'self'; object-src 'self'",
"browser_specific_settings": {
"gecko": {
"id": "wappalyzer@crunchlabz.com",
"strict_min_version": "42.0"
}
}
}
3 changes: 3 additions & 0 deletions src/drivers/webextension/manifest-v3.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,8 @@
],
"content_security_policy": {
"extension_pages": "script-src 'self'; object-src 'self'"
},
"storage": {
"managed_schema": "schema.json"
}
}
10 changes: 10 additions & 0 deletions src/drivers/webextension/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"type": "object",
"properties": {
"tracking": {
"title": "Tracking enabled",
"description": "Anonymously send identified technologies to wappalyzer.com",
"type": "boolean"
}
}
}

0 comments on commit 58d1dac

Please sign in to comment.