Skip to content

Commit

Permalink
fix: safari webAccessibleResources
Browse files Browse the repository at this point in the history
  • Loading branch information
kvhnuke committed Feb 13, 2025
1 parent 9db5445 commit 378db53
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 65 deletions.
13 changes: 10 additions & 3 deletions packages/extension/configs/vite/transform-manifest.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
import { CrxPlugin } from '@crxjs/vite-plugin';

function transFormManifest(): CrxPlugin {
const MATCHING_PROTOCOLS = ['file://*/*', 'http://*/*', 'https://*/*'].filter(
fname => {
if (fname === 'file://*/*' && process.env.BROWSER === 'safari')
return false;
return true;
},
);
return {
name: 'crx:enkrypt:transform-manifest',
enforce: 'post',
renderCrxManifest(manifest) {
manifest.content_scripts = [
{
matches: ['file://*/*', 'http://*/*', 'https://*/*'],
matches: MATCHING_PROTOCOLS,
js: ['scripts/contentscript.js'],
run_at: 'document_start',
all_frames: false,
Expand All @@ -20,7 +27,7 @@ function transFormManifest(): CrxPlugin {
] as any;
if (process.env.BROWSER !== 'opera' && process.env.BROWSER !== 'safari') {
manifest.content_scripts?.push({
matches: ['file://*/*', 'http://*/*', 'https://*/*'],
matches: MATCHING_PROTOCOLS,
js: ['scripts/inject.js'],
run_at: 'document_start',
all_frames: false,
Expand All @@ -42,7 +49,7 @@ function transFormManifest(): CrxPlugin {
'scripts/*.js.map',
],
use_dynamic_url: false,
matches: ['file://*/*', 'http://*/*', 'https://*/*'],
matches: MATCHING_PROTOCOLS,
});
return manifest;
},
Expand Down
2 changes: 1 addition & 1 deletion packages/extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@enkryptcom/extension",
"version": "2.3.0",
"version": "2.3.1",
"private": true,
"type": "module",
"scripts": {
Expand Down
58 changes: 0 additions & 58 deletions packages/extension/src/manifest/manifest-safari.json

This file was deleted.

6 changes: 3 additions & 3 deletions packages/extension/src/manifest/manifest.safari.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defineManifest, ManifestV3Export } from '@crxjs/vite-plugin';
import { chromeManifest } from './manifest.chrome';
const operaManifest = {
const safariManifest = {
...chromeManifest,
action: {
default_icon: {
Expand All @@ -16,7 +16,7 @@ const operaManifest = {
default_title: 'Enkrypt',
default_popup: 'action.html',
},
host_permissions: ['file://*/*', 'http://*/*', 'https://*/*'],
host_permissions: ['http://*/*', 'https://*/*'],
permissions: [
'storage',
'unlimitedStorage',
Expand All @@ -27,4 +27,4 @@ const operaManifest = {
],
} as ManifestV3Export;

export default defineManifest(operaManifest);
export default defineManifest(safariManifest);

0 comments on commit 378db53

Please sign in to comment.