Skip to content

Commit 82ceea9

Browse files
committed
🐛 修复沙盒兼容
1 parent b861869 commit 82ceea9

3 files changed

Lines changed: 19 additions & 13 deletions

File tree

src/background.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,12 @@ setInterval(() => {
146146
}
147147
}, 1800000);
148148

149-
chrome.runtime.onInstalled.addListener((details) => {
150-
if (details.reason == 'install') {
151-
chrome.tabs.create({ url: 'https://docs.scriptcat.org/' });
152-
} else if (details.reason == 'update') {
153-
chrome.tabs.create({ url: 'https://docs.scriptcat.org/change/' });
154-
}
155-
});
149+
if (process.env.NODE_ENV == 'production') {
150+
chrome.runtime.onInstalled.addListener((details) => {
151+
if (details.reason == 'install') {
152+
chrome.tabs.create({ url: 'https://docs.scriptcat.org/' });
153+
} else if (details.reason == 'update') {
154+
chrome.tabs.create({ url: 'https://docs.scriptcat.org/change/' });
155+
}
156+
});
157+
}

src/pkg/sandbox/sandbox.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,16 @@ export function buildThis(global: AnyMap, context: AnyMap) {
122122
return true;
123123
},
124124
getOwnPropertyDescriptor(_, name) {
125-
let ret = Object.getOwnPropertyDescriptor(context, name)
126-
if (ret) {
125+
try {
126+
let ret = Object.getOwnPropertyDescriptor(context, name)
127+
if (ret) {
128+
return ret;
129+
}
130+
ret = Object.getOwnPropertyDescriptor(global, name);
127131
return ret;
132+
} catch (e) {
133+
return undefined;
128134
}
129-
ret = Object.getOwnPropertyDescriptor(global, name);
130-
return ret;
131135
}
132136
});
133137
return proxy;

src/views/pages/Confirm/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
@click="allow(true, 4)"
3636
color="warning"
3737
>
38-
总是允许剩下{{ num }}个{{ param.permissionContent }}
38+
总是允许全部{{ param.permissionContent }}
3939
</v-btn>
4040
</div>
4141

@@ -54,7 +54,7 @@
5454
v-if="param.wildcard && num > 2"
5555
@click="allow(false, 4)"
5656
color="error"
57-
>总是拒绝剩下{{ num }}个{{ param.permissionContent }}</v-btn
57+
>总是拒绝全部{{ param.permissionContent }}</v-btn
5858
>
5959
</div>
6060
</v-main>

0 commit comments

Comments
 (0)