mirror of
https://github.com/JosunLP/BrowserExtensionTemplate.git
synced 2025-06-21 18:11:08 +00:00
fixing v2 conversion
This commit is contained in:
parent
56b73f1baa
commit
1c765be88f
1 changed files with 13 additions and 4 deletions
17
tools/v2.ts
17
tools/v2.ts
|
@ -10,8 +10,12 @@ manifest.background.scripts.push(manifest.background.service_worker)
|
|||
delete manifest.background.type
|
||||
delete manifest.background.service_worker
|
||||
manifest.background.persistent = true
|
||||
manifest.permissions += manifest.host_permissions
|
||||
manifest.permissions += manifest.optional_host_permissions
|
||||
if (manifest.host_permissions) {
|
||||
manifest.permissions.push(manifest.host_permissions)
|
||||
}
|
||||
if (manifest.optional_host_permissions) {
|
||||
manifest.permissions.push(manifest.optional_host_permissions)
|
||||
}
|
||||
delete manifest.host_permissions
|
||||
delete manifest.optional_host_permissions
|
||||
|
||||
|
@ -19,10 +23,10 @@ let newContentSecurityPolicy = ""
|
|||
|
||||
try {
|
||||
for (const policy of manifest.content_security_policy) {
|
||||
newContentSecurityPolicy += policy + " "
|
||||
newContentSecurityPolicy += policy.key + "'" + policy.value + "'" + " "
|
||||
}
|
||||
} catch (e) {
|
||||
newContentSecurityPolicy = ""
|
||||
newContentSecurityPolicy = "default-src 'self'"
|
||||
}
|
||||
|
||||
manifest.content_security_policy = newContentSecurityPolicy
|
||||
|
@ -33,4 +37,9 @@ try {
|
|||
manifest.web_accessible_resources = []
|
||||
}
|
||||
|
||||
if (manifest.action) {
|
||||
manifest.browser_action = manifest.action
|
||||
}
|
||||
delete manifest.action
|
||||
|
||||
fs.writeFileSync('./dist/manifest.json', JSON.stringify(manifest, null, 2));
|
Loading…
Add table
Reference in a new issue