Skip to content

Commit 1ac9260

Browse files
committed
update:ds支持在线猫源配置地址
1 parent ba0c458 commit 1ac9260

File tree

6 files changed

+37
-3
lines changed

6 files changed

+37
-3
lines changed

Diff for: README.md

+7
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,16 @@ nodejs作为服务端的drpy实现。全面升级异步写法
1414
* [本站防止爬虫协议](/robots.txt)
1515
* [本项目主页-免翻](https://github.com/hjdhnx/drpy-node)
1616
* [DS源适配猫影视](https://github.com/hjdhnx/CatPawOpen/tree/ds-cat)
17+
* [在线猫ds源-复制链接后手动改地址加授权](/config/index.js.md5)
1718

1819
## 更新记录
1920

21+
### 20250119
22+
23+
更新至V1.1.12
24+
25+
1. 支持猫源在线配置
26+
2027
### 20250117
2128

2229
本次未更新版本

Diff for: controllers/config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import '../libs_drpy/jinja.js'
55
import {naturalSort, urljoin, updateQueryString} from '../utils/utils.js'
66
import {md5} from "../libs_drpy/crypto-util.js";
77
import {ENV} from "../utils/env.js";
8-
import {validatePwd} from "../utils/api_validate.js";
8+
import {validateBasicAuth, validatePwd} from "../utils/api_validate.js";
99
import {getSitesMap} from "../utils/sites-map.js";
1010
import {getParsesDict} from "../utils/file.js";
1111
import batchExecute from '../libs_drpy/batchExecute.js';
@@ -348,7 +348,7 @@ export default (fastify, options, done) => {
348348
});
349349

350350
// 接口:返回配置 JSON,同时写入 index.json
351-
fastify.get('/config*', {preHandler: validatePwd}, async (request, reply) => {
351+
fastify.get('/config*', {preHandler: [validatePwd, validateBasicAuth]}, async (request, reply) => {
352352
let t1 = (new Date()).getTime();
353353
const query = request.query; // 获取 query 参数
354354
const pwd = query.pwd || '';

Diff for: docs/updateRecord.md

+13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# drpyS更新记录
22

3+
### 20250119
4+
5+
更新至V1.1.12
6+
7+
1. 支持猫源在线配置
8+
9+
使用教程:
10+
11+
- [点这里跳进去后复制地址](/config/index.js.md5)
12+
- 回来后手动处理地址: 在http:// 中间插入授权验证,比如 admin:drpys@
13+
- 举例: 你复制的地址: `http://127.0.0.1:5757/config/index.js.md5`
14+
- 举例: 你手动处理后放猫里的的地址: `http://admin:[email protected]:5757/config/index.js.md5`
15+
316
### 20250117
417

518
本次未更新版本

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "drpy-node",
3-
"version": "1.1.11",
3+
"version": "1.1.12",
44
"main": "index.js",
55
"type": "module",
66
"scripts": {

Diff for: public/index.html

+6
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,14 @@ <h1 id="drpysdrpy-node">drpyS(drpy-node)</h1>
2121
<li><a href="/robots.txt">本站防止爬虫协议</a></li>
2222
<li><a href="https://github.com/hjdhnx/drpy-node">本项目主页-免翻</a></li>
2323
<li><a href="https://github.com/hjdhnx/CatPawOpen/tree/ds-cat">DS源适配猫影视</a></li>
24+
<li><a href="/config/index.js.md5">在线猫ds源-复制链接后手动改地址加授权</a></li>
2425
</ul>
2526
<h2 id="更新记录">更新记录</h2>
27+
<h3 id="20250119">20250119</h3>
28+
<p>更新至V1.1.12</p>
29+
<ol>
30+
<li>支持猫源在线配置</li>
31+
</ol>
2632
<h3 id="20250117">20250117</h3>
2733
<p>本次未更新版本</p>
2834
<ol>

Diff for: utils/api_validate.js

+8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ export const validateBasicAuth = (request, reply, done) => {
44
done();
55
return
66
}
7+
if (request.url.startsWith('/config/')) {
8+
let cf_path = request.url.slice(8).split('?')[0];
9+
// console.log(cf_path);
10+
if (!['index.js', 'index.js.md5', 'index.config.js', 'index.config.js.md5'].includes(cf_path)) {
11+
done();
12+
return
13+
}
14+
}
715
// console.log('进入了basic验证');
816
const authHeader = request.headers.authorization;
917

0 commit comments

Comments
 (0)