🧑‍💻 Improve kernel API /api/file/readDir for returning file mod time Fix https://github.com/siyuan-note/siyuan/issues/8945

This commit is contained in:
Daniel 2023-08-10 10:57:01 +08:00
parent 82633a497b
commit 6595524640
No known key found for this signature in database
GPG Key ID: 86211BA83DF03017
3 changed files with 27 additions and 22 deletions

24
API.md
View File

@ -1064,7 +1064,7 @@ View API token in <kbd>Settings - About</kbd>, request header: `Authorization: T
```json ```json
{ {
"path": "/data/20210808180117-6v0mkxr/20200923234011-ieuun1p.sy" "path": "/data/20210808180117-6v0mkxr/20200923234011-ieuun1p"
} }
``` ```
* `path`: the file path under the workspace path * `path`: the file path under the workspace path
@ -1075,16 +1075,18 @@ View API token in <kbd>Settings - About</kbd>, request header: `Authorization: T
"code": 0, "code": 0,
"msg": "", "msg": "",
"data": [ "data": [
{ {
"isDir": true, "isDir": true,
"isSymlink": false, "isSymlink": false,
"name": "20210808180320-abz7w6k" "name": "20210808180303-6yi0dv5",
}, "updated": 1691467624
{ },
"isDir": false, {
"isSymlink": false, "isDir": false,
"name": "20210808180320-abz7w6k.sy" "isSymlink": false,
} "name": "20210808180303-6yi0dv5.sy",
"updated": 1663298365
}
] ]
} }
``` ```

View File

@ -1056,7 +1056,7 @@
```json ```json
{ {
"path": "/data/20210808180117-6v0mkxr/20200923234011-ieuun1p.sy" "path": "/data/20210808180117-6v0mkxr/20200923234011-ieuun1p"
} }
``` ```
* `path`:工作空间路径下的文件路径 * `path`:工作空间路径下的文件路径
@ -1067,16 +1067,18 @@
"code": 0, "code": 0,
"msg": "", "msg": "",
"data": [ "data": [
{ {
"isDir": true, "isDir": true,
"isSymlink": false, "isSymlink": false,
"name": "20210808180320-abz7w6k" "name": "20210808180303-6yi0dv5",
}, "updated": 1691467624
{ },
"isDir": false, {
"isSymlink": false, "isDir": false,
"name": "20210808180320-abz7w6k.sy" "isSymlink": false,
} "name": "20210808180303-6yi0dv5.sy",
"updated": 1663298365
}
] ]
} }
``` ```

View File

@ -184,6 +184,7 @@ func readDir(c *gin.Context) {
"name": entry.Name(), "name": entry.Name(),
"isDir": info.IsDir(), "isDir": info.IsDir(),
"isSymlink": util.IsSymlink(entry), "isSymlink": util.IsSymlink(entry),
"updated": info.ModTime().Unix(),
}) })
} }