Social Annotations in the Atmosphere
1import { defineConfig } from 'wxt';
2import { injectOauthEnvForExtension } from './scripts/inject-oauth-plugin';
3
4export default defineConfig({
5 hooks: {
6 'build:manifestGenerated': (wxt, manifest) => {
7 // Add default_icon to sidebar_action for Firefox
8 if (wxt.config.browser === 'firefox' && manifest.sidebar_action) {
9 manifest.sidebar_action.default_icon = {
10 "16": "icon-16.png",
11 "32": "icon-32.png",
12 };
13 }
14 },
15 },
16 manifest: (env) => ({
17 name: 'Seams',
18 description: 'Web annotations on AT Protocol',
19 // Include key for development, but exclude for production Chrome Web Store upload
20 ...(env.browser === 'chrome' && env.mode !== 'production' && {
21 key: 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyv6hsV+VmGtQB8kZFQE0x0VYvhH0Lq2GzDhKZHh9BvPZLmFJQjXqzD9K0UzXxMXBj8FqV3WEJ9xFzDqJc+hKRBqJFQp0vXYrG8hVLVsqxW2wYpF1K8ZqMH3J0V2VB9C3KxvqBJk9kQxqHj8BvXJFqVQ3E5VqJzYqK0Hh9vK0E2J1YxLqJ8kV9qBxV0E1J2V3kQxqFz8B1XJFqVQ3E5VqJzYqK0Hh9vK0E2J1YxLqJ8kV9qBxV0E1J2V3kQxqFz8B1XJFqVQ3E5VqJzYqK0Hh9vK0E2J1YxLqJ8kV9qBxV0E1J2V3kQxqFz8B1XJFqVQ3E5VqJzYqK0Hh9vK0E2J1YxLqJ8kV9qBxV0E1J2V3kQxqFQIDAQAB',
22 }),
23 ...(env.browser === 'firefox' && {
24 browser_specific_settings: {
25 gecko: {
26 id: 'synthesis@seams.so',
27 data_collection_permissions: {
28 required: ['websiteContent'],
29 optional: [],
30 },
31 },
32 },
33 developer: {
34 name: "Seams",
35 url: "https://seams.so",
36 },
37 // Note: sidebar_action.default_icon is added via build:manifestGenerated hook
38 // because WXT overwrites the sidebar_action from the sidepanel entrypoint
39 }),
40 permissions: [
41 'storage',
42 'tabs',
43 'activeTab',
44 'identity',
45 'webNavigation',
46 ...(env.browser === 'chrome' ? ['sidePanel'] : ['menus']),
47 ],
48 host_permissions: ['<all_urls>', 'https://seams.so/*'],
49 // Note: content_scripts are auto-generated by WXT from entrypoints/content.ts
50 // Do NOT manually define them here or they will be duplicated
51 action: {
52 default_title: 'Open Seams',
53 },
54 web_accessible_resources: [
55 {
56 resources: ['extension-callback.html'],
57 matches: ['<all_urls>'],
58 },
59 ],
60 }),
61 vite: (env) => ({
62 plugins: [injectOauthEnvForExtension(env.browser)],
63 define: {
64 'import.meta.env.BACKEND_URL': JSON.stringify(
65 process.env.BACKEND_URL || (env.mode === 'production' ? 'https://seams.so' : 'http://localhost:8080')
66 ),
67 },
68 }),
69 runner: {
70 disabled: false,
71 },
72});