mirror of
https://github.com/PeernetOfficial/Cmd.git
synced 2026-07-17 02:47:52 +01:00
Support new file tag FileTagDateShared
This commit is contained in:
9
API.go
9
API.go
@@ -433,7 +433,7 @@ func apiBlockchainSelfListFile(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
func isFileTagKnownMetadata(tagType uint16) bool {
|
||||
switch tagType {
|
||||
case core.TagTypeName, core.TagTypeFolder, core.TagTypeDescription, core.TagTypeDateCreated:
|
||||
case core.TagTypeName, core.TagTypeFolder, core.TagTypeDescription, core.TagTypeDateCreated, core.TagTypeDateShared:
|
||||
return true
|
||||
|
||||
default:
|
||||
@@ -463,9 +463,12 @@ func blockRecordFileToAPI(input core.BlockRecordFile) (output apiBlockRecordFile
|
||||
case core.FileTagDescription:
|
||||
output.Description = v.Description
|
||||
|
||||
case core.FileTagCreated:
|
||||
case core.FileTagDateCreated:
|
||||
output.Metadata = append(output.Metadata, apiFileMetadata{Type: core.TagTypeDateCreated, Name: "Date Created", Value: v.Date.Format(dateFormat)})
|
||||
|
||||
case core.FileTagDateShared:
|
||||
output.Metadata = append(output.Metadata, apiFileMetadata{Type: core.TagTypeDateCreated, Name: "Date Shared", Value: v.Date.Format(dateFormat)})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -489,7 +492,7 @@ func blockRecordFileFromAPI(input apiBlockRecordFile) (output core.BlockRecordFi
|
||||
switch tag.Type {
|
||||
case core.TagTypeDateCreated:
|
||||
if dateF, err := time.Parse(dateFormat, tag.Value); err == nil {
|
||||
output.TagsDecoded = append(output.TagsDecoded, core.FileTagCreated{Date: dateF})
|
||||
output.TagsDecoded = append(output.TagsDecoded, core.FileTagDateCreated{Date: dateF})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
6
API.md
6
API.md
@@ -303,7 +303,11 @@ Example output:
|
||||
"folder": "sample directory/sub folder",
|
||||
"name": "Test.txt",
|
||||
"description": "",
|
||||
"metadata": [],
|
||||
"metadata": [{
|
||||
"type": 2,
|
||||
"name": "Date Shared",
|
||||
"value": "2021-08-27 16:59:13"
|
||||
}],
|
||||
"tagsraw": []
|
||||
}],
|
||||
"status": 0
|
||||
|
||||
2
go.mod
2
go.mod
@@ -3,7 +3,7 @@ module github.com/PeernetOfficial/Cmd
|
||||
go 1.16
|
||||
|
||||
require (
|
||||
github.com/PeernetOfficial/core v0.0.0-20210828112606-a3750af1c82c
|
||||
github.com/PeernetOfficial/core v0.0.0-20210828113738-22f21d187a38
|
||||
github.com/btcsuite/btcd v0.22.0-beta.0.20210625194946-86a17263b0ff
|
||||
github.com/google/uuid v1.3.0
|
||||
github.com/gorilla/mux v1.8.1-0.20200912192056-d07530f46e1e
|
||||
|
||||
4
go.sum
4
go.sum
@@ -1,5 +1,5 @@
|
||||
github.com/PeernetOfficial/core v0.0.0-20210828112606-a3750af1c82c h1:IwvcGoybJu1eL5UwKUcfu2IGIQWX/0D3qXBP90/7c5A=
|
||||
github.com/PeernetOfficial/core v0.0.0-20210828112606-a3750af1c82c/go.mod h1:GCG3qjbCPEY+/PGIO76Dj/Dp6JvpMYy0B6T+CbmSk1A=
|
||||
github.com/PeernetOfficial/core v0.0.0-20210828113738-22f21d187a38 h1:WSqqgVAG5pekBrlrj4wpkAfEN/8GgpWDIQQc3/AbCVE=
|
||||
github.com/PeernetOfficial/core v0.0.0-20210828113738-22f21d187a38/go.mod h1:GCG3qjbCPEY+/PGIO76Dj/Dp6JvpMYy0B6T+CbmSk1A=
|
||||
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
|
||||
github.com/akrylysov/pogreb v0.10.1 h1:FqlR8VR7uCbJdfUob916tPM+idpKgeESDXOA1K0DK4w=
|
||||
github.com/akrylysov/pogreb v0.10.1/go.mod h1:pNs6QmpQ1UlTJKDezuRWmaqkgUE2TuU0YTWyqJZ7+lI=
|
||||
|
||||
Reference in New Issue
Block a user