@@ -69,6 +69,7 @@ const META_METHOD_PUSH_LOG: MetaMethod = MetaMethod {
6969} ;
7070
7171// Root node methods
72+ const METH_VERSION : & str = "version" ;
7273const METH_UPTIME : & str = "uptime" ;
7374const METH_RELOAD_SITES : & str = "reloadSites" ;
7475
@@ -218,7 +219,6 @@ async fn shvjournal_methods_getter(path: impl AsRef<str>, app_state: AppState<St
218219 // probe the path on the fs
219220 let path_meta = tokio:: fs:: metadata ( path) . await . ok ( ) ?;
220221 if path_meta. is_dir ( ) {
221- // TODO: mkfile, mkdir, rmdir
222222 Some ( MetaMethods :: from ( & [
223223 & MetaMethod {
224224 name : METH_LS_FILES ,
@@ -301,6 +301,8 @@ async fn root_request_handler(
301301
302302 const ROOT_PATH : & str = "" ;
303303 match method {
304+ METH_VERSION => Ok ( env ! ( "CARGO_PKG_VERSION" ) . into ( ) ) ,
305+ METH_UPTIME => Ok ( humantime:: format_duration ( std:: time:: Duration :: from_secs ( app_state. start_time . elapsed ( ) . as_secs ( ) ) ) . to_string ( ) . into ( ) ) ,
304306 METH_LS => {
305307 let mut nodes = vec ! [
306308 ".app" . to_string( ) ,
@@ -761,6 +763,15 @@ pub(crate) async fn methods_getter(
761763 ] ) ) ,
762764 NodeType :: Root =>
763765 Some ( MetaMethods :: from ( & [
766+ & MetaMethod {
767+ name : METH_VERSION ,
768+ flags : 0 ,
769+ access : shvrpc:: metamethod:: AccessLevel :: Read ,
770+ param : "Null" ,
771+ result : "String" ,
772+ signals : & [ ] ,
773+ description : "" ,
774+ } ,
764775 & MetaMethod {
765776 name : METH_UPTIME ,
766777 flags : 0 ,
@@ -785,11 +796,9 @@ pub(crate) async fn methods_getter(
785796 // appName
786797 // deviceId
787798 // deviceType
788- // version
789799 // gitCommit
790800 // shvVersion
791801 // shvGitCommit
792- // uptime
793802 // reloadSites (wr) -> Bool
794803 ] ) ) ,
795804 NodeType :: History => {
@@ -816,7 +825,6 @@ pub(crate) async fn methods_getter(
816825 }
817826 }
818827 }
819- // TODO: put the processed data to a request cache in the app state: path -> children
820828}
821829
822830pub ( crate ) async fn request_handler (
0 commit comments