Fixed UA not working

This commit is contained in:
Peng-YM 2022-05-24 10:24:49 +08:00
parent 52fe634b60
commit bd58aaa2a4
2 changed files with 5 additions and 4 deletions

View File

@ -2,15 +2,16 @@ const { HTTP } = require('./open-api');
const cache = new Map(); const cache = new Map();
async function download(url, userAgent = 'Quantumult%20X') { async function download(url, ua) {
const id = userAgent + url; ua = ua || 'Quantumult%20X/1.0.29 (iPhone14,5; iOS 15.4.1)';
const id = ua + url;
if (cache.has(id)) { if (cache.has(id)) {
return cache.get(id); return cache.get(id);
} }
const $http = HTTP({ const $http = HTTP({
headers: { headers: {
'User-Agent': userAgent 'User-Agent': ua
} }
}); });

File diff suppressed because one or more lines are too long