@@ -112,7 +112,7 @@ desc: "${desc}"`;
112112
113113//信息中转站
114114let bodyBox = [ ] ; //存储待转换的内容
115- let otherRule = [ ] ; //不支持的规则
115+ let otherRule = [ ] ; //不支持的规则&脚本
116116let inBox = [ ] ; //被释放的重写或规则
117117let outBox = [ ] ; //被排除的重写或规则
118118let modInfoBox = [ ] ; //模块简介等信息
@@ -582,7 +582,6 @@ rules.push(mark+ruletype+","+rulevalue+","+rulepolicy)
582582 } else { otherRule . push ( ruletype + rulevalue + rulepolicy ) } ;
583583
584584 } ; //for rule输出结束
585- noNtf == false && otherRule . length != 0 && $ . msg ( 'Script Hub: 重写转换' , '不支持的规则' , `${ otherRule } ` )
586585
587586//reject redirect 输出
588587switch ( targetApp ) {
@@ -654,12 +653,13 @@ switch (targetApp){
654653 noteK = jsBox [ i ] . noteK ? "#" : "" ;
655654 mark = jsBox [ i ] . mark ? jsBox [ i ] . mark + "\n" : "" ;
656655 jstype = jsBox [ i ] . jstype ;
657- jsptn = / g e n e r i c | e v e n t / . test ( jstype ) ? "" : jsBox [ i ] . jsptn ;
656+ jsptn = / g e n e r i c | e v e n t | d n s | r u l e | n e t w o r k - c h a n g e d / . test ( jstype ) ? "" : jsBox [ i ] . jsptn ;
658657 jsptn = isLooniOS && jsptn ? " " + jsptn : jsptn ;
659658 if ( / , / . test ( jsptn ) && isSurgeiOS ) jsptn = '"' + jsptn + '"' ;
660659 if ( ( isSurgeiOS || isShadowrocket ) && jsptn != "" ) jsptn = ', pattern=' + jsptn ;
661660 jsname = jsBox [ i ] . jsname ;
662- eventname = jsBox [ i ] . eventname ? ', event-name=' + jsBox [ i ] . eventname : "" ;
661+ eventname = jsBox [ i ] . eventname ? ', event-name=' + jsBox [ i ] . eventname :', event-name=network-changed' ;
662+ jstype = isLooniOS && / e v e n t / . test ( jstype ) ? 'network-changed' : ! isLooniOS && / n e t w o r k - c h a n g e d / . test ( jstype ) ? 'event' : jstype ;
663663 jsurl = jsBox [ i ] . jsurl ;
664664 rebody = jsBox [ i ] . rebody ? ", requires-body=" + jsBox [ i ] . rebody : "" ;
665665 proto = jsBox [ i ] . proto ? ", binary-body-mode=" + jsBox [ i ] . proto : "" ;
@@ -672,12 +672,25 @@ switch (targetApp){
672672 jsarg = jsBox [ i ] . jsarg ? jsBox [ i ] . jsarg : "" ;
673673 if ( jsarg != "" && / , / . test ( jsarg ) ) jsarg = ', argument="' + jsarg + '"' ;
674674 if ( jsarg != "" && ! / , / . test ( jsarg ) ) jsarg = ', argument=' + jsarg ;
675- if ( ! / e v e n t | c r o n / . test ( jstype ) && isLooniOS ) script . push ( mark + noteK + jstype + jsptn + " script-path=" + jsurl + rebody + proto + timeout + ", tag=" + jsname + jsarg ) ;
676- if ( ! / e v e n t | c r o n / . test ( jstype ) && ( isSurgeiOS || isShadowrocket ) ) script . push ( mark + noteK + jsname + " = type=" + jstype + jsptn + ", script-path=" + jsurl + rebody + proto + size + ability + updatatime + timeout + jsarg )
677- if ( jstype == "event" && ( isSurgeiOS || isShadowrocket ) ) script . push ( mark + noteK + jsname + " = type=" + jstype + eventname + ", script-path=" + jsurl + ability + updatatime + timeout + jsarg )
678- if ( jstype == "cron" && ( isSurgeiOS || isShadowrocket ) ) script . push ( mark + noteK + jsname + ' = type=' + jstype + ', cronexp="' + cronexp + '"' + ', script-path=' + jsurl + updatatime + timeout + wakesys + jsarg ) ;
679- if ( jstype == "cron" && isLooniOS ) script . push ( mark + noteK + jstype + ' "' + cronexp + '"' + " script-path=" + jsurl + timeout + ', tag=' + jsname + jsarg )
680- if ( isSurgeiOS && jstype == "generic" ) Panel . push ( jsname + " = script-name=" + jsname + ", update-interval=3600" )
675+
676+ if ( / g e n e r i c / . test ( jstype ) && isShadowrocket ) {
677+ otherRule . push ( noteK + jsname + " = type=" + jstype + jsptn + ", script-path=" + jsurl + rebody + proto + size + ability + updatatime + timeout + jsarg ) ;
678+ } else if ( / r e q u e s t | r e s p o n s e | n e t w o r k - c h a n g e d | g e n e r i c / . test ( jstype ) && isLooniOS ) {
679+ script . push ( mark + noteK + jstype + jsptn + " script-path=" + jsurl + rebody + proto + timeout + ", tag=" + jsname + jsarg ) ;
680+ } else if ( / r e q u e s t | r e s p o n s e | g e n e r i c / . test ( jstype ) && ( isSurgeiOS || isShadowrocket ) ) {
681+ script . push ( mark + noteK + jsname + " = type=" + jstype + jsptn + ", script-path=" + jsurl + rebody + proto + size + ability + updatatime + timeout + jsarg ) ;
682+ } else if ( jstype == "event" && ( isSurgeiOS || isShadowrocket ) ) {
683+ script . push ( mark + noteK + jsname + " = type=" + jstype + eventname + ", script-path=" + jsurl + ability + updatatime + timeout + jsarg ) ;
684+ } else if ( jstype == "cron" && ( isSurgeiOS || isShadowrocket ) ) {
685+ script . push ( mark + noteK + jsname + ' = type=' + jstype + ', cronexp="' + cronexp + '"' + ', script-path=' + jsurl + updatatime + timeout + wakesys + jsarg ) ;
686+ } else if ( jstype == "cron" && isLooniOS ) {
687+ script . push ( mark + noteK + jstype + ' "' + cronexp + '"' + " script-path=" + jsurl + timeout + ', tag=' + jsname + jsarg ) ;
688+ } else {
689+ otherRule . push ( noteK + jsname + " = type=" + jstype + jsptn + ", script-path=" + jsurl + rebody + proto + size + ability + updatatime + timeout + jsarg ) } ;
690+
691+ if ( isSurgeiOS && jstype == "generic" ) {
692+ Panel . push ( jsname + " = script-name=" + jsname + ", update-interval=3600" )
693+ } ;
681694 } ; //for
682695 break ;
683696
@@ -714,14 +727,21 @@ noteKn8 = "\n ";noteKn6 = "\n ";noteKn4 = "\n ";noteK4 = " ";n
714727 tilesicon = jsBox [ i ] . tilesicon ? jsBox [ i ] . tilesicon : "" ;
715728 tilescolor = jsBox [ i ] . tilescolor ? jsBox [ i ] . tilescolor : "" ;
716729
717- if ( jstype != "cron" && jstype != "generic" ) script . push ( mark + noteKn4 + '- match: ' + jsptn + noteKn6 + 'name: "' + jsname + '"' + noteKn6 + 'type: ' + jstype + rebody + size + proto + timeout + jsarg )
718- providers . push ( `${ noteK2 } "` + jsname + '":' + `${ noteKn4 } url: ` + jsurl + `${ noteKn4 } interval: 86400` )
719- if ( jstype == "cron" ) cron . push ( mark + `${ noteKn4 } - name: "` + jsname + `"${ noteKn6 } cron: "` + cronexp + `"${ timeout } ` + jsarg ) ;
720- providers . push ( `${ noteK2 } "` + jsname + '":' + `${ noteKn4 } url: ` + jsurl + `${ noteKn4 } interval: 86400` )
721- if ( jstype == "generic" ) tiles . push (
730+ if ( / r e q u e s t | r e s p o n s e / . test ( jstype ) ) {
731+ script . push ( mark + noteKn4 + '- match: ' + jsptn + noteKn6 + 'name: "' + jsname + '"' + noteKn6 + 'type: ' + jstype + rebody + size + proto + timeout + jsarg ) ;
732+ providers . push ( `${ noteK2 } "` + jsname + '":' + `${ noteKn4 } url: ` + jsurl + `${ noteKn4 } interval: 86400` ) ;
733+ } ;
734+ if ( jstype == "cron" ) {
735+ cron . push ( mark + `${ noteKn4 } - name: "` + jsname + `"${ noteKn6 } cron: "` + cronexp + `"${ timeout } ` + jsarg ) ;
736+ providers . push ( `${ noteK2 } "` + jsname + '":' + `${ noteKn4 } url: ` + jsurl + `${ noteKn4 } interval: 86400` ) ;
737+ } ;
738+ if ( jstype == "generic" ) {
739+ tiles . push (
722740 mark + `${ noteK2 } - name: "${ jsname } "${ noteKn4 } interval: 3600${ noteKn4 } title: "${ jsname } "${ noteKn4 } icon: "${ tilesicon } "${ noteKn4 } backgroundColor: "${ tilescolor } "${ noteKn4 } timeout: 30${ jsarg } ` ) ;
723741 providers . push (
724742 `${ noteK2 } "${ jsname } ":${ noteKn4 } url: ${ jsurl } ${ noteKn4 } interval: 86400` ) ;
743+ } ;
744+ / e v e n t | r u l e | d n s / i. test ( jstype ) && otherRule . push ( noteK + jsname + " = type=" + jstype + ", script-path=" + jsurl ) ;
725745} ; //for循环
726746break ;
727747} ; //script输出结束
@@ -901,11 +921,11 @@ ${providers}
901921
902922} ; //输出内容结束
903923
904-
905-
906924eval ( evJsmodi ) ;
907925eval ( evUrlmodi ) ;
908926
927+ noNtf == false && otherRule . length != 0 && $ . msg ( 'Script Hub: 重写转换' , '不支持的规则' , `${ otherRule } ` )
928+
909929$ . done ( { response : { status : 200 , body :body , headers : { 'Content-Type' : 'text/plain; charset=utf-8' } } } ) ;
910930
911931} ) ( )
0 commit comments