mirror of
https://github.com/JosunLP/BrowserExtensionTemplate.git
synced 2025-10-14 16:10:10 +00:00
feat: Implement ErrorBoundary class for global error handling
feat: Refactor Session class to use LocalStorageService for session management feat: Enhance BasicButton component with configuration options and event handling style: Update SASS variables to CSS custom properties for better theming support style: Modify app.sass to include Bootstrap with legacy import chore: Update settings.ts to handle session initialization and error notifications fix: Improve buttonType definition for better readability chore: Refactor parse.ts for cleaner file handling and keyword replacement chore: Enhance syncConfig.ts with TypeScript interfaces and async file operations chore: Update v2.ts to modify manifest.json for compatibility with manifest version 2 chore: Revise tsconfig.json for stricter type checking and improved module resolution chore: Refactor vite.config.ts for better build configuration and asset management
This commit is contained in:
parent
8f99895c88
commit
482151f980
24 changed files with 1321 additions and 418 deletions
40
tools/v2.ts
40
tools/v2.ts
|
@ -3,44 +3,44 @@ const fs = require('fs');
|
|||
|
||||
const manifest = JSON.parse(fs.readFileSync('./dist/manifest.json', 'utf8'));
|
||||
|
||||
manifest.manifest_version = 2
|
||||
manifest.manifest_version = 2;
|
||||
|
||||
manifest.background.scripts = []
|
||||
manifest.background.scripts = [];
|
||||
|
||||
manifest.background.scripts.push(manifest.background.service_worker)
|
||||
delete manifest.background.type
|
||||
delete manifest.background.service_worker
|
||||
manifest.background.persistent = true
|
||||
manifest.background.scripts.push(manifest.background.service_worker);
|
||||
delete manifest.background.type;
|
||||
delete manifest.background.service_worker;
|
||||
manifest.background.persistent = true;
|
||||
if (manifest.host_permissions) {
|
||||
manifest.permissions.push(manifest.host_permissions)
|
||||
manifest.permissions.push(manifest.host_permissions);
|
||||
}
|
||||
if (manifest.optional_host_permissions) {
|
||||
manifest.permissions.push(manifest.optional_host_permissions)
|
||||
manifest.permissions.push(manifest.optional_host_permissions);
|
||||
}
|
||||
delete manifest.host_permissions
|
||||
delete manifest.optional_host_permissions
|
||||
delete manifest.host_permissions;
|
||||
delete manifest.optional_host_permissions;
|
||||
|
||||
let newContentSecurityPolicy = ""
|
||||
let newContentSecurityPolicy = '';
|
||||
|
||||
try {
|
||||
for (const policy of manifest.content_security_policy) {
|
||||
newContentSecurityPolicy += policy.key + "'" + policy.value + "'" + " "
|
||||
}
|
||||
for (const policy of manifest.content_security_policy) {
|
||||
newContentSecurityPolicy += policy.key + "'" + policy.value + "'" + ' ';
|
||||
}
|
||||
} catch (e) {
|
||||
newContentSecurityPolicy = "default-src 'self'"
|
||||
newContentSecurityPolicy = "default-src 'self'";
|
||||
}
|
||||
|
||||
manifest.content_security_policy = newContentSecurityPolicy
|
||||
manifest.content_security_policy = newContentSecurityPolicy;
|
||||
|
||||
try {
|
||||
manifest.web_accessible_resources = manifest.web_accessible_resources.resources
|
||||
manifest.web_accessible_resources = manifest.web_accessible_resources.resources;
|
||||
} catch (e) {
|
||||
manifest.web_accessible_resources = []
|
||||
manifest.web_accessible_resources = [];
|
||||
}
|
||||
|
||||
if (manifest.action) {
|
||||
manifest.browser_action = manifest.action
|
||||
manifest.browser_action = manifest.action;
|
||||
}
|
||||
delete manifest.action
|
||||
delete manifest.action;
|
||||
|
||||
fs.writeFileSync('./dist/manifest.json', JSON.stringify(manifest, null, 2));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue