mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
🐞 fix: 热修复部分问题
This commit is contained in:
parent
23438d01ed
commit
5d3aec4326
@ -764,20 +764,30 @@ export class tools extends plugin {
|
|||||||
fs.unlinkSync(target);
|
fs.unlinkSync(target);
|
||||||
}
|
}
|
||||||
let res;
|
let res;
|
||||||
|
if (isProxy) {
|
||||||
res = await axios.get(url, {
|
res = await axios.get(url, {
|
||||||
headers: headers || {
|
headers: headers || {
|
||||||
"User-Agent":
|
"User-Agent":
|
||||||
"Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Mobile Safari/537.36",
|
"Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Mobile Safari/537.36",
|
||||||
},
|
},
|
||||||
responseType: "stream",
|
responseType: "stream",
|
||||||
httpAgent: isProxy && tunnel.httpOverHttp({
|
httpAgent: tunnel.httpOverHttp({
|
||||||
proxy: { host: this.proxyAddr, port: this.proxyPort },
|
proxy: { host: this.proxyAddr, port: this.proxyPort },
|
||||||
}),
|
}),
|
||||||
httpsAgent: isProxy && tunnel.httpOverHttp({
|
httpsAgent: tunnel.httpOverHttp({
|
||||||
proxy: { host: this.proxyAddr, port: this.proxyPort },
|
proxy: { host: this.proxyAddr, port: this.proxyPort },
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
res = await axios.get(url, {
|
||||||
|
headers: headers || {
|
||||||
|
"User-Agent":
|
||||||
|
"Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Mobile Safari/537.36",
|
||||||
|
},
|
||||||
|
responseType: "stream",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
console.log(`开始下载: ${url}`);
|
console.log(`开始下载: ${url}`);
|
||||||
const writer = fs.createWriteStream(target);
|
const writer = fs.createWriteStream(target);
|
||||||
res.data.pipe(writer);
|
res.data.pipe(writer);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user