@@ -23,7 +23,7 @@ fn get_device_id() -> String {
23
23
static SENTRY : OnceCell < ClientInitGuard > = OnceCell :: new ( ) ;
24
24
25
25
#[ tauri:: command]
26
- fn get_last_log_file ( config : tauri:: State < Configuration > ) -> Option < String > {
26
+ pub fn get_last_log_file ( config : tauri:: State < Configuration > ) -> Option < String > {
27
27
let log_dir = config. log_dir ( ) ;
28
28
29
29
let mut entries = std:: fs:: read_dir ( log_dir)
@@ -52,57 +52,21 @@ fn get_last_log_file(config: tauri::State<Configuration>) -> Option<String> {
52
52
std:: fs:: read_to_string ( filename) . ok ( )
53
53
}
54
54
55
- pub ( super ) struct BloopBackend < R >
56
- where
57
- R : Runtime ,
58
- {
59
- invoke_handler : Box < dyn Fn ( Invoke < R > ) + Send + Sync > ,
60
- }
61
-
62
- impl < R : Runtime > BloopBackend < R > {
63
- pub fn new ( ) -> Self {
64
- Self {
65
- invoke_handler : Box :: new ( tauri:: generate_handler![ get_last_log_file] ) ,
66
- }
67
- }
68
- }
69
-
70
- impl < R : Runtime > Default for BloopBackend < R > {
71
- fn default ( ) -> Self {
72
- Self :: new ( )
73
- }
74
- }
55
+ pub fn initialize < R : Runtime > ( app : & mut tauri:: App < R > ) -> tauri:: plugin:: Result < ( ) > {
56
+ let handle = app. handle ( ) ;
57
+ let configuration = setup_configuration ( & handle) ;
75
58
76
- impl < R : Runtime > Plugin < R > for BloopBackend < R > {
77
- fn name ( & self ) -> & ' static str {
78
- "bleep"
79
- }
59
+ Application :: install_logging ( & configuration) ;
80
60
81
- /// Extend the invoke handler.
82
- fn extend_api ( & mut self , message : Invoke < R > ) {
83
- ( self . invoke_handler ) ( message)
61
+ if let Some ( dsn) = & configuration. sentry_dsn {
62
+ initialize_sentry ( dsn) ;
84
63
}
85
64
86
- fn initialize (
87
- & mut self ,
88
- app : & tauri:: AppHandle < R > ,
89
- _config : serde_json:: Value ,
90
- ) -> tauri:: plugin:: Result < ( ) > {
91
- let configuration = setup_configuration ( app) ;
65
+ app. manage ( configuration. clone ( ) ) ;
92
66
93
- Application :: install_logging ( & configuration) ;
94
-
95
- if let Some ( dsn) = & configuration. sentry_dsn {
96
- initialize_sentry ( dsn) ;
97
- }
67
+ tokio:: spawn ( start_backend ( configuration, handle) ) ;
98
68
99
- app. manage ( configuration. clone ( ) ) ;
100
-
101
- let app = app. clone ( ) ;
102
- tokio:: spawn ( start_backend ( configuration, app) ) ;
103
-
104
- Ok ( ( ) )
105
- }
69
+ Ok ( ( ) )
106
70
}
107
71
108
72
async fn wait_for_qdrant ( ) {
0 commit comments