@@ -28,6 +28,7 @@ import {base64Decode, base64Encode, md5, rc4, rc4_decode, rc4Decrypt, rc4Encrypt
2828import { getContentType , getMimeType } from "../utils/mime-type.js" ;
2929import { getParsesDict } from "../utils/file.js" ;
3030import { getFirstLetter } from "../utils/pinyin-tool.js" ;
31+ import { reqs } from "../utils/req.js" ;
3132import "../utils/random-http-ua.js" ;
3233import template from '../libs_drpy/template.js'
3334import batchExecute from '../libs_drpy/batchExecute.js' ;
@@ -43,12 +44,15 @@ import '../libs_drpy/jinja.js'
4344import '../libs_drpy/drpyCustom.js'
4445import { rootRequire , initializeGlobalDollar } from "../libs_drpy/moduleLoader.js" ;
4546// import '../libs_drpy/crypto-js-wasm.js'
47+ import forge from "node-forge" ;
4648
4749const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) ) ;
4850const _data_path = path . join ( __dirname , '../data' ) ;
4951const _config_path = path . join ( __dirname , '../config' ) ;
5052const _lib_path = path . join ( __dirname , '../spider/js' ) ;
5153
54+ globalThis . reqs = reqs ;
55+ globalThis . forge = forge
5256globalThis . misc = misc ;
5357globalThis . utils = utils ;
5458globalThis . COOKIE = COOKIE ;
@@ -170,6 +174,7 @@ try {
170174
171175let simplecc = null ;
172176try {
177+ // 尝试动态导入模块puppeteerHelper
173178 const simWasm = await import ( 'simplecc-wasm' ) ; // 使用动态 import
174179 simplecc = simWasm . simplecc ;
175180 console . log ( 'simplecc imported successfully' ) ;
@@ -221,7 +226,10 @@ export async function getSandbox(env = {}) {
221226 getProxyUrl,
222227 hostUrl,
223228 fServer,
224- getContentType, getMimeType, getParsesDict, getFirstLetter
229+ getContentType,
230+ getMimeType,
231+ getParsesDict,
232+ getFirstLetter
225233 } ;
226234 const drpySanbox = {
227235 jsp,
@@ -294,6 +302,7 @@ export async function getSandbox(env = {}) {
294302 parseQueryString,
295303 encodeIfContainsSpecialChars,
296304 objectToQueryString,
305+ forge
297306 } ;
298307
299308 const libsSanbox = {
@@ -1022,6 +1031,23 @@ async function cateParse(rule, tid, pg, filter, extend) {
10221031 } else if ( pg > 1 && url . includes ( '[' ) && url . includes ( ']' ) ) {
10231032 url = url . split ( '[' ) [ 0 ] ;
10241033 }
1034+ if ( rule . filter_def && typeof ( rule . filter_def ) === 'object' ) {
1035+ try {
1036+ if ( Object . keys ( rule . filter_def ) . length > 0 && rule . filter_def . hasOwnProperty ( tid ) ) {
1037+ let self_fl_def = rule . filter_def [ tid ] ;
1038+ if ( self_fl_def && typeof ( self_fl_def ) === 'object' ) {
1039+ let k = [ Object . keys ( self_fl_def ) ] [ 0 ]
1040+ k . forEach ( k => {
1041+ if ( ! extend . hasOwnProperty ( k ) ) {
1042+ extend [ k ] = self_fl_def [ k ] ;
1043+ }
1044+ } )
1045+ }
1046+ }
1047+ } catch ( e ) {
1048+ log ( `合并不同分类对应的默认筛选出错:${ e . message } ` ) ;
1049+ }
1050+ }
10251051 if ( rule . filter_url ) {
10261052 if ( ! / f y f i l t e r / . test ( url ) ) {
10271053 if ( ! url . endsWith ( '&' ) && ! rule . filter_url . startsWith ( '&' ) ) {
0 commit comments