Skip to content

Commit 7106ea4

Browse files
author
Taois
committed
feat:增加更多函数支持
1. 给ds注入get_size、toBeijingTime函数 2. 新增catvod格式的alist源及扩展文件alist.json 3. 优化catvod/hipy 适配器,支持同ds一样的传参用法 4. 优化webdav及ftp,文件大小和日期人类可读显示
1 parent e06a0f2 commit 7106ea4

File tree

16 files changed

+1314
-25
lines changed

16 files changed

+1314
-25
lines changed

config/map.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ webdav[盘]@@?render=1&type=url&params=../json/webdav.json@@WebDav[盘]
22
webdav[盘]@@?render=1&type=url&params=../json/webdav影视.json@@WebDavZn[盘]
33
webdav影视[盘]@@?render=1&type=url&params=../json/webdav.json@@WebDav影视[盘]
44
ftp[盘]@@?render=1&type=url&params=../json/ftp.json@@FTP[盘]
5+
alist@@?render=1&type=url&params=../json/alist.json@@Alist[盘]
56
哔哩收藏[官]@@?render=1&type=url&params=../json/哔哩收藏.json@@哔哩收藏[官]
67
我的哔哩[官]@@?render=1&type=url&params=../json/哔哩教育.json@@哔哩教育[官]
78
我的哔哩[官]@@?render=1&type=url&params=../json/哔哩少儿.json@@哔哩少儿[官]

