Skip to content

Commit 1344cc8

Browse files
author
Taois
committed
feat: 增加drpy2的相关api
1 parent 29a03ae commit 1344cc8

17 files changed

+4437
-1
lines changed

.env.development

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ ENV='staging'
77

88
LOG_WITH_FILE = 1
99
FORCE_HEADER = 0
10+
DR2_API_TYPE = 0
1011
# trace/debug/info/warn/error/fatal
1112
LOG_LEVEL = info
1213
COOKIE_AUTH_CODE = drpys

controllers/config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ async function generateSiteJSON(options, requestHost, sub, pwd) {
8484
let enableRuleName = ENV.get('enable_rule_name', '0') === '1';
8585
let isLoaded = await drpy.isLoaded();
8686
let forceHeader = Number(process.env.FORCE_HEADER) || 0;
87+
let dr2ApiType = Number(process.env.DR2_API_TYPE) || 0; // 0 ds里的api 1壳子内置
8788
// console.log('hide_adult:', ENV.get('hide_adult'));
8889
if (ENV.get('hide_adult') === '1') {
8990
valid_files = valid_files.filter(it => !(new RegExp('\\[[密]\\]|密+')).test(it));
@@ -197,7 +198,8 @@ async function generateSiteJSON(options, requestHost, sub, pwd) {
197198
return {
198199
func: async ({file, dr2Dir, requestHost, pwd, drpy, SitesMap}) => {
199200
const baseName = path.basename(file, '.js'); // 去掉文件扩展名
200-
let api = `assets://js/lib/drpy2.js`; // 使用内置drpy2
201+
// dr2ApiType=0 使用接口drpy2 dr2ApiType=1 使用壳子内置的drpy2
202+
let api = dr2ApiType ? `assets://js/lib/drpy2.js` : `${requestHost}/public/drpy2/drpy2.min.js`;
201203
let ext = `${requestHost}/js/${file}`;
202204
if (pwd) {
203205
ext += `?pwd=${pwd}`;

docs/updateRecord.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
1. 文件头增加 lang 属性,方便区分加密情况下这个源是哪张类型,`ds` `dr2` `hipy`
88
2. 修复日志输出到文件在轮转时乱创文件夹问题
99
3. drpyS 增加 `buildQueryString` 函数
10+
4. 增加drpy2的api,相关文件路径在 `public/drpy2`
1011

1112
### 20250727
1213

public/drpy2/cheerio.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/drpy2/crypto-js.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/drpy2/drpy2.js

Lines changed: 3922 additions & 0 deletions
Large diffs are not rendered by default.

public/drpy2/drpy2.min.js

Lines changed: 85 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/drpy2/encoding.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/drpy2/gbk.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/drpy2/jinja.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)