Skip to content

Commit 7f28eb0

Browse files
authored
Merge pull request #234 from hjdhnx/main
更换mobile_ua,修复搜索自动过验证由于没有自动继承全局headers导致的可能过不去验证的问题
2 parents e3bd5fc + 5295a85 commit 7f28eb0

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

src/renderer/src/config/ua.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default {
2222
},
2323
{
2424
name: 'MOBILE',
25-
ua: 'Mozilla/5.0 (Linux; Android 11; M2007J3SC Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045714 Mobile Safari/537.36',
25+
ua: 'Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.91 Mobile Safari/537.36',
2626
},
2727
{
2828
name: 'PC',

src/renderer/src/utils/drpy/drpy3.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ const pre = () => {
263263
let rule = {};
264264
// @ts-ignore
265265
let vercode = typeof pdfl === 'function' ? 'drpy3.1' : 'drpy3';
266-
const VERSION = `${vercode} 3.9.50beta19 202400526`;
266+
const VERSION = `${vercode} 3.9.50beta20 202400528`;
267267
/** 已知问题记录
268268
* 1.影魔的jinjia2引擎不支持 {{fl}}对象直接渲染 (有能力解决的话尽量解决下,支持对象直接渲染字符串转义,如果加了|safe就不转义)[影魔牛逼,最新的文件发现这问题已经解决了]
269269
* Array.prototype.append = Array.prototype.push; 这种js执行后有毛病,for in 循环列表会把属性给打印出来 (这个大毛病需要重点排除一下)
@@ -279,7 +279,7 @@ const VERSION = `${vercode} 3.9.50beta19 202400526`;
279279
280280
/** 以下是内置变量和解析方法 **/
281281
var MOBILE_UA =
282-
'Mozilla/5.0 (Linux; Android 11; M2007J3SC Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045714 Mobile Safari/537.36';
282+
'Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.91 Mobile Safari/537.36';
283283
const PC_UA =
284284
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36';
285285
const UA = 'Mozilla/5.0';
@@ -1569,7 +1569,7 @@ const verifyCode = (url) => {
15691569
// let submit_url = `${host}/index.php/ajax/verify_check`;
15701570
// let submit_body = `type=search&verify=${code}`;
15711571

1572-
let html: any = request(submit_url, { headers: { Cookie: cookie, 'User-Agent': MOBILE_UA }, method: 'POST'});
1572+
let html: any = request(submit_url, { headers: { Cookie: cookie}, method: 'POST'});
15731573
// let html: any = request(submit_url, { headers: { Cookie: cookie, 'User-Agent': MOBILE_UA }, method: 'POST',body:submit_body });
15741574
html = JSON.parse(html);
15751575

@@ -1708,6 +1708,13 @@ const request = (url: string, obj: any = undefined, ocr_flag: boolean = false) =
17081708
const keys = Object.keys(headers).map((it) => it.toLowerCase());
17091709
if (!keys.includes('user-agent')) {
17101710
headers['User-Agent'] = MOBILE_UA;
1711+
// fetch_params 里存在ua则优先,否则才默认手机UA
1712+
if( typeof(fetch_params) === 'object' && fetch_params && fetch_params.headers){
1713+
let fetch_headers = keysToLowerCase(fetch_params.headers);
1714+
if(fetch_headers['user-agent']){
1715+
headers['User-Agent'] = fetch_headers['user-agent'];
1716+
}
1717+
}
17111718
}
17121719
if (!keys.includes('referer')) {
17131720
headers['Referer'] = getHome(url);

src/renderer/src/utils/drpy/drpy_suggestions/drpy_suggestions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ const Keyword = [
655655
insertText: 'MOBILE_UA',
656656
detail: '应用注入的手机UA',
657657
documentation:
658-
'Mozilla/5.0 (Linux; Android 11; M2007J3SC Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045714 Mobile Safari/537.36',
658+
'Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.91 Mobile Safari/537.36',
659659
},
660660
{
661661
label: 'PC_UA',

0 commit comments

Comments
 (0)