Skip to content

Commit d384f37

Browse files
committed
🐛 修复GM cookie与GM xhr问题 #444
1 parent fa81e77 commit d384f37

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/app/service/content/gm_api.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,10 @@ export default class GMApi {
299299
details: GMTypes.CookieDetails,
300300
done: (cookie: GMTypes.Cookie[] | any, error: any | undefined) => void
301301
) {
302+
// 如果url和域名都没有,自动填充当前url
303+
if (!details.url && !details.domain) {
304+
details.url = window.location.href;
305+
}
302306
this.sendMessage("GM_cookie", [action, details])
303307
.then((resp: any) => {
304308
done && done(resp, undefined);

src/app/service/service_worker/gm_api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ export default class GMApi {
530530
requestHeaders.push({
531531
header: key,
532532
operation: chrome.declarativeNetRequest.HeaderOperation.SET,
533-
value: headerValue,
533+
value: headerValue.toString(),
534534
});
535535
deleteHeader = true;
536536
}

0 commit comments

Comments
 (0)