Skip to content

Commit b6caaa9

Browse files
committed
update:发布1.1.3版本
1 parent e736c2b commit b6caaa9

24 files changed

+445
-95
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,5 @@ dist
132132
!README.md
133133
.idea
134134
/config/env.json
135+
/js/UC分享.js
136+
/json/UC分享.json

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# drpyS(drpy-node)
22

33
nodejs作为服务端的drpy实现。全面升级异步写法
4-
积极开发中,每日一更,当前进度 `28%`
4+
积极开发中,每日一更,当前进度 `29%`
55

66
* [本地配置接口-动态本地](/config?pwd=)
77
* [本地配置接口-动态外网/局域网](/config/1?pwd=)
@@ -16,11 +16,12 @@ nodejs作为服务端的drpy实现。全面升级异步写法
1616

1717
## 更新记录
1818

19-
### 20250106
19+
### 20250107
2020

21-
更新至V1.1.2
21+
更新至V1.1.3
2222

23-
1. 重写底层 `req` 方法,实现 `gbk` 等网页编码支持
23+
1. req系列函数修复
24+
2. 增加新源,优化推送
2425

2526
[点此查看完整更新记录](docs/updateRecord.md)
2627

config/map.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
采集之王[合]@?type=url&params=../json/采集静态.json$1@采王道长[合]
55
采集之王[合]@?type=url&params=../json/采集[zy]静态.json$1@采王zy[密]
66
采集之王[合]@?type=url&params=../json/采集[密]静态.json$1$@采王成人[密]
7+
UC分享@?type=url&params=../json/UC分享.json@UC分享[盘]

controllers/http.js

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import axios from 'axios';
22
import http from 'http';
33
import https from 'https';
44
import {ENV} from '../utils/env.js';
5+
import {keysToLowerCase} from '../utils/utils.js';
56

