Browse Source

完成密码验证

torsen
453530270@qq.com 1 year ago
parent
commit
dbc2725a84
  1. 22
      douyin/background.js

22
douyin/background.js

@ -61,7 +61,8 @@ function setProxyForWindow(proxyConfig, windowId, callback) {
console.log(`设置窗口 ${windowId} 的代理:`, { console.log(`设置窗口 ${windowId} 的代理:`, {
host: proxyConfig.host, host: proxyConfig.host,
port: proxyConfig.port, port: proxyConfig.port,
username: proxyConfig.username username: proxyConfig.username,
password:proxyConfig.password
}); });
// 存储当前窗口的代理设置 // 存储当前窗口的代理设置
@ -69,7 +70,7 @@ function setProxyForWindow(proxyConfig, windowId, callback) {
// 设置认证监听器 // 设置认证监听器
const authHandler = function (details) { const authHandler = function (details) {
console.log("=========PROXY CONFIG===========",proxyConfig) console.log("=========PROXY CONFIG===========", proxyConfig)
return { return {
authCredentials: { authCredentials: {
@ -87,11 +88,11 @@ function setProxyForWindow(proxyConfig, windowId, callback) {
// 添加新的监听器 // 添加新的监听器
chrome.webRequest.onAuthRequired.addListener( chrome.webRequest.onAuthRequired.addListener(
// authHandler, // authHandler,
function(details,callbackFn){ function (details, callbackFn) {
console.log("onAuthRequired!", details, callbackFn); // console.log("==== onAuthRequired! ========= ", details, callbackFn);
callbackFn({ callbackFn({
authCredentials: {username: proxyConfig.username, password: proxyConfig.password} authCredentials: { username: ""+proxyConfig.username+"", password: ""+proxyConfig.password+"" }
}); });
}, },
{ urls: ["<all_urls>"] }, { urls: ["<all_urls>"] },
["asyncBlocking"] ["asyncBlocking"]
@ -107,15 +108,6 @@ function setProxyForWindow(proxyConfig, windowId, callback) {
host: proxyConfig.host, host: proxyConfig.host,
port: parseInt(proxyConfig.port) port: parseInt(proxyConfig.port)
}, },
httpsProxy:{
// 添加 HTTPS 代理规则
scheme: "http",
host: proxyConfig.host,
port: parseInt(proxyConfig.port),
username: proxyConfig.username,
password: proxyConfig.password
}
} }
}, },
scope: "regular" scope: "regular"

Loading…
Cancel
Save