@@ -1646,12 +1646,15 @@ if (binaryInfo != null && binaryInfo.length > 0) {
16461646 jsarg
16471647 )
16481648 } else if ( jstype == 'cron' && isLooniOS ) {
1649+ const loonCronexp = / ^ \{ [ ^ { } ] + \} $ / . test ( `${ cronexp ?? '' } ` . trim ( ) )
1650+ ? `${ cronexp ?? '' } ` . trim ( )
1651+ : `"${ `${ cronexp ?? '' } ` . replace ( / " / g, '' ) } "`
16491652 script . push (
16501653 mark +
16511654 noteK +
16521655 jstype +
16531656 ' ' +
1654- `" ${ cronexp . replace ( / " / g , '' ) } "` +
1657+ loonCronexp +
16551658 ' script-path=' +
16561659 jsurl +
16571660 timeout +
@@ -2230,14 +2233,14 @@ function getSurgeTemplateArgumentKeys(str) {
22302233
22312234function parseSurgeTemplateArgumentPairs ( str , renameMap = argumentKeyRenameMap ) {
22322235 str = stripWrapQuote ( str )
2233- if ( ! / \{ \{ \{ [ ^ { } ] + \} \} \} / . test ( str ) || ! / & / . test ( str ) && ! / ^ \s * [ ^ = \s ] + \s * = / . test ( str ) ) return [ ]
2236+ if ( ! / ( \{ \{ \{ [ ^ { } ] + \} \} \} | \{ [ ^ { } ] + \} ) / . test ( str ) || ! / & / . test ( str ) && ! / ^ \s * [ ^ = \s ] + \s * = / . test ( str ) ) return [ ]
22342237 const items = splitTopLevel ( str , '&' )
22352238 const pairs = [ ]
22362239 for ( let i = 0 ; i < items . length ; i ++ ) {
2237- const matched = items [ i ] . match ( / ^ \s * ( [ ^ = \s ] + ) \s * = \s * [ " ' ] ? \{ \{ \{ ( [ ^ { } ] + ) \} \} \} [ " ' ] ? \s * $ / )
2240+ const matched = items [ i ] . match ( / ^ \s * ( [ ^ = \s ] + ) \s * = \s * [ " ' ] ? (?: \{ \{ \{ ( [ ^ { } ] + ) \} \} \} | \{ ( [ ^ { } ] + ) \} ) [ " ' ] ? \s * $ / )
22382241 if ( ! matched ) return [ ]
22392242 const scriptKey = matched [ 1 ] . trim ( )
2240- const templateKey = matched [ 2 ] . trim ( )
2243+ const templateKey = ( matched [ 2 ] || matched [ 3 ] || '' ) . trim ( )
22412244 if ( scriptKey && templateKey ) renameMap . set ( templateKey , scriptKey )
22422245 pairs . push ( { scriptKey, templateKey } )
22432246 }
0 commit comments