|
@@ -70,6 +70,111 @@ fn login_session(payload: Json<LoginSessionPayload>)
|
|
|
}})
|
|
|
}
|
|
|
|
|
|
+#[derive(Serialize)]
|
|
|
+struct FbxFileInfo
|
|
|
+{
|
|
|
+ path: String,
|
|
|
+ name: String,
|
|
|
+ mimetype: String,
|
|
|
+ r#type: String,
|
|
|
+ size: i32,
|
|
|
+ modification: i32,
|
|
|
+ index: i32,
|
|
|
+ link: bool,
|
|
|
+ target: String,
|
|
|
+ hidden: bool,
|
|
|
+ foldercount: i32,
|
|
|
+ filecount: i32,
|
|
|
+}
|
|
|
+
|
|
|
+#[get("/api/v6/fs/info/<file_path>")]
|
|
|
+fn fs_info(file_path: String)
|
|
|
+ -> Json<FbxCmdResult<FbxFileInfo>>
|
|
|
+{
|
|
|
+ let name: String = match file_path.as_ref() {
|
|
|
+ "L3Rlc3Q=" => "test".into(),
|
|
|
+ "L3RvdG8=" => "toto".into(),
|
|
|
+ "L3RydWM=" => "truc".into(),
|
|
|
+ _ => "/".into()
|
|
|
+ };
|
|
|
+ let mtype: String = match file_path.as_ref() {
|
|
|
+ "Lw==" => "dir".into(),
|
|
|
+ _ => "file".into()
|
|
|
+ };
|
|
|
+
|
|
|
+ Json(FbxCmdResult {
|
|
|
+ success: true,
|
|
|
+ result: FbxFileInfo {
|
|
|
+ path: file_path,
|
|
|
+ name: name,
|
|
|
+ mimetype: mtype.clone(),
|
|
|
+ r#type: mtype,
|
|
|
+ size: 1024,
|
|
|
+ modification: 0,
|
|
|
+ index: 1,
|
|
|
+ link: false,
|
|
|
+ target: "".into(),
|
|
|
+ hidden: false,
|
|
|
+ foldercount: 5,
|
|
|
+ filecount: 5,
|
|
|
+ }})
|
|
|
+}
|
|
|
+
|
|
|
+#[get("/api/v6/fs/ls/<file_path>")]
|
|
|
+fn fs_ls(file_path: String)
|
|
|
+ -> Json<FbxCmdResult<[FbxFileInfo; 3]>>
|
|
|
+{
|
|
|
+ Json(
|
|
|
+ FbxCmdResult {
|
|
|
+ success: true,
|
|
|
+ result: [
|
|
|
+ FbxFileInfo {
|
|
|
+ path: "L3Rlc3Q=".into(),
|
|
|
+ name: "test".into(),
|
|
|
+ mimetype: "file".into(),
|
|
|
+ r#type: "file".into(),
|
|
|
+ size: 1024,
|
|
|
+ modification: 0,
|
|
|
+ index: 1,
|
|
|
+ link: false,
|
|
|
+ target: "".into(),
|
|
|
+ hidden: false,
|
|
|
+ foldercount: 5,
|
|
|
+ filecount: 5,
|
|
|
+ },
|
|
|
+ FbxFileInfo {
|
|
|
+ path: "L3RvdG8=".into(),
|
|
|
+ name: "toto".into(),
|
|
|
+ mimetype: "file".into(),
|
|
|
+ r#type: "file".into(),
|
|
|
+ size: 1024,
|
|
|
+ modification: 0,
|
|
|
+ index: 1,
|
|
|
+ link: false,
|
|
|
+ target: "".into(),
|
|
|
+ hidden: false,
|
|
|
+ foldercount: 5,
|
|
|
+ filecount: 5,
|
|
|
+ },
|
|
|
+ FbxFileInfo {
|
|
|
+ path: "L3RydWM=".into(),
|
|
|
+ name: "truc".into(),
|
|
|
+ mimetype: "file".into(),
|
|
|
+ r#type: "file".into(),
|
|
|
+ size: 1024,
|
|
|
+ modification: 0,
|
|
|
+ index: 1,
|
|
|
+ link: false,
|
|
|
+ target: "".into(),
|
|
|
+ hidden: false,
|
|
|
+ foldercount: 5,
|
|
|
+ filecount: 5,
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ )
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
fn main()
|
|
|
{
|
|
@@ -77,6 +182,9 @@ fn main()
|
|
|
.mount("/",routes![
|
|
|
index,
|
|
|
login,
|
|
|
- login_session])
|
|
|
+ login_session,
|
|
|
+ fs_info,
|
|
|
+ fs_ls,
|
|
|
+ ])
|
|
|
.launch();
|
|
|
}
|