@@ -371,7 +371,16 @@ function RegexDeleteOperator(regex) {
371371 1. This function name should be `operator`!
372372 2. Always declare variables before using them!
373373 */
374- function ScriptOperator ( script , targetPlatform , $arguments , source , $options ) {
374+ function ScriptOperator (
375+ script ,
376+ targetPlatform ,
377+ $arguments ,
378+ source ,
379+ $options ,
380+ context ,
381+ ) {
382+ context . source = source ;
383+ context . env = env ;
375384 return {
376385 name : 'Script Operator' ,
377386 func : async ( proxies ) => {
@@ -423,7 +432,7 @@ function ScriptOperator(script, targetPlatform, $arguments, source, $options) {
423432 $arguments ,
424433 $options ,
425434 ) ;
426- output = operator ( proxies , targetPlatform , { source , ... env } ) ;
435+ output = operator ( proxies , targetPlatform , context ) ;
427436 } ) ( ) ;
428437 return output ;
429438 } ,
@@ -432,7 +441,7 @@ function ScriptOperator(script, targetPlatform, $arguments, source, $options) {
432441 await ( async function ( ) {
433442 const operator = createDynamicFunction (
434443 'operator' ,
435- `async function operator(input = []) {
444+ `async function operator(input = [], targetPlatform, context ) {
436445 if (input && (input.$files || input.$content)) {
437446 let { $content, $files, $options, $file } = input
438447 if($file.type === 'mihomoProfile') {
@@ -475,7 +484,7 @@ function ScriptOperator(script, targetPlatform, $arguments, source, $options) {
475484 $arguments ,
476485 $options ,
477486 ) ;
478- output = operator ( proxies , targetPlatform , { source , ... env } ) ;
487+ output = operator ( proxies , targetPlatform , context ) ;
479488 } ) ( ) ;
480489 return output ;
481490 } ,
@@ -949,7 +958,16 @@ function TypeFilter(input) {
949958 1. This function name should be `filter`!
950959 2. Always declare variables before using them!
951960 */
952- function ScriptFilter ( script , targetPlatform , $arguments , source , $options ) {
961+ function ScriptFilter (
962+ script ,
963+ targetPlatform ,
964+ $arguments ,
965+ source ,
966+ $options ,
967+ context ,
968+ ) {
969+ context . source = source ;
970+ context . env = env ;
953971 return {
954972 name : 'Script Filter' ,
955973 func : async ( proxies ) => {
@@ -961,7 +979,7 @@ function ScriptFilter(script, targetPlatform, $arguments, source, $options) {
961979 $arguments ,
962980 $options ,
963981 ) ;
964- output = filter ( proxies , targetPlatform , { source , ... env } ) ;
982+ output = filter ( proxies , targetPlatform , context ) ;
965983 } ) ( ) ;
966984 return output ;
967985 } ,
@@ -970,7 +988,7 @@ function ScriptFilter(script, targetPlatform, $arguments, source, $options) {
970988 await ( async function ( ) {
971989 const filter = createDynamicFunction (
972990 'filter' ,
973- `async function filter(input = []) {
991+ `async function filter(input = [], targetPlatform, context ) {
974992 let proxies = input
975993 let list = []
976994 const fn = async ($server) => {
@@ -984,7 +1002,7 @@ function ScriptFilter(script, targetPlatform, $arguments, source, $options) {
9841002 $arguments ,
9851003 $options ,
9861004 ) ;
987- output = filter ( proxies , targetPlatform , { source , ... env } ) ;
1005+ output = filter ( proxies , targetPlatform , context ) ;
9881006 } ) ( ) ;
9891007 return output ;
9901008 } ,
0 commit comments