diff --git a/source/assets/re-nav.png b/source/assets/re-nav.png new file mode 100644 index 0000000..9dacba0 Binary files /dev/null and b/source/assets/re-nav.png differ diff --git a/source/assets/re-nav.svg b/source/assets/re-nav.svg new file mode 100644 index 0000000..f7d5700 --- /dev/null +++ b/source/assets/re-nav.svg @@ -0,0 +1,16 @@ + + + + + ↩ + + diff --git a/source/manifest.ts b/source/manifest.ts new file mode 100644 index 0000000..5f123d1 --- /dev/null +++ b/source/manifest.ts @@ -0,0 +1,45 @@ +/* eslint-disable @typescript-eslint/naming-convention */ + +export default function createManifest( + target: string, +): Record { + const manifest: Record = { + name: 're-nav', + description: 'Navigation redirects for the masses.', + version: '0.1.0', + permissions: ['storage', 'webNavigation'], + options_ui: { + page: 'options/index.html', + open_in_tab: true, + }, + }; + + const icons = { + 128: 'assets/re-nav.png', + }; + + manifest.icons = icons; + + const browserAction = { + default_icon: icons, + }; + + const backgroundScript = 'background-scripts/initialize.ts'; + + if (target === 'chromium') { + manifest.manifest_version = 3; + manifest.action = browserAction; + manifest.background = { + service_worker: backgroundScript, + type: 'module', + }; + } else { + manifest.manifest_version = 2; + manifest.browser_action = browserAction; + manifest.background = { + scripts: [backgroundScript], + }; + } + + return manifest; +} diff --git a/source/types.d.ts b/source/types.d.ts new file mode 100644 index 0000000..17d41e9 --- /dev/null +++ b/source/types.d.ts @@ -0,0 +1,20 @@ +import {html} from 'htm/preact'; + +declare global { + // See Vite documentation for `import.meta.env` usage. + // https://vitejs.dev/guide/env-and-mode.html + + interface ImportMeta { + readonly env: ImportMetaEnv; + } + + interface ImportMetaEnv { + readonly BASE_URL: string; + readonly DEV: boolean; + readonly MODE: string; + readonly PROD: boolean; + readonly VITE_BROWSER: 'chromium' | 'firefox'; + } + + type HtmComponent = ReturnType; +}