Skip to content

Commit a10df0b

Browse files
committed
update:增加一些新功能
1 parent 51cf220 commit a10df0b

13 files changed

+423
-29
lines changed

Diff for: README.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# drpyS(drpy-node)
22

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

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

1515
## 更新记录
1616

17-
### 20241229
17+
### 20241230
1818

19-
更新至V1.0.25
19+
更新至V1.0.26
2020

21-
1. 本地多线程流代理优化
22-
2. 设置中心功能优化
23-
3. 推送功能优化
21+
1. 设置中心优化,样式适配装逼壳。并支持全局站源动作
2422

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

Diff for: controllers/api.js

+59-3
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,71 @@ export default (fastify, options, done) => {
2424
const query = method === 'GET' ? request.query : request.body;
2525
const protocol = request.protocol;
2626
const hostname = request.hostname;
27-
const proxyUrl = `${protocol}://${hostname}${request.url}`.split('?')[0].replace('/api/', '/proxy/') + '/?do=js';
27+
// const proxyUrl = `${protocol}://${hostname}${request.url}`.split('?')[0].replace('/api/', '/proxy/') + '/?do=js';
28+
// const proxyUrl = `${protocol}://${hostname}/proxy/${moduleName}/?do=js`;
29+
// console.log('proxyUrl:', proxyUrl);
30+
2831
const publicUrl = `${protocol}://${hostname}/public/`;
2932
const httpUrl = `${protocol}://${hostname}/http`;
3033
const mediaProxyUrl = `${protocol}://${hostname}/mediaProxy`;
34+
3135
// console.log(`proxyUrl:${proxyUrl}`);
32-
const env = {
33-
proxyUrl, publicUrl, httpUrl, mediaProxyUrl, getProxyUrl: function () {
36+
function getEnv(moduleName) {
37+
const proxyUrl = `${protocol}://${hostname}/proxy/${moduleName}/?do=js`;
38+
const getProxyUrl = function () {
3439
return proxyUrl
40+
};
41+
return {
42+
proxyUrl, publicUrl, httpUrl, mediaProxyUrl, getProxyUrl
43+
}
44+
}
45+
46+
const env = getEnv(moduleName);
47+
env.getRule = async function (_moduleName) {
48+
const _modulePath = path.join(options.jsDir, `${_moduleName}.js`);
49+
if (!existsSync(_modulePath)) {
50+
return null;
3551
}
52+
const _env = getEnv(_moduleName);
53+
const RULE = await drpy.getRule(_modulePath, _env);
54+
RULE.callRuleFn = async function (_method, _args) {
55+
let invokeMethod = null;
56+
switch (_method) {
57+
case 'class_parse':
58+
invokeMethod = 'home';
59+
break;
60+
case '推荐':
61+
invokeMethod = 'homeVod';
62+
break;
63+
case '一级':
64+
invokeMethod = 'cate';
65+
break;
66+
case '二级':
67+
invokeMethod = 'detail';
68+
break;
69+
case '搜索':
70+
invokeMethod = 'search';
71+
break;
72+
case 'lazy':
73+
invokeMethod = 'play';
74+
break;
75+
case 'proxy_rule':
76+
invokeMethod = 'proxy';
77+
break;
78+
case 'action':
79+
invokeMethod = 'action';
80+
break;
81+
}
82+
if (!invokeMethod) {
83+
if (typeof RULE[_method] !== 'function') {
84+
return null
85+
} else {
86+
return await RULE[_method]
87+
}
88+
}
89+
return await drpy[invokeMethod](_modulePath, _env, ..._args)
90+
};
91+
return RULE
3692
};
3793
const pg = Number(query.pg) || 1;
3894
try {

Diff for: controllers/config.js

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ async function generateSiteJSON(jsDir, requestHost, sub, subFilePath) {
6666
searchable: ruleObject.searchable,
6767
filterable: ruleObject.filterable,
6868
quickSearch: ruleObject.quickSearch,
69+
more: ruleObject.more,
6970
ext: "", // 固定为空字符串
7071
};
7172
sites.push(site);

Diff for: custom.json

+32-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"sites_count": 36,
2+
"sites_count": 37,
33
"sites": [
44
{
55
"key": "drpyS_设置中心",
@@ -9,6 +9,27 @@
99
"searchable": 0,
1010
"filterable": 0,
1111
"quickSearch": 0,
12+
"more": {
13+
"sourceTag": "设置,动作",
14+
"actions": [
15+
{
16+
"name": "查看夸克cookie",
17+
"action": "查看夸克cookie"
18+
},
19+
{
20+
"name": "设置夸克cookie",
21+
"action": "设置夸克cookie"
22+
},
23+
{
24+
"name": "夸克扫码",
25+
"action": "夸克扫码"
26+
},
27+
{
28+
"name": "设置玩偶域名",
29+
"action": "{\"actionId\":\"玩偶域名\",\"id\":\"domain\",\"type\":\"input\",\"width\":450,\"title\":\"玩偶域名\",\"tip\":\"请输入玩偶域名\",\"value\":\"\",\"msg\":\"选择或输入使用的域名\",\"selectData\":\"1:=https://www.wogg.net/,2:=https://wogg.xxooo.cf/,3:=https://wogg.888484.xyz/,4:=https://www.wogg.bf/,5:=https://woggapi.333232.xyz/\"}"
30+
}
31+
]
32+
},
1233
"ext": ""
1334
},
1435
{
@@ -81,6 +102,16 @@
81102
"quickSearch": 0,
82103
"ext": ""
83104
},
105+
{
106+
"key": "drpyS_多多[盘]",
107+
"name": "多多[盘](DS)",
108+
"type": 4,
109+
"api": "http://localhost:5757/api/多多[盘]",
110+
"searchable": 1,
111+
"filterable": 1,
112+
"quickSearch": 0,
113+
"ext": ""
114+
},
84115
{
85116
"key": "drpyS_番薯动漫[漫]",
86117
"name": "番薯动漫[漫](DS)",

Diff for: docs/ruleAttr.md

+10
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,13 @@ var rule = {
7878
},
7979
}
8080
```
81+
82+
# action说明
83+
84+
返回的action里可以包含按钮,属性为`button`,按钮的值说明如下:
85+
86+
* 0:关闭按钮
87+
* 1:取消按钮
88+
* 2:确定和取消
89+
* 3.确定、取消、重置
90+
* 4.确定、取消、重置、预览

Diff for: docs/updateRecord.md

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

3+
### 20241230
4+
5+
更新至V1.0.26
6+
7+
1. 设置中心优化,样式适配装逼壳。并支持全局站源动作
8+
2. 增加简繁体转换函数 `simplecc`,用法如下:
9+
简体转繁体: `simplecc("发财了去植发", "s2t")`
10+
繁体转简体: `simplecc("發財了去植髮", "t2s")`
11+
3. 增加源相互调用功能,仅支持在源的特定函数里使用,示例:
12+
```javascript
13+
let {proxyUrl, getRule} = this;
14+
const tx_rule = await getRule('腾云驾雾[官]');
15+
if (tx_rule) {
16+
log(tx_rule.url);
17+
log(tx_rule.title);
18+
// log(JSON.stringify(tx_rule));
19+
let data1 = await tx_rule.callRuleFn('搜索', ['斗罗大陆'])
20+
log(data1);
21+
let data2 = await tx_rule.callRuleFn('一级', ['tv'])
22+
log(data2);
23+
}else{
24+
log('没有这个原')
25+
}
26+
```
27+
328
### 20241229
429

530
更新至V1.0.25

Diff for: index.json

+32-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"sites_count": 36,
2+
"sites_count": 37,
33
"sites": [
44
{
55
"key": "drpyS_设置中心",
@@ -9,6 +9,27 @@
99
"searchable": 0,
1010
"filterable": 0,
1111
"quickSearch": 0,
12+
"more": {
13+
"sourceTag": "设置,动作",
14+
"actions": [
15+
{
16+
"name": "查看夸克cookie",
17+
"action": "查看夸克cookie"
18+
},
19+
{
20+
"name": "设置夸克cookie",
21+
"action": "设置夸克cookie"
22+
},
23+
{
24+
"name": "夸克扫码",
25+
"action": "夸克扫码"
26+
},
27+
{
28+
"name": "设置玩偶域名",
29+
"action": "{\"actionId\":\"玩偶域名\",\"id\":\"domain\",\"type\":\"input\",\"width\":450,\"title\":\"玩偶域名\",\"tip\":\"请输入玩偶域名\",\"value\":\"\",\"msg\":\"选择或输入使用的域名\",\"selectData\":\"1:=https://www.wogg.net/,2:=https://wogg.xxooo.cf/,3:=https://wogg.888484.xyz/,4:=https://www.wogg.bf/,5:=https://woggapi.333232.xyz/\"}"
30+
}
31+
]
32+
},
1233
"ext": ""
1334
},
1435
{
@@ -81,6 +102,16 @@
81102
"quickSearch": 0,
82103
"ext": ""
83104
},
105+
{
106+
"key": "drpyS_多多[盘]",
107+
"name": "多多[盘](DS)",
108+
"type": 4,
109+
"api": "http://localhost:5757/api/多多[盘]",
110+
"searchable": 1,
111+
"filterable": 1,
112+
"quickSearch": 0,
113+
"ext": ""
114+
},
84115
{
85116
"key": "drpyS_番薯动漫[漫]",
86117
"name": "番薯动漫[漫](DS)",

Diff for: js/_fq3.js

+21-4
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ function test_ua() {
5252
log('XMLHttpRequest:', typeof XMLHttpRequest)
5353
const xhr = new XMLHttpRequest();
5454
log(xhr);
55-
55+
let aa = simplecc("发财了去植发", "s2t"); // '發財了去植髮'
56+
let bb = simplecc("發財了去植髮", "t2s"); // '发财了去植发'
57+
log('aa:', aa)
58+
log('bb:', bb)
5659
}
5760

5861
// 下面这个代码放哪儿都是可以后端持续执行任务,比如放class_parse里
@@ -79,13 +82,27 @@ const rule = {
7982
host: 'https://fanqienovel.com/',
8083
homeUrl: 'https://fanqienovel.com/api/author/book/category_list/v0/',
8184
url: '/api/author/library/book_list/v0/?page_count=18&page_index=(fypage-1)&gender=-1&category_id=fyclass&creation_status=-1&word_count=-1&sort=0#fyfilter',
82-
class_parse: async () => {
85+
class_parse: async function () {
86+
let {proxyUrl, getRule} = this;
8387
// let ip = await getPublicIp1();
8488
let ip = await getPublicIp2();
8589
log('ip:', ip);
86-
test_ua();
90+
// test_ua();
91+
log('proxyUrl:', proxyUrl);
92+
log('type of getRule:', typeof getRule);
8793
// test_rc4()
88-
94+
const tx_rule = await getRule('腾云驾雾[官]');
95+
if (tx_rule) {
96+
log(tx_rule.url);
97+
log(tx_rule.title);
98+
// log(JSON.stringify(tx_rule));
99+
let data1 = await tx_rule.callRuleFn('搜索', ['斗罗大陆'])
100+
log(data1);
101+
let data2 = await tx_rule.callRuleFn('一级', ['tv'])
102+
log(data2);
103+
} else {
104+
log('没有这个原')
105+
}
89106
/*
90107
(async ()=>{
91108
for (let i = 1; i <= 100; i++) {

0 commit comments

Comments
 (0)