67
const AgentOption = {keepAlive: true, maxSockets: 64, timeout: 30000}; // 最大连接数64,30秒定期清理空闲连接
78
// const AgentOption = {keepAlive: true};
@@ -17,12 +18,18 @@ const _axios = axios.create({
1718
export default (fastify, options, done) => {
1819
// 读取 views 目录下的 encoder.html 文件并返回
1920
fastify.post('/http', async (req, reply) => {
20-
const {url, headers = {}, params = {}, method = 'GET', data = {}} = req.body;
21-
// console.log('headers:', headers);
21+
const {url, headers: userHeaders = {}, params = {}, method = 'GET', data = {}} = req.body;
2222
if (!url) {
2323
return reply.status(400).send({error: 'Missing required field: url'});
2424
}
25-
25+
const headers = keysToLowerCase({
26+
...userHeaders,
27+
});
28+
// 添加accept属性防止获取网页源码编码不正确问题
29+
if (!Object.keys(headers).includes('accept')) {
30+
headers['accept'] = '*/*';
31+
}
32+
console.log('http headers:', headers);
2633
try {
2734
const response = await _axios({
2835
url,
@@ -96,11 +103,18 @@ export default (fastify, options, done) => {
96103
return reply.code(400).send({error: 'Invalid URL. Must start with http:// or https://'});
97104
}
98105
console.log(`Forwarding request to: ${targetUrl}`);
99-
delete request.headers['host'];
106+
const headers = keysToLowerCase({
107+
...request.headers,
108+
});
109+
delete headers['host'];
110+
// 添加accept属性防止获取网页源码编码不正确问题
111+
if (!Object.keys(headers).includes('accept')) {
112+
headers['accept'] = '*/*';
113+
}
100114
const response = await _axios({
101115
method: request.method,
102116
url: targetUrl,
103-
headers: request.headers,
117+
headers: headers,
104118
data: request.body,
105119
params: request.query,
106120
timeout: 10000,

controllers/mediaProxy.js

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {base64Decode} from '../libs_drpy/crypto-util.js';
22
import '../utils/random-http-ua.js'
3+
import {keysToLowerCase} from '../utils/utils.js';
34
import http from 'http';
45
import https from 'https';
56
import axios from 'axios';
@@ -110,7 +111,14 @@ function proxyStreamMedia(videoUrl, headers, reply) {
110111

111112

112113
// Helper function for range-based chunk downloading
113-
async function fetchStream(url, headers, start, end, randUa) {
114+
async function fetchStream(url, userHeaders, start, end, randUa) {
115+
const headers = keysToLowerCase({
116+
...userHeaders,
117+
});
118+
// 添加accept属性防止获取网页源码编码不正确问题
119+
if (!Object.keys(headers).includes('accept')) {
120+
headers['accept'] = '*/*';
121+
}
114122
try {
115123
const response = await _axios.get(url, {
116124
headers: {
@@ -148,15 +156,23 @@ async function proxyStreamMediaMulti(mediaUrl, reqHeaders, request, reply, threa
148156
})
149157
: reqHeaders;
150158

159+
const headers = keysToLowerCase({
160+
...randHeaders,
161+
});
162+
// 添加accept属性防止获取网页源码编码不正确问题
163+
if (!Object.keys(headers).includes('accept')) {
164+
headers['accept'] = '*/*';
165+
}
151166
// 检查请求头中是否包含 Cookie
152167
const hasCookie = Object.keys(randHeaders).some(key => key.toLowerCase() === 'cookie');
153168
// console.log(`[proxyStreamMediaMulti] Checking for Cookie in headers: ${hasCookie}`);
154169

170+
155171
try {
156172
if (!hasCookie) {
157173
// 优先尝试 HEAD 请求
158174
// console.log('[proxyStreamMediaMulti] Attempting HEAD request to fetch content-length...');
159-
const headResponse = await _axios.head(mediaUrl, {headers: randHeaders});
175+
const headResponse = await _axios.head(mediaUrl, {headers: headers});
160176
initialHeaders = headResponse.headers;
161177
contentLength = parseInt(initialHeaders['content-length'], 10);
162178
console.log(`[proxyStreamMediaMulti] HEAD request successful, content-length: ${contentLength}`);
@@ -169,7 +185,7 @@ async function proxyStreamMediaMulti(mediaUrl, reqHeaders, request, reply, threa
169185
// 使用 HTTP Range 请求获取 content-length
170186
try {
171187
// console.log('[proxyStreamMediaMulti] Attempting Range GET request to fetch content-length...');
172-
const rangeHeaders = {...randHeaders, Range: 'bytes=0-1'};
188+
const rangeHeaders = {...headers, Range: 'bytes=0-1'};
173189
const rangeResponse = await _axios.get(mediaUrl, {
174190
headers: rangeHeaders,
175191
responseType: 'stream',
@@ -190,11 +206,11 @@ async function proxyStreamMediaMulti(mediaUrl, reqHeaders, request, reply, threa
190206
rangeResponse.data.destroy();
191207
} catch (rangeError) {
192208
console.error('[proxyStreamMediaMulti] Range GET request failed:', rangeError.message);
193-
console.log(randHeaders);
209+
console.log('[proxyStreamMediaMulti] headers:', headers);
194210
// 使用 GET 请求获取 content-length
195211
// console.log('[proxyStreamMediaMulti] Falling back to full GET request to fetch content-length...');
196212
const getResponse = await _axios.get(mediaUrl, {
197-
headers: randHeaders,
213+
headers: headers,
198214
responseType: 'stream',
199215
});
200216
initialHeaders = getResponse.headers;

custom.json

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"sites_count": 63,
2+
"sites_count": 66,
33
"sites": [
44
{
55
"key": "drpyS_设置中心",
@@ -396,6 +396,16 @@
396396
"quickSearch": 0,
397397
"ext": ""
398398
},
399+
{
400+
"key": "drpyS_秋霞电影网",
401+
"name": "秋霞电影网(DS)",
402+
"type": 4,
403+
"api": "http://localhost:5757/api/秋霞电影网",
404+
"searchable": 2,
405+
"filterable": 1,
406+
"quickSearch": 0,
407+
"ext": ""
408+
},
399409
{
400410
"key": "drpyS_人人视频",
401411
"name": "人人视频(DS)",
@@ -486,6 +496,16 @@
486496
"quickSearch": 0,
487497
"ext": ""
488498
},
499+
{
500+
"key": "drpyS_小米[盘]",
501+
"name": "小米[盘](DS)",
502+
"type": 4,
503+
"api": "http://localhost:5757/api/小米[盘]",
504+
"searchable": 1,
505+
"filterable": 1,
506+
"quickSearch": 0,
507+
"ext": ""
508+
},
489509
{
490510
"key": "drpyS_星芽短剧",
491511
"name": "星芽短剧(DS)",
@@ -636,6 +656,16 @@
636656
"quickSearch": 2,
637657
"ext": ""
638658
},
659+
{
660+
"key": "drpyS_UC分享[盘]",
661+
"name": "UC分享[盘](DS)",
662+
"type": 4,
663+
"api": "http://localhost:5757/api/UC分享",
664+
"searchable": 2,
665+
"filterable": 0,
666+
"quickSearch": 0,
667+
"ext": "H4sIAAAAAAAAA9PT088qzs/TD3V+2tH2ZNdqPRAPAKubOwMVAAAA"
668+
},
639669
{
640670
"key": "drpyS_x草榴社区[密]",
641671
"name": "x草榴社区[密](DS)",

docs/updateRecord.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,37 @@
11
# drpyS更新记录
22

3+
### 20250107
4+
5+
更新至V1.1.3
6+
7+
1. 修复 `req` 系列函数获取源码由于没有请求头没有默认 `accept` 属性导致的某些网页获取的源码异常问题
8+
2. 推送及各个网盘播放的夸克代理线程数绑定设置中心播放线程代理的值,默认为6
9+
3. 修复js版打包7z脚本命令的日期不正确问题
10+
4. 增加源 `秋霞电影网.js`
11+
5. 增加源 `小米[盘].js` 用于演示 `push://` 推送写法
12+
6. 推送源支持 `www.aliyundrive.com` 这种地址的拦截
13+
7. lazy执行失败后自动执行嗅探机制调整,仅限于http开头的链接
14+
15+
`小米[盘].js` 使用说明:
16+
海阔待改推送 增加编码 `encodeURIComponent`
17+
18+
```javascript
19+
log(detail);
20+
let state = post(s + 'action', {
21+
timeout: 2000,
22+
body: {
23+
do: 'push',
24+
url: encodeURIComponent(JSON.stringify(detail))
25+
},
26+
headers: {
27+
'User-Agent': MOBILE_UA
28+
},
29+
});
30+
```
31+
32+
装逼壳待改,接受海阔推送json数据时对url数据进行url解码。然后才是判断解析json
33+
push:// 选集无法播放,待改
34+
335
### 20250106
436

537
更新至V1.1.2

index.json

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"sites_count": 63,
2+
"sites_count": 66,
33
"sites": [
44
{
55
"key": "drpyS_设置中心",
@@ -396,6 +396,16 @@
396396
"quickSearch": 0,
397397
"ext": ""
398398
},
399+
{
400+
"key": "drpyS_秋霞电影网",
401+
"name": "秋霞电影网(DS)",
402+
"type": 4,
403+
"api": "http://localhost:5757/api/秋霞电影网",
404+
"searchable": 2,
405+
"filterable": 1,
406+
"quickSearch": 0,
407+
"ext": ""
408+
},
399409
{
400410
"key": "drpyS_人人视频",
401411
"name": "人人视频(DS)",
@@ -486,6 +496,16 @@
486496
"quickSearch": 0,
487497
"ext": ""
488498
},
499+
{
500+
"key": "drpyS_小米[盘]",
501+
"name": "小米[盘](DS)",
502+
"type": 4,
503+
"api": "http://localhost:5757/api/小米[盘]",
504+
"searchable": 1,
505+
"filterable": 1,
506+
"quickSearch": 0,
507+
"ext": ""
508+
},
489509
{
490510
"key": "drpyS_星芽短剧",
491511
"name": "星芽短剧(DS)",
@@ -636,6 +656,16 @@
636656
"quickSearch": 2,
637657
"ext": ""
638658
},
659+
{
660+
"key": "drpyS_UC分享[盘]",
661+
"name": "UC分享[盘](DS)",
662+
"type": 4,
663+
"api": "http://localhost:5757/api/UC分享",
664+
"searchable": 2,
665+
"filterable": 0,
666+
"quickSearch": 0,
667+
"ext": "H4sIAAAAAAAAA9PT088qzs/TD3V+2tH2ZNdqPRAPAKubOwMVAAAA"
668+
},
639669
{
640670
"key": "drpyS_x草榴社区[密]",
641671
"name": "x草榴社区[密](DS)",

js/_lib.scan.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ async function _checkAliStatus(state, httpUrl) {
270270
if (status === "CONFIRMED") {
271271
if (resData.data.content.data.bizExt) {
272272
const bizExt = JSON.parse(atob(resData.data.content.data.bizExt));
273-
console.log(bizExt.pds_login_result);
273+
console.log('[_lib.scan.js]阿里扫码结果:', bizExt.pds_login_result);
274274
return {
275275
status: QRCodeHandler.STATUS_CONFIRMED,
276276
token: bizExt.pds_login_result.refreshToken

0 commit comments

Comments
 (0)