1- import cheerio from './cheerio.min.js' ;
2- import 模板 from './模板.js'
3- import { gbkTool } from './gbk.min.js'
4- import './crypto-js.min.js' ;
5- import './jsencrypt.min.js' ;
6- import './node-rsa.js' ;
7- import './pako.min.js' ;
8- // import JSEncrypt from './jsencrypt.js'; // 会导致壳子崩溃的
9- import './json5.min.js'
10- // 下面是尝试对jinja2库进行更换
11- import './jinja.min.js'
12- // 新增wasm支持
13- import './polywasm.min.js'
14- // TextEncoder,TextDecoder对象 引入不进来,下面两行代码都不行
15- // import './encoding.min.js'
16- // import './xxhash-wasm.min.js'
17-
18-
19- const _jinja2 = cheerio . jinja2 ;
20- cheerio . jinja2 = function ( template , obj ) {
21- try {
22- return jinja . render ( template , obj ) ;
23- } catch ( e ) {
24- console . log ( '新的jinja2库渲染失败,换回原始cheerio:' + e . message ) ;
25- return _jinja2 ( template , obj )
26- }
27- } ;
28- // import cheerio from "https://ghproxy.net/https://raw.githubusercontent.com/hjdhnx/dr_py/main/libs/cheerio.min.js";
29- // import "https://ghproxy.net/https://raw.githubusercontent.com/hjdhnx/dr_py/main/libs/crypto-js.js";
30- // import 模板 from"https://ghproxy.net/https://raw.githubusercontent.com/hjdhnx/dr_py/main/js/模板.js";
31- // import {gbkTool} from 'https://ghproxy.net/https://raw.githubusercontent.com/hjdhnx/dr_py/main/libs/gbk.js'
1+ import { cheerio , 模板 } from '../dist/drpy-core.min.js' ;
322
333let vercode = typeof ( pdfl ) === 'function' ? 'drpy2.1' : 'drpy2' ;
34- const VERSION = vercode + ' 3.9.52beta1 20250728 ' ;
4+ const VERSION = vercode + ' 3.9.52beta2 20250729 ' ;
355const UpdateInfo = [
6+ {
7+ date : '20250729' ,
8+ title : 'drpy更新,所有依赖打包成一个js文件' ,
9+ version : '3.9.52beta2 20250729' ,
10+ msg : `
11+ 1. wasm支持
12+ 2. 引入 TextEncoder、TextDecoder对象
13+ 3. 引入 WXXH 加解密库
14+ 4. 所有依赖打包成一个js
15+ 5. 增加 buildQueryString
16+
17+ `
18+ } ,
3619 {
3720 date : '20250728' ,
3821 title : 'drpy更新,增加tab_order线路模糊排序,优化解密算法支持文件头' ,
@@ -81,10 +64,35 @@ function init_test() {
8164 // print(模板);
8265 // print(typeof(模板.getMubans));
8366 console . log ( "当前版本号:" + VERSION ) ;
84- console . log ( "typeof TextEncoder:" + typeof TextEncoder ) ;
85- console . log ( "typeof TextDecoder:" + typeof TextDecoder ) ;
86- console . log ( "typeof WebAssembly:" + typeof WebAssembly ) ;
87- console . log ( "typeof WXXH:" + typeof WXXH ) ;
67+ /*
68+ console.log('typeof 模板:', typeof (模板))
69+ console.log('typeof cheerio:', typeof (cheerio))
70+ // console.log(模板)
71+ console.log('typeof gbkTool:', typeof gbkTool);
72+ console.log('typeof CryptoJS:', typeof CryptoJS);
73+ console.log('typeof JSEncrypt:', typeof JSEncrypt);
74+ console.log('typeof NODERSA:', typeof NODERSA);
75+ console.log('typeof pako:', typeof pako);
76+ console.log('typeof JSON5:', typeof JSON5);
77+ console.log('typeof JSONPath:', typeof JSONPath);
78+ console.log('typeof jinja:', typeof jinja);
79+ console.log('typeof WebAssembly:', typeof WebAssembly);
80+ console.log('typeof TextEncoder:', typeof TextEncoder);
81+ console.log('typeof TextDecoder:', typeof TextDecoder);
82+ console.log('typeof WXXH:', typeof WXXH);
83+
84+ console.log(gbkTool.encode('你好'));
85+ console.log(gbkTool.decode('%C4%E3%BA%C3'));
86+
87+ const s = '{"method":"GET","timestamp":1745206708456,"path":"/index/fuck","parameters":{"timestamp":["1745206708456"]},"body":""}';
88+ const seed = 1745206708;
89+ const hash = WXXH.h64(s, seed).toString(16);
90+ console.log(`WASM:${hash}`);
91+
92+ console.log(cheerio.jinja2('渲染一个变量{{hash}}', {hash}));
93+ console.log('jsonpath取值测试:', cheerio.jp('$.name', {name: '道长', project: 'drpys'}));
94+ */
95+
8896 console . log ( '本地代理地址:' + getProxyUrl ( ) ) ;
8997 console . log ( RKEY ) ;
9098 // ocr_demo_test();
@@ -896,8 +904,7 @@ function ungzip(b64Data) {
896904function encodeStr ( input , encoding ) {
897905 encoding = encoding || 'gbk' ;
898906 if ( encoding . startsWith ( 'gb' ) ) {
899- const strTool = gbkTool ( ) ;
900- input = strTool . encode ( input ) ;
907+ input = gbkTool . encode ( input ) ;
901908 }
902909 return input
903910}
@@ -911,8 +918,7 @@ function encodeStr(input, encoding) {
911918function decodeStr ( input , encoding ) {
912919 encoding = encoding || 'gbk' ;
913920 if ( encoding . startsWith ( 'gb' ) ) {
914- const strTool = gbkTool ( ) ;
915- input = strTool . decode ( input ) ;
921+ input = gbkTool . decode ( input ) ;
916922 }
917923 return input
918924}
@@ -1716,6 +1722,27 @@ function keysToLowerCase(obj) {
17161722 } , { } ) ;
17171723}
17181724
1725+ //对象To字符串query
1726+ function buildQueryString ( params ) {
1727+ const queryArray = [ ] ;
1728+ for ( const key in params ) {
1729+ if ( params . hasOwnProperty ( key ) ) {
1730+ // 处理参数值:兼容null、undefined,转为字符串并编码
1731+ let value = params [ key ] ;
1732+ if ( value === undefined || value === null ) {
1733+ value = "" ;
1734+ } else {
1735+ value = value . toString ( ) ;
1736+ }
1737+ // 编码键值(兼容ES5)
1738+ const encodedKey = encodeURIComponent ( key ) ;
1739+ const encodedValue = encodeURIComponent ( value ) ;
1740+ queryArray . push ( encodedKey + "=" + encodedValue ) ;
1741+ }
1742+ }
1743+ return queryArray . join ( "&" ) ;
1744+ }
1745+
17191746//字符串To对象
17201747function parseQueryString ( query ) {
17211748 const params = { } ;
0 commit comments