controllers/config.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -446,9 +446,13 @@ async function generateSiteJSON(options, requestHost, sub, pwd) {
446446
SitesMap[baseName].forEach((it) => {
447447
let key = `hipy_py_${it.alias}`;
448448
let name = `${it.alias}(hipy)`;
449-
let _ext = it.queryStr;
450-
if (!enableOldConfig) {
451-
_ext = parseExt(_ext);
449+
let _ext = it.queryObject.type === 'url' ? it.queryObject.params : it.queryStr;
450+
if (_ext && _ext !== it.queryStr) {
451+
_ext = jsEncoder.gzip(_ext);
452+
} else {
453+
if (!enableOldConfig) {
454+
_ext = parseExt(_ext);
455+
}
452456
}
453457
console.log(`[HIPY-${baseName}] alias name: ${name},typeof _ext:${typeof _ext},_ext: ${logExt(_ext)}`);
454458
fileSites.push({key, name, ext: _ext});
@@ -543,9 +547,13 @@ async function generateSiteJSON(options, requestHost, sub, pwd) {
543547
SitesMap[baseName].forEach((it) => {
544548
let key = `catvod_${it.alias}`;
545549
let name = `${it.alias}(cat)`;
546-
let _ext = it.queryStr;
547-
if (!enableOldConfig) {
548-
_ext = parseExt(_ext);
550+
let _ext = it.queryObject.type === 'url' ? it.queryObject.params : it.queryStr;
551+
if (_ext && _ext !== it.queryStr) {
552+
_ext = jsEncoder.gzip(_ext);
553+
} else {
554+
if (!enableOldConfig) {
555+
_ext = parseExt(_ext);
556+
}
549557
}
550558
console.log(`[CAT-${baseName}] alias name: ${name},typeof _ext:${typeof _ext},_ext: ${logExt(_ext)}`);
551559
fileSites.push({key, name, ext: _ext});

json/alist.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[
2+
{
3+
"name": "🙋丫仙女",
4+
"server": "http://alist.xiaoya.pro/",
5+
"startPage": "/",
6+
"showAll": false,
7+
"search": true,
8+
"headers": {
9+
"Authorization": ""
10+
},
11+
"params": {
12+
"/abc": {
13+
"password": "123"
14+
},
15+
"/abc/abc": {
16+
"password": "123"
17+
}
18+
}
19+
},
20+
{
21+
"name": "🌊七米蓝",
22+
"server": "https://al.chirmyram.com"
23+
}
24+
]

json/ftp.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
"name": "本地ftp",
44
"id": "local",
5-
"host": "192.168.31.183",
5+
"host": "192.168.31.10",
66
"port": 2121,
77
"basePath": "/宝盒/",
88
"username": "your-username",

json/webdav影视.json

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[
22
{
33
"name": "动漫",
4-
"baseURL": "https://pan.8897122.xyz/dav/动漫库",
4+
"baseURL": "https://pan.8897122.xyz/dav/动漫库/1/动漫剧",
55
"username": "webdavtv",
66
"password": "webdavtv",
77
"rejectUnauthorized": false,
@@ -10,16 +10,34 @@
1010
},
1111
{
1212
"name": "电影",
13-
"baseURL": "https://pan.8897122.xyz/dav/电影库",
13+
"baseURL": "https://pan.8897122.xyz/dav/电影库/1/电影",
1414
"username": "webdavtv",
1515
"password": "webdavtv",
1616
"rejectUnauthorized": false,
1717
"showAll": false,
1818
"timeout": 30000
1919
},
2020
{
21-
"name": "电视剧",
22-
"baseURL": "https://pan.8897122.xyz/dav/电视剧库",
21+
"name": "动画",
22+
"baseURL": "https://pan.8897122.xyz/dav/电影库/2",
23+
"username": "webdavtv",
24+
"password": "webdavtv",
25+
"rejectUnauthorized": false,
26+
"showAll": false,
27+
"timeout": 30000
28+
},
29+
{
30+
"name": "欧美剧",
31+
"baseURL": "https://pan.8897122.xyz/dav/电视剧库/1/欧美剧",
32+
"username": "webdavtv",
33+
"password": "webdavtv",
34+
"rejectUnauthorized": false,
35+
"showAll": false,
36+
"timeout": 30000
37+
},
38+
{
39+
"name": "日韩剧",
40+
"baseURL": "https://pan.8897122.xyz/dav/电视剧库/2",
2341
"username": "webdavtv",
2442
"password": "webdavtv",
2543
"rejectUnauthorized": false,

libs/catvod.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import path from "path";
22
import {readFile} from "fs/promises";
33
import {getSitesMap} from "../utils/sites-map.js";
4-
import {computeHash, deepCopy, getNowTime} from "../utils/utils.js";
4+
import {computeHash, deepCopy, getNowTime, urljoin} from "../utils/utils.js";
55
import {fileURLToPath, pathToFileURL} from 'url';
66
import {md5} from "../libs_drpy/crypto-util.js";
77
import {fastify} from "../controllers/fastlogger.js";
@@ -110,9 +110,14 @@ const init = async function (filePath, env = {}, refresh) {
110110
} catch (e) {
111111
log(`[${moduleName}] ungzip解密moduleExt失败: ${e.message}`);
112112
}
113+
log(`[${moduleName}] moduleExt:`, moduleExt);
113114
if (!SitesMap[moduleName].find(i => i.queryStr === moduleExt) && !SitesMap[moduleName].find(i => i.queryObject.params === moduleExt)) {
114115
throw new Error("moduleExt is wrong!")
115116
}
117+
if (moduleExt.startsWith('../json')) {
118+
moduleExt = urljoin(env.jsonUrl, moduleExt.slice(8));
119+
}
120+
default_init_cfg.ext = moduleExt;
116121
}
117122
let hashMd5 = md5(filePath + '#pAq#' + moduleExt);
118123
if (moduleCache.has(hashMd5) && !refresh) {

libs/drpyS.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ import * as misc from '../utils/misc.js';
1212
import COOKIE from '../utils/cookieManager.js';
1313
import AIS from '../utils/ais.js';
1414
import PanS from '../utils/pans.js';
15-
import { createWebDAVClient } from '../utils/webdav.js';
16-
import { createFTPClient } from '../utils/ftp.js';
15+
import {createWebDAVClient} from '../utils/webdav.js';
16+
import {createFTPClient} from '../utils/ftp.js';
1717
import {ENV} from '../utils/env.js';
1818
import {getContentType, getMimeType} from "../utils/mime-type.js";
1919
import {getParsesDict, getSitesMap, pathLib, es6_extend_code, req_extend_code} from "../utils/file.js";
2020
import {getFirstLetter} from "../utils/pinyin-tool.js";
2121
import {reqs} from "../utils/req.js";
22+
import {toBeijingTime} from "../utils/datetime-format.js"
2223
import "../utils/random-http-ua.js";
2324
import {initializeGlobalDollar, rootRequire} from "../libs_drpy/moduleLoader.js";
2425
import {base64Decode, base64Encode, md5, rc4, rc4_decode, rc4Decrypt, rc4Encrypt} from "../libs_drpy/crypto-util.js";
@@ -65,7 +66,7 @@ const {Ali, Baidu, Baidu2, Cloud, Pan, Quark, UC, Yun} = PanS;
6566
const {
6667
sleep, sleepSync, getNowTime, computeHash, deepCopy,
6768
urljoin, urljoin2, joinUrl, keysToLowerCase, naturalSort, $js,
68-
createBasicAuthHeaders
69+
createBasicAuthHeaders, get_size,
6970
} = utils;
7071
// 缓存已初始化的模块和文件 hash 值
7172
const moduleCache = new Map();
@@ -163,6 +164,7 @@ export async function getSandbox(env = {}) {
163164
naturalSort,
164165
$js,
165166
createBasicAuthHeaders,
167+
get_size,
166168
$,
167169
pupWebview,
168170
getProxyUrl,
@@ -192,6 +194,7 @@ export async function getSandbox(env = {}) {
192194
desX,
193195
req,
194196
reqs,
197+
toBeijingTime,
195198
_fetch,
196199
XMLHttpRequest,
197200
simplecc,

libs/dsGlobal.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
// 网络请求工具 - 提供HTTP请求功能
3030
import {getFirstLetter} from "../utils/pinyin-tool.js";
3131
import {createFTPClient} from "../utils/ftp.js";
32+
import {toBeijingTime} from "../utils/datetime-format.js";
3233

3334
globalThis.reqs = reqs;
3435

@@ -104,4 +105,7 @@ globalThis.MOBILE_UA = MOBILE_UA;
104105
globalThis.PC_UA = PC_UA;
105106
// 其他常用
106107
globalThis.$js = $js;
107-
globalThis.getFirstLetter = getFirstLetter;
108+
globalThis.getFirstLetter = getFirstLetter;
109+
globalThis.get_size = get_size;
110+
globalThis.urljoin = urljoin;
111+
globalThis.toBeijingTime = toBeijingTime;

libs/hipy.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import path from "path";
22
import {readFile} from "fs/promises";
33
import {getSitesMap} from "../utils/sites-map.js";
4-
import {computeHash, deepCopy, getNowTime} from "../utils/utils.js";
4+
import {computeHash, deepCopy, getNowTime, urljoin} from "../utils/utils.js";
55
import {fileURLToPath} from 'url';
66
import {md5} from "../libs_drpy/crypto-util.js";
77
import {PythonShell, PythonShellError} from 'python-shell';
@@ -211,6 +211,9 @@ const init = async function (filePath, env = {}, refresh) {
211211
if (!SitesMap[moduleName].find(i => i.queryStr === moduleExt) && !SitesMap[moduleName].find(i => i.queryObject.params === moduleExt)) {
212212
throw new Error("moduleExt is wrong!")
213213
}
214+
if (moduleExt.startsWith('../json')) {
215+
moduleExt = urljoin(env.jsonUrl, moduleExt.slice(8));
216+
}
214217
}
215218
let hashMd5 = md5(filePath + '#pAq#' + moduleExt);
216219
if (moduleCache.has(hashMd5) && !refresh) {

public/images/logo_round.png

30 KB
Loading

0 commit comments

Comments
 (0)