Skip to content

Commit

Permalink
🐛 修复GM.*兼容问题 #274
Browse files Browse the repository at this point in the history
  • Loading branch information
CodFrm committed May 1, 2024
1 parent c69c208 commit 389e6d2
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/runtime/background/permission_verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,20 @@ export default class PermissionVerify {
api: descriptor.value,
param,
});
// 兼容GM.*
const dot = key.replace("_", ".");
if (dot !== key) {
PermissionVerify.apis.set(dot, {
api: descriptor.value,
param,
});
if (param.alias) {
param.alias.push(dot);
} else {
param.alias = [dot];
}
}

// 处理别名
if (param.alias) {
param.alias.forEach((alias) => {
Expand All @@ -83,15 +97,6 @@ export default class PermissionVerify {
});
});
}

// 兼容GM.*
const dot = key.replace("_", ".");
if (dot !== key) {
PermissionVerify.apis.set(dot, {
api: descriptor.value,
param,
});
}
};
}

Expand Down Expand Up @@ -232,7 +237,6 @@ export default class PermissionVerify {
if (!grant) {
return Promise.reject(new Error("grant is undefined"));
}

for (let i = 0; i < grant.length; i += 1) {
if (
// 名称相等
Expand Down

0 comments on commit 389e6d2

Please sign in to comment.