diff --git a/apps/chrome-extension/e2e/overlay-ui.spec.ts b/apps/chrome-extension/e2e/overlay-ui.spec.ts index dc4a287ee86..c45910d9200 100644 --- a/apps/chrome-extension/e2e/overlay-ui.spec.ts +++ b/apps/chrome-extension/e2e/overlay-ui.spec.ts @@ -45,7 +45,7 @@ type ChromeGlobal = typeof globalThis & { }; const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const extensionPath = path.resolve(__dirname, "../dist"); +const extensionPath = path.resolve(__dirname, "../dist/chrome"); const SETTINGS_KEY = "cap-extension-settings"; const AUTH_KEY = "cap-extension-auth"; const BOOTSTRAP_CACHE_KEY = "cap-extension-bootstrap-cache"; diff --git a/apps/chrome-extension/e2e/recording-upload.spec.ts b/apps/chrome-extension/e2e/recording-upload.spec.ts index bec7fef5bec..7688b3f215e 100644 --- a/apps/chrome-extension/e2e/recording-upload.spec.ts +++ b/apps/chrome-extension/e2e/recording-upload.spec.ts @@ -55,7 +55,7 @@ type ChromeGlobal = typeof globalThis & { }; const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const extensionPath = path.resolve(__dirname, "../dist"); +const extensionPath = path.resolve(__dirname, "../dist/chrome"); const SETTINGS_KEY = "cap-extension-settings"; const AUTH_KEY = "cap-extension-auth"; const BOOTSTRAP_CACHE_KEY = "cap-extension-bootstrap-cache"; diff --git a/apps/chrome-extension/e2e/webcam-start.spec.ts b/apps/chrome-extension/e2e/webcam-start.spec.ts index 940cd39c0d9..b5cb1a5a6f8 100644 --- a/apps/chrome-extension/e2e/webcam-start.spec.ts +++ b/apps/chrome-extension/e2e/webcam-start.spec.ts @@ -34,7 +34,7 @@ type ChromeGlobal = typeof globalThis & { }; const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const extensionPath = path.resolve(__dirname, "../dist"); +const extensionPath = path.resolve(__dirname, "../dist/chrome"); const SETTINGS_KEY = "cap-extension-settings"; const AUTH_KEY = "cap-extension-auth"; const BOOTSTRAP_CACHE_KEY = "cap-extension-bootstrap-cache"; diff --git a/apps/chrome-extension/public/manifest.json b/apps/chrome-extension/manifests/manifest.chrome.json similarity index 100% rename from apps/chrome-extension/public/manifest.json rename to apps/chrome-extension/manifests/manifest.chrome.json diff --git a/apps/chrome-extension/manifests/manifest.firefox.json b/apps/chrome-extension/manifests/manifest.firefox.json new file mode 100644 index 00000000000..a61fa8b778b --- /dev/null +++ b/apps/chrome-extension/manifests/manifest.firefox.json @@ -0,0 +1,59 @@ +{ + "manifest_version": 3, + "name": "Cap - Screen Recorder & Screen Capture", + "short_name": "Cap", + "description": "Free, open source screen recorder. Capture your screen, camera & mic in Firefox and share a video link the moment you stop.", + "version": "1.0.2", + "homepage_url": "https://cap.so", + "browser_specific_settings": { + "gecko": { + "id": "extension@cap.so", + "strict_min_version": "128.0", + "data_collection_permissions": { + "required": ["authenticationInfo", "websiteContent"] + } + } + }, + "icons": { + "16": "icons/icon-16.png", + "32": "icons/icon-32.png", + "48": "icons/icon-48.png", + "128": "icons/icon-128.png" + }, + "action": { + "default_title": "Record your screen with Cap", + "default_icon": { + "16": "icons/icon-16.png", + "32": "icons/icon-32.png", + "48": "icons/icon-48.png", + "128": "icons/icon-128.png" + } + }, + "background": { + "scripts": ["assets/service-worker.js"], + "type": "module" + }, + "options_ui": { + "page": "options.html", + "open_in_tab": true + }, + "permissions": ["activeTab", "identity", "scripting", "storage"], + "host_permissions": ["http://*/*", "https://*/*", "file:///*"], + "content_scripts": [ + { + "matches": ["http://*/*", "https://*/*", "file:///*"], + "js": ["assets/content-bootstrap.js"], + "run_at": "document_idle" + } + ], + "web_accessible_resources": [ + { + "resources": ["icons/*", "content/overlay.js", "welcome.html"], + "matches": ["http://*/*", "https://*/*", "file:///*"] + }, + { + "resources": ["camera-preview.html", "popup.html"], + "matches": ["http://*/*", "https://*/*", "file:///*"] + } + ] +} diff --git a/apps/chrome-extension/package.json b/apps/chrome-extension/package.json index b77b2a3362b..3c63b68f80e 100644 --- a/apps/chrome-extension/package.json +++ b/apps/chrome-extension/package.json @@ -4,13 +4,18 @@ "private": true, "type": "module", "scripts": { - "build": "rm -rf dist && vite build && vite build --config vite.content.config.ts && vite build --config vite.content-overlay.config.ts", - "dev": "rm -rf dist && (trap 'kill 0' INT TERM; vite build --watch --config vite.content.config.ts --mode development & vite build --watch --config vite.content-overlay.config.ts --mode development & vite build --watch --mode development & wait)", + "build": "pnpm build:chrome && pnpm build:firefox", + "build:chrome": "rm -rf dist/chrome && TARGET=chrome vite build && TARGET=chrome vite build --config vite.content.config.ts && TARGET=chrome vite build --config vite.content-overlay.config.ts", + "build:firefox": "rm -rf dist/firefox && TARGET=firefox vite build && TARGET=firefox vite build --config vite.content.config.ts && TARGET=firefox vite build --config vite.content-overlay.config.ts", + "dev": "rm -rf dist/chrome && (trap 'kill 0' INT TERM; TARGET=chrome vite build --watch --config vite.content.config.ts --mode development & TARGET=chrome vite build --watch --config vite.content-overlay.config.ts --mode development & TARGET=chrome vite build --watch --mode development & wait)", + "dev:firefox": "rm -rf dist/firefox && (trap 'kill 0' INT TERM; TARGET=firefox vite build --watch --config vite.content.config.ts --mode development & TARGET=firefox vite build --watch --config vite.content-overlay.config.ts --mode development & TARGET=firefox vite build --watch --mode development & wait)", + "run:firefox": "web-ext run --source-dir dist/firefox", + "lint:firefox": "web-ext lint --source-dir dist/firefox", "typecheck": "tsc --noEmit", "test": "vitest run src", "test:e2e:install": "playwright install chromium", - "test:e2e": "pnpm build && playwright test", - "test:e2e:headed": "pnpm build && playwright test --headed" + "test:e2e": "pnpm build:chrome && playwright test", + "test:e2e:headed": "pnpm build:chrome && playwright test --headed" }, "dependencies": { "@cap/recorder-core": "workspace:*", @@ -36,6 +41,7 @@ "tailwindcss": "^3.4.0", "typescript": "^5.8.3", "vite": "6.3.5", - "vitest": "^3.2.0" + "vitest": "^3.2.0", + "web-ext": "^8.9.0" } } diff --git a/apps/chrome-extension/offscreen.html b/apps/chrome-extension/recorder.html similarity index 62% rename from apps/chrome-extension/offscreen.html rename to apps/chrome-extension/recorder.html index 07811d502c2..115b7fa7abd 100644 --- a/apps/chrome-extension/offscreen.html +++ b/apps/chrome-extension/recorder.html @@ -3,9 +3,9 @@
-