mirror of
https://github.com/primedigitaltech/azon_seeker.git
synced 2026-10-05 15:22:59 +08:00
* feat: add Amazon collection metadata and reliable sync * fix: route extension sync through configured server * chore: release extension v0.7.13 * fix: handle extension ports across BFCache navigation * fix: classify bottom Sponsored Brands video placements * fix: exclude hidden Amazon ad cards * fix: derive Amazon result page from URL * fix: ignore hidden Amazon sponsored products * fix: preserve base Amazon product collection * fix: bind Amazon results to visible page * fix: classify visible Amazon ad formats * fix: wait for lazy Amazon ad modules * perf: reduce Amazon lazy-load scroll stops * fix: classify Amazon sponsored brand and video search ads Co-authored-by: Cursor <cursoragent@cursor.com> * fix: collect Shop by type thematic SP ads via redirect chains without data-asin Co-authored-by: Cursor <cursoragent@cursor.com> * fix: classify sponsored ads across new Amazon templates --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: PetrichorFun <127877748+PetrichorFun@users.noreply.github.com>
116 lines
3.0 KiB
TypeScript
116 lines
3.0 KiB
TypeScript
import fs from 'fs-extra';
|
|
import { isDev, isFirefox, log, outputDir, port, r } from './utils.js';
|
|
import { type Manifest } from 'webextension-polyfill';
|
|
import type PkgType from '../package.json';
|
|
|
|
async function getManifest() {
|
|
const pkg = (await fs.readJSON(r('package.json'))) as typeof PkgType;
|
|
|
|
// update this file to update this manifest.json
|
|
// can also be conditional based on your need
|
|
const manifest: Manifest.WebExtensionManifest = {
|
|
manifest_version: isFirefox ? 2 : 3,
|
|
name: pkg.displayName || pkg.name,
|
|
version: pkg.version,
|
|
description: pkg.description,
|
|
options_ui: {
|
|
page: './dist/options/index.html',
|
|
open_in_tab: true,
|
|
},
|
|
background: isFirefox
|
|
? {
|
|
scripts: ['dist/background/index.mjs'],
|
|
type: 'module',
|
|
}
|
|
: {
|
|
service_worker: './dist/background/index.mjs',
|
|
},
|
|
icons: {
|
|
16: './assets/icon-512.png',
|
|
48: './assets/icon-512.png',
|
|
128: './assets/icon-512.png',
|
|
},
|
|
permissions: [
|
|
'tabs',
|
|
'storage',
|
|
'activeTab',
|
|
'scripting',
|
|
'unlimitedStorage',
|
|
'contextMenus',
|
|
'alarms',
|
|
],
|
|
content_security_policy: {
|
|
extension_pages: isDev
|
|
? `script-src \'self\' http://localhost:${port}; object-src \'self\';`
|
|
: "script-src 'self'; object-src 'self'",
|
|
},
|
|
};
|
|
|
|
// add extension action icon
|
|
if (!isFirefox) {
|
|
manifest.action = {
|
|
default_icon: './assets/icon-512.png',
|
|
};
|
|
}
|
|
|
|
// add host permissions
|
|
if (isFirefox) {
|
|
manifest.permissions?.push('*://*/*');
|
|
} else {
|
|
manifest.host_permissions = ['*://*/*'];
|
|
}
|
|
|
|
// add content security policy
|
|
if (isFirefox) {
|
|
manifest.content_security_policy = isDev
|
|
? `script-src 'self' http://localhost:${port}; object-src 'self';`
|
|
: `script-src 'self'; object-src 'self';`;
|
|
} else {
|
|
manifest.content_security_policy = {
|
|
extension_pages: isDev
|
|
? `script-src 'self' http://localhost:${port}; object-src 'self';`
|
|
: "script-src 'self'; object-src 'self'",
|
|
};
|
|
}
|
|
|
|
// add content scripts
|
|
manifest.content_scripts = [
|
|
{
|
|
matches: ['<all_urls>'],
|
|
js: ['dist/contentScripts/index.global.js'],
|
|
},
|
|
];
|
|
manifest.web_accessible_resources = isFirefox
|
|
? ['dist/contentScripts/index.css']
|
|
: [
|
|
{
|
|
resources: ['dist/contentScripts/index.css'],
|
|
matches: ['<all_urls>'],
|
|
},
|
|
];
|
|
|
|
// add sidepanel
|
|
if (isFirefox) {
|
|
manifest.sidebar_action = {
|
|
default_panel: 'dist/sidepanel/index.html',
|
|
};
|
|
} else {
|
|
// the sidebar_action does not work for chromium based
|
|
(manifest as any).side_panel = {
|
|
default_path: 'dist/sidepanel/index.html',
|
|
};
|
|
manifest.permissions?.push('sidePanel');
|
|
}
|
|
|
|
return manifest;
|
|
}
|
|
|
|
export async function writeManifest() {
|
|
await fs.writeJSON(r(`${outputDir}/manifest.json`), await getManifest(), {
|
|
spaces: 2,
|
|
});
|
|
log('PRE', 'write manifest.json');
|
|
}
|
|
|
|
writeManifest();
|