Skip to content

Commit

Permalink
Update src/background.js
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
PeterDaveHello and coderabbitai[bot] authored Oct 7, 2024
1 parent ec7b9a2 commit d2ed80d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,11 @@ async function createWindow() {
"aliyun.com",
"qianwen.aliyun.com"
];
const parsedHost = urlLib.parse(`https://${domain.startsWith(".") ? domain.substring(1) : domain}`).host;
return allowedDomains.includes(parsedHost);
const parsedHost = new URL(`https://${domain.startsWith(".") ? domain.substring(1) : domain}`).host;
return allowedDomains.some(
(allowedDomain) =>
parsedHost === allowedDomain || parsedHost.endsWith(`.${allowedDomain}`)
);
}

// Modify the Referer header for each request and special patch for some sites.
Expand Down

0 comments on commit d2ed80d

Please sign in to comment.