@@ -35,16 +35,16 @@ pub enum Origin {
3535 Local ,
3636 /// Remote origin.
3737 Remote {
38- /// Remote origin domain .
39- domain : String ,
38+ /// Remote URL .
39+ url : String ,
4040 } ,
4141}
4242
4343impl Display for Origin {
4444 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
4545 match self {
4646 Self :: Local => write ! ( f, "local" ) ,
47- Self :: Remote { domain } => write ! ( f, "remote: {domain }" ) ,
47+ Self :: Remote { url } => write ! ( f, "remote: {url }" ) ,
4848 }
4949 }
5050}
@@ -53,12 +53,9 @@ impl Origin {
5353 fn matches ( & self , context : & ExecutionContext ) -> bool {
5454 match ( self , context) {
5555 ( Self :: Local , ExecutionContext :: Local ) => true ,
56- (
57- Self :: Remote { domain } ,
58- ExecutionContext :: Remote {
59- domain : domain_pattern,
60- } ,
61- ) => domain_pattern. matches ( domain) ,
56+ ( Self :: Remote { url } , ExecutionContext :: Remote { url : url_pattern } ) => {
57+ url_pattern. matches ( url)
58+ }
6259 _ => false ,
6360 }
6461 }
@@ -292,7 +289,7 @@ impl RuntimeAuthority {
292289 . map( |( cmd, resolved) | {
293290 let context = match & cmd. context {
294291 ExecutionContext :: Local => "[local]" . to_string( ) ,
295- ExecutionContext :: Remote { domain } => format!( "[remote: {}]" , domain . as_str( ) ) ,
292+ ExecutionContext :: Remote { url } => format!( "[remote: {}]" , url . as_str( ) ) ,
296293 } ;
297294 format!(
298295 "- context: {context}, referenced by: {}" ,
@@ -634,11 +631,11 @@ mod tests {
634631
635632 #[ test]
636633 fn remote_domain_matches ( ) {
637- let domain = "tauri.app" ;
634+ let url = "https:// tauri.app" ;
638635 let command = CommandKey {
639636 name : "my-command" . into ( ) ,
640637 context : ExecutionContext :: Remote {
641- domain : Pattern :: new ( domain ) . unwrap ( ) ,
638+ url : Pattern :: new ( url ) . unwrap ( ) ,
642639 } ,
643640 } ;
644641 let window = "main" ;
@@ -666,21 +663,19 @@ mod tests {
666663 & command. name,
667664 window,
668665 webview,
669- & Origin :: Remote {
670- domain: domain. into( )
671- }
666+ & Origin :: Remote { url: url. into( ) }
672667 ) ,
673668 Some ( & resolved_cmd)
674669 ) ;
675670 }
676671
677672 #[ test]
678673 fn remote_domain_glob_pattern_matches ( ) {
679- let domain = "tauri.*" ;
674+ let url = "http:// tauri.*" ;
680675 let command = CommandKey {
681676 name : "my-command" . into ( ) ,
682677 context : ExecutionContext :: Remote {
683- domain : Pattern :: new ( domain ) . unwrap ( ) ,
678+ url : Pattern :: new ( url ) . unwrap ( ) ,
684679 } ,
685680 } ;
686681 let window = "main" ;
@@ -709,7 +704,7 @@ mod tests {
709704 window,
710705 webview,
711706 & Origin :: Remote {
712- domain : domain . replace( '*' , "studio" )
707+ url : url . replace( '*' , "studio" )
713708 }
714709 ) ,
715710 Some ( & resolved_cmd)
@@ -748,7 +743,7 @@ mod tests {
748743 window,
749744 webview,
750745 & Origin :: Remote {
751- domain : "tauri.app" . into( )
746+ url : "https:// tauri.app" . into( )
752747 }
753748 )
754749 . is_none( ) ) ;
0 commit comments