Skip to content

Commit 345025c

Browse files
committed
update: 发布新版本
v1.1.20
1 parent fd774df commit 345025c

19 files changed

+432
-250
lines changed

Diff for: README.md

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ nodejs作为服务端的drpy实现。全面升级异步写法
1919

2020
## 更新记录
2121

22+
### 20250225
23+
24+
更新至V1.1.20
25+
2226
### 20250224
2327

2428
更新至V1.1.19

Diff for: apps/cookie-butler/index.html

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<script src="./static/js/tailwindcss.min.js"></script>
1010
<script src="./static/js/axios.min.js"></script>
1111
<script src="./static/js/qrcode.min.js"></script>
12+
<script src="./static/js/crypto-js.min.js"></script>
1213
<script src="./static/js/core.js"></script>
1314
<script src="./static/js/cookie.js"></script>
1415
</head>
@@ -19,6 +20,7 @@
1920
<li><a class="btn-scan" data-platform="ali">阿里</a></li>
2021
<li><a class="btn-scan" data-platform="quark">夸克</a></li>
2122
<li><a class="btn-scan" data-platform="uc">UC</a></li>
23+
<li><a class="btn-scan" data-platform="uc_token">UC_TOKEN</a></li>
2224
<li><a class="btn-scan" data-platform="bili">哔哩哔哩</a></li>
2325
</ul>
2426

Diff for: apps/cookie-butler/static/js/cookie.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function showToast(message, type = 'success') {
2020
// 初始化页面
2121
async function initializePage() {
2222
// 加载cookie
23-
const platforms = ['ali', 'quark', 'uc', 'bili'];
23+
const platforms = ['ali', 'quark', 'uc','uc_token', 'bili'];
2424

2525
// 绑定按钮事件
2626
platforms.forEach(platform => {

Diff for: apps/cookie-butler/static/js/core.js

+197-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
class QRCodeHandler {
23
// 状态常量
34
static STATUS_NEW = "NEW"; // 待扫描
@@ -10,6 +11,7 @@ class QRCodeHandler {
1011
static PLATFORM_QUARK = "quark"; // 夸克
1112
static PLATFORM_ALI = "ali"; // 阿里云盘
1213
static PLATFORM_UC = "uc"; // UC
14+
static PLATFORM_UC_TOKEN = "uc_token"; // uc_token
1315
static PLATFORM_BILI = "bili"; // 哔哩哔哩
1416

1517
// 通用请求头
@@ -24,8 +26,22 @@ class QRCodeHandler {
2426
[QRCodeHandler.PLATFORM_QUARK]: null,
2527
[QRCodeHandler.PLATFORM_ALI]: null,
2628
[QRCodeHandler.PLATFORM_UC]: null,
29+
[QRCodeHandler.PLATFORM_UC_TOKEN]: null,
2730
[QRCodeHandler.PLATFORM_BILI]: null
2831
};
32+
this.Addition = {
33+
DeviceID: '07b48aaba8a739356ab8107b5e230ad4',
34+
RefreshToken: '',
35+
AccessToken: ''
36+
}
37+
this.conf = {
38+
api: "https://open-api-drive.uc.cn",
39+
clientID: "5acf882d27b74502b7040b0c65519aa7",
40+
signKey: "l3srvtd7p42l0d0x1u8d7yc8ye9kki4d",
41+
appVer: "1.6.8",
42+
channel: "UCTVOFFICIALWEB",
43+
codeApi: "http://api.extscreen.com/ucdrive",
44+
};
2945
}
3046

3147
static generateUUID() {
@@ -107,6 +123,8 @@ class QRCodeHandler {
107123
return await this._startAliScan();
108124
case QRCodeHandler.PLATFORM_UC:
109125
return await this._startUCScan();
126+
case QRCodeHandler.PLATFORM_UC_TOKEN:
127+
return await this._startUC_TOKENScan();
110128
case QRCodeHandler.PLATFORM_BILI:
111129
return await this._startBiliScan();
112130
default:
@@ -122,6 +140,8 @@ class QRCodeHandler {
122140
return await this._checkAliStatus();
123141
case QRCodeHandler.PLATFORM_UC:
124142
return await this._checkUCStatus();
143+
case QRCodeHandler.PLATFORM_UC_TOKEN:
144+
return await this._checkUC_TOKENStatus();
125145
case QRCodeHandler.PLATFORM_BILI:
126146
return await this._checkBiliStatus();
127147
default:
@@ -380,14 +400,12 @@ class QRCodeHandler {
380400
});
381401
const resData = res.data;
382402
const token = resData.data.data.members.token;
383-
384403
const qrUrl = `https://su.uc.cn/1_n0ZCv?token=${token}&client_id=381&uc_param_str=&uc_biz_str=S%3Acustom%7CC%3Atitlebar_fix`;
385404

386405
this.platformStates[QRCodeHandler.PLATFORM_UC] = {
387406
token: token,
388407
request_id: requestId
389408
};
390-
391409
const qrCode = await this._generateQRCode(qrUrl);
392410
return {
393411
qrcode: qrCode,
@@ -404,8 +422,8 @@ class QRCodeHandler {
404422
if (!state) {
405423
return {status: QRCodeHandler.STATUS_EXPIRED};
406424
}
407-
408425
try {
426+
409427
const res = await axios({
410428
url: "/http",
411429
method: "POST",
@@ -426,9 +444,12 @@ class QRCodeHandler {
426444
}
427445
}
428446
});
447+
// this.code = await this.getCode(this.token)
448+
// let access_token = await this.refreshToken(this.code);
449+
// console.log(access_token)
429450
const resData = res.data;
430-
431451
if (resData.data.status === 2000000) { // 扫码成功
452+
432453
const serviceTicket = resData.data.data.members.service_ticket;
433454
const cookieRes = await axios({
434455
url: "/http",
@@ -482,6 +503,178 @@ class QRCodeHandler {
482503
}
483504
}
484505

506+
generateDeviceID(timestamp) {
507+
return CryptoJS.MD5(timestamp).toString().slice(0, 16); // 取前16位
508+
}
509+
510+
generateReqId(deviceID, timestamp) {
511+
return CryptoJS.MD5(deviceID + timestamp).toString().slice(0, 16);
512+
}
513+
514+
generateXPanToken(method, pathname, timestamp, key) {
515+
const data = method + '&' + pathname + '&' + timestamp + '&' + key;
516+
return CryptoJS.SHA256(data).toString();
517+
}
518+
519+
//uc_token
520+
async _startUC_TOKENScan() {
521+
try {
522+
const pathname = '/oauth/authorize'
523+
const timestamp = Math.floor(Date.now() / 1000).toString()+'000'; // 13位时间戳需调整
524+
const deviceID = this.Addition.DeviceID || this.generateDeviceID(timestamp);
525+
const reqId = this.generateReqId(deviceID, timestamp);
526+
const token = this.generateXPanToken('GET', pathname, timestamp, this.conf.signKey);
527+
const headers = {
528+
Accept: 'application/json, text/plain, */*',
529+
'User-Agent': 'Mozilla/5.0 (Linux; U; Android 13; zh-cn; M2004J7AC Build/UKQ1.231108.001) AppleWebKit/533.1 (KHTML, like Gecko) Mobile Safari/533.1',
530+
'x-pan-tm': timestamp,
531+
'x-pan-token': token,
532+
'x-pan-client-id': this.conf.clientID,
533+
...(this.Addition.AccessToken ? { 'Authorization': `Bearer ${this.Addition.AccessToken}` } : {})
534+
};
535+
const res = await axios({
536+
url: "/http",
537+
method: "POST",
538+
data: {
539+
url: `${this.conf.api}${pathname}`,
540+
headers: headers,
541+
params: {
542+
req_id: reqId,
543+
access_token: this.Addition.AccessToken,
544+
app_ver: this.conf.appVer,
545+
device_id: deviceID,
546+
device_brand: 'Xiaomi',
547+
platform: 'tv',
548+
device_name: 'M2004J7AC',
549+
device_model: 'M2004J7AC',
550+
build_device: 'M2004J7AC',
551+
build_product: 'M2004J7AC',
552+
device_gpu: 'Adreno (TM) 550',
553+
activity_rect: '{}',
554+
channel: this.conf.channel,
555+
auth_type : 'code',
556+
client_id : this.conf.clientID,
557+
scope : 'netdisk',
558+
qrcode : '1',
559+
qr_width : '460',
560+
qr_height : '460',
561+
},
562+
}
563+
});
564+
const resData = res.data;
565+
this.query_token = resData.data.query_token;
566+
const qrCode = resData.data.qr_data;
567+
this.platformStates[QRCodeHandler.PLATFORM_UC_TOKEN] = {
568+
query_token: this.query_token,
569+
request_id: reqId
570+
};
571+
return {
572+
qrcode: 'data:image/png;base64,'+qrCode,
573+
status: QRCodeHandler.STATUS_NEW
574+
};
575+
} catch (e) {
576+
this.platformStates[QRCodeHandler.PLATFORM_UC_TOKEN] = null;
577+
throw e;
578+
}
579+
}
580+
581+
async _checkUC_TOKENStatus() {
582+
const state = this.platformStates[QRCodeHandler.PLATFORM_UC_TOKEN];
583+
if (!state) {
584+
return {status: QRCodeHandler.STATUS_EXPIRED};
585+
}
586+
const pathname = '/oauth/code';
587+
const timestamp = Math.floor(Date.now() / 1000).toString()+'000'; // 13位时间戳需调整
588+
const deviceID = this.Addition.DeviceID || this.generateDeviceID(timestamp);
589+
const reqId = this.generateReqId(deviceID, timestamp);
590+
const x_pan_token = this.generateXPanToken("GET", pathname, timestamp, this.conf.signKey);
591+
const headers = {
592+
Accept: 'application/json, text/plain, */*',
593+
'User-Agent': 'Mozilla/5.0 (Linux; U; Android 13; zh-cn; M2004J7AC Build/UKQ1.231108.001) AppleWebKit/533.1 (KHTML, like Gecko) Mobile Safari/533.1',
594+
'x-pan-tm': timestamp,
595+
'x-pan-token': x_pan_token,
596+
'x-pan-client-id': this.conf.clientID,
597+
...(this.Addition.AccessToken ? { 'Authorization': `Bearer ${this.Addition.AccessToken}` } : {})
598+
};
599+
try {
600+
const res = await axios({
601+
url: "/http",
602+
method: "POST",
603+
data: {
604+
url: `${this.conf.api}${pathname}`,
605+
headers: headers,
606+
params: {
607+
req_id: reqId,
608+
access_token: this.Addition.AccessToken,
609+
app_ver: this.conf.appVer,
610+
device_id: deviceID,
611+
device_brand: 'Xiaomi',
612+
platform: 'tv',
613+
device_name: 'M2004J7AC',
614+
device_model: 'M2004J7AC',
615+
build_device: 'M2004J7AC',
616+
build_product: 'M2004J7AC',
617+
device_gpu: 'Adreno (TM) 550',
618+
activity_rect: '{}',
619+
channel: this.conf.channel,
620+
client_id: this.conf.clientID,
621+
scope: 'netdisk',
622+
query_token: this.query_token
623+
}
624+
}
625+
}).catch(err => err.response);
626+
const resData = res.data;
627+
if (resData.status === 200) { // 扫码成功
628+
const pathname = '/token';
629+
const timestamp = Math.floor(Date.now() / 1000).toString()+'000';
630+
const reqId = this.generateReqId(this.Addition.DeviceID, timestamp);
631+
const data = JSON.stringify({
632+
req_id: reqId,
633+
app_ver: this.conf.appVer,
634+
device_id: this.Addition.DeviceID,
635+
device_brand: 'Xiaomi',
636+
platform: 'tv',
637+
device_name: 'M2004J7AC',
638+
device_model: 'M2004J7AC',
639+
build_device: 'M2004J7AC',
640+
build_product: 'M2004J7AC',
641+
device_gpu: 'Adreno (TM) 550',
642+
activity_rect: '{}',
643+
channel: this.conf.channel,
644+
code:resData.data.code
645+
});
646+
const response = await axios({
647+
url: '/http',
648+
method: "POST",
649+
data:{
650+
url:`${this.conf.codeApi}${pathname}`,
651+
method: "POST",
652+
headers: {
653+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36',
654+
'Accept': 'application/json, text/plain, */*',
655+
'Content-Type': 'application/json',
656+
},
657+
data:data
658+
}
659+
});
660+
const resp = response.data;
661+
if(resp.status === 200) {
662+
this.platformStates[QRCodeHandler.PLATFORM_UC_TOKEN] = null;
663+
return {
664+
status: QRCodeHandler.STATUS_CONFIRMED,
665+
cookie: resp.data.data.access_token
666+
};
667+
}
668+
669+
} else if (resData.status === 400){
670+
return {status: QRCodeHandler.STATUS_NEW};
671+
}
672+
} catch (e) {
673+
this.platformStates[QRCodeHandler.PLATFORM_UC_TOKEN] = null;
674+
throw new Error(e.message);
675+
}
676+
}
677+
485678
// 哔哩哔哩平台相关方法
486679
async _startBiliScan() {
487680
try {

Diff for: apps/cookie-butler/static/js/crypto-js.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: docs/updateRecord.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
# drpyS更新记录
2+
3+
### 20250225
4+
5+
更新至V1.1.20
6+
7+
1. UC整体逻辑修改,并在扫码插件增加了UC_TOKEN扫码逻辑
8+
2. 数据库sqlite3优化,寻找另一个wasm实现的库平替了兼容性极差的sqlite3原生库
9+
210
### 20250224
311

412
更新至V1.1.19
513

614
1. 修复 推送和所有网盘源涉及的UC播放问题,支持原代本和原代服务加速
715
2. 更新猫爪的 alist.js
816
3. 新增 `sqlite` `sqlite3` 依赖,在ds源里的异步方法里直接使用,示例:
17+
918
```javascript
1019
await database.startDb();
11-
console.log('database:',database);
20+
console.log('database:', database);
1221
const db = database.db;
1322
// 创建表
1423
await db.run(`

Diff for: js/多多[盘].js

+3-19
Original file line numberDiff line numberDiff line change
@@ -160,29 +160,13 @@ var rule = {
160160
header: headers
161161
}
162162
} else if (flag.startsWith('UC-')) {
163-
console.log("UC网盘解析开始")
163+
console.log("UC网盘解析开始");
164164
if (!UCDownloadingCache[ids[1]]) {
165165
const down = await UC.getDownload(ids[0], ids[1], ids[2], ids[3], true);
166166
if (down) UCDownloadingCache[ids[1]] = down;
167167
}
168-
downUrl = UCDownloadingCache[ids[1]].download_url;
169-
const headers = {
170-
"Referer": "https://drive.uc.cn/",
171-
"cookie": UC.cookie,
172-
"User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) quark-cloud-drive/2.5.20 Chrome/100.0.4896.160 Electron/18.3.5.4-b478491100 Safari/537.36 Channel/pckk_other_ch'
173-
};
174-
urls.push("UC原画", downUrl);
175-
urls.push("原代服", mediaProxyUrl + `?thread=${ENV.get('thread') || 6}&form=urlcode&randUa=1&url=` + encodeURIComponent(downUrl) + '&header=' + encodeURIComponent(JSON.stringify(headers)));
176-
if (ENV.get('play_local_proxy_type', '1') === '2') {
177-
urls.push("原代本", `http://127.0.0.1:7777/?thread=${ENV.get('thread') || 6}&form=urlcode&randUa=1&url=` + encodeURIComponent(downUrl) + '&header=' + encodeURIComponent(JSON.stringify(headers)));
178-
} else {
179-
urls.push("原代本", `http://127.0.0.1:5575/proxy?thread=${ENV.get('thread') || 6}&chunkSize=256&url=` + encodeURIComponent(downUrl));
180-
}
181-
return {
182-
parse: 0,
183-
url: urls,
184-
header: headers,
185-
}
168+
const downCache = UCDownloadingCache[ids[1]];
169+
return await UC.getLazyResult(downCache, mediaProxyUrl)
186170
}
187171
},
188172
}

Diff for: js/木偶[盘].js

+3-19
Original file line numberDiff line numberDiff line change
@@ -156,29 +156,13 @@ var rule = {
156156
header: headers
157157
}
158158
} else if (flag.startsWith('UC-')) {
159-
console.log("UC网盘解析开始")
159+
console.log("UC网盘解析开始");
160160
if (!UCDownloadingCache[ids[1]]) {
161161
const down = await UC.getDownload(ids[0], ids[1], ids[2], ids[3], true);
162162
if (down) UCDownloadingCache[ids[1]] = down;
163163
}
164-
downUrl = UCDownloadingCache[ids[1]].download_url;
165-
const headers = {
166-
"Referer": "https://drive.uc.cn/",
167-
"cookie": UC.cookie,
168-
"User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) quark-cloud-drive/2.5.20 Chrome/100.0.4896.160 Electron/18.3.5.4-b478491100 Safari/537.36 Channel/pckk_other_ch'
169-
};
170-
urls.push("UC原画", downUrl);
171-
urls.push("原代服", mediaProxyUrl + `?thread=${ENV.get('thread') || 6}&form=urlcode&randUa=1&url=` + encodeURIComponent(downUrl) + '&header=' + encodeURIComponent(JSON.stringify(headers)));
172-
if (ENV.get('play_local_proxy_type', '1') === '2') {
173-
urls.push("原代本", `http://127.0.0.1:7777/?thread=${ENV.get('thread') || 6}&form=urlcode&randUa=1&url=` + encodeURIComponent(downUrl) + '&header=' + encodeURIComponent(JSON.stringify(headers)));
174-
} else {
175-
urls.push("原代本", `http://127.0.0.1:5575/proxy?thread=${ENV.get('thread') || 6}&chunkSize=256&url=` + encodeURIComponent(downUrl));
176-
}
177-
return {
178-
parse: 0,
179-
url: urls,
180-
header: headers,
181-
}
164+
const downCache = UCDownloadingCache[ids[1]];
165+
return await UC.getLazyResult(downCache, mediaProxyUrl)
182166
}
183167
},
184168
}

0 commit comments

Comments
 (0)