77 lines
2.1 KiB
JavaScript
77 lines
2.1 KiB
JavaScript
const sharedIcons = {
|
|
16: "assets/icons/icon-16.png",
|
|
32: "assets/icons/icon-32.png",
|
|
48: "assets/icons/icon-48.png",
|
|
128: "assets/icons/icon-128.png"
|
|
};
|
|
const extensionKey =
|
|
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0CaZJxcX97TbRXCR08L10t9EZFV31+wPnUgDf21j2f0qYaWdblzWXfVkeU9jGb2Hr2Etpp7F/XuBa6pcipUXkzMMBkJ42KOkciAwbuzTBoAtGB8o9aoWigtax+gGfSz+T3BjqxKBJtXqeqbIAKCDIlxRKIrY+KcY1Z+mD5BKcBHKsUDQPlHsrjc1g0wIBD5doz9LoOk1Wso6gK5cSeOp9lw5YHcu4TImR4yqxGiL6pZwnpciuX/g7qjWBZXn5gf0YBlDsBDDTt5upbP3NguUKgO2qA9M77LyeUwXl3aqbIxYi/VwsQ2t5w9PGWtnOUQQDWUcEg/9dfTb89esZXKATwIDAQAB";
|
|
|
|
const sharedManifest = {
|
|
action: {
|
|
default_icon: {
|
|
16: sharedIcons[16],
|
|
32: sharedIcons[32]
|
|
},
|
|
default_popup: "popup/index.html"
|
|
},
|
|
background: {
|
|
service_worker: "background/index.js"
|
|
},
|
|
content_scripts: [
|
|
{
|
|
js: ["content/index.js"],
|
|
matches: [
|
|
"https://xingtu.cn/ad/creator/market*",
|
|
"https://*.xingtu.cn/ad/creator/market*"
|
|
],
|
|
run_at: "document_start"
|
|
}
|
|
],
|
|
description: "Bootstraps the Xingtu creator market content script.",
|
|
icons: sharedIcons,
|
|
key: extensionKey,
|
|
manifest_version: 3,
|
|
name: "Star Chart Search Enhancer",
|
|
permissions: ["downloads", "identity", "storage"],
|
|
version: "0.2.0421.2",
|
|
web_accessible_resources: [
|
|
{
|
|
matches: [
|
|
"https://xingtu.cn/*",
|
|
"https://*.xingtu.cn/*"
|
|
],
|
|
resources: ["content/market-page-bridge.js"]
|
|
}
|
|
]
|
|
};
|
|
|
|
const hostPermissionsByTarget = {
|
|
development: [
|
|
"http://*/*",
|
|
"https://login-api.intelligrow.cn/*",
|
|
"http://127.0.0.1:4319/*",
|
|
"https://*/*"
|
|
],
|
|
release: [
|
|
"https://xingtu.cn/ad/creator/market*",
|
|
"https://*.xingtu.cn/ad/creator/market*",
|
|
"https://login-api.intelligrow.cn/*",
|
|
"https://talent-search.intelligrow.cn/*",
|
|
"http://192.168.31.21:8083/*"
|
|
]
|
|
};
|
|
|
|
export function createManifest(options = {}) {
|
|
const target = options.target ?? "development";
|
|
const hostPermissions = hostPermissionsByTarget[target];
|
|
if (!hostPermissions) {
|
|
throw new Error(`Unsupported manifest target: ${target}`);
|
|
}
|
|
|
|
return {
|
|
...sharedManifest,
|
|
host_permissions: hostPermissions
|
|
};
|
|
}
|