2022-10-05 11:09:52 +00:00
|
|
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
|
|
|
|
|
|
export default function createManifest(
|
|
|
|
target: string,
|
|
|
|
): Record<string, unknown> {
|
|
|
|
const manifest: Record<string, unknown> = {
|
2022-11-02 12:05:48 +00:00
|
|
|
name: 'Re-Nav',
|
2022-10-05 11:09:52 +00:00
|
|
|
description: 'Navigation redirects for the masses.',
|
2022-11-16 11:27:01 +00:00
|
|
|
version: '0.2.0',
|
2022-11-15 11:46:10 +00:00
|
|
|
permissions: ['contextMenus', 'storage', 'tabs', 'webNavigation'],
|
2022-10-05 11:09:52 +00:00
|
|
|
options_ui: {
|
|
|
|
page: 'options/index.html',
|
|
|
|
open_in_tab: true,
|
|
|
|
},
|
2022-11-21 12:25:00 +00:00
|
|
|
commands: {
|
|
|
|
toggleAllRedirects: {
|
|
|
|
description:
|
|
|
|
"Toggle all redirects, this does the same as the extension icon's right-click option.",
|
|
|
|
suggested_key: {
|
|
|
|
default: 'Alt+Shift+R',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2022-10-05 11:09:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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],
|
|
|
|
};
|
2022-11-02 12:10:12 +00:00
|
|
|
manifest.applications = {
|
|
|
|
gecko: {
|
|
|
|
id: '{2dd6149a-403e-4e67-9cf8-5fe64e16c909}',
|
|
|
|
},
|
|
|
|
};
|
2022-10-05 11:09:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return manifest;
|
|
|
|
}
|