脚本注入逻辑
Some checks failed
test / Run tests (push) Failing after 7s
build / Build (push) Failing after 10s
Some checks failed
test / Run tests (push) Failing after 7s
build / Build (push) Failing after 10s
This commit is contained in:
parent
eea3b43e0b
commit
9ce1826a34
@ -183,9 +183,9 @@ export class RuntimeService {
|
|||||||
if (script.metadata["exclude-match"]) {
|
if (script.metadata["exclude-match"]) {
|
||||||
const excludeMatches = script.metadata["exclude-match"];
|
const excludeMatches = script.metadata["exclude-match"];
|
||||||
excludeMatches.push(...(script.metadata["exclude"] || []));
|
excludeMatches.push(...(script.metadata["exclude"] || []));
|
||||||
const result= dealPatternMatches(excludeMatches);
|
const result = dealPatternMatches(excludeMatches);
|
||||||
|
|
||||||
registerScript.excludeMatches =result.patternResult;
|
registerScript.excludeMatches = result.patternResult;
|
||||||
}
|
}
|
||||||
if (script.metadata["run-at"]) {
|
if (script.metadata["run-at"]) {
|
||||||
registerScript.runAt = getRunAt(script.metadata["run-at"]);
|
registerScript.runAt = getRunAt(script.metadata["run-at"]);
|
||||||
@ -194,25 +194,6 @@ export class RuntimeService {
|
|||||||
// 标记为已注册
|
// 标记为已注册
|
||||||
Cache.getInstance().set("registryScript:" + script.uuid, true);
|
Cache.getInstance().set("registryScript:" + script.uuid, true);
|
||||||
});
|
});
|
||||||
console.log(registerScript);
|
|
||||||
// 把脚本信息注入到USER_SCRIPT环境中
|
|
||||||
chrome.userScripts.register([
|
|
||||||
{
|
|
||||||
id: "scriptinfo-" + scriptRes.uuid,
|
|
||||||
js: [
|
|
||||||
{
|
|
||||||
code: compileInjectScriptInfo(
|
|
||||||
await this.messageFlag(),
|
|
||||||
scriptRes,
|
|
||||||
await (await fetch("inject_script_info.js")).text()
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
matches: dealPatternMatches(matches),
|
|
||||||
runAt: "document_start",
|
|
||||||
world: "USER_SCRIPT",
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unregistryPageScript(script: Script) {
|
unregistryPageScript(script: Script) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user