From 3fbb1a824b7d6775cf572420c6389ffa90a5e2ca Mon Sep 17 00:00:00 2001 From: Kleissner Date: Sat, 25 Sep 2021 13:09:40 +0200 Subject: [PATCH] Add special type -2 to /explore. --- webapi/Search Temp.go | 6 ++++++ webapi/Search.go | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/webapi/Search Temp.go b/webapi/Search Temp.go index 1a0905d..e88c31c 100644 --- a/webapi/Search Temp.go +++ b/webapi/Search Temp.go @@ -196,6 +196,12 @@ func createTestResult(fileType int) (file core.BlockRecordFile) { } } else { + if fileType == -2 { + // Binary, Compressed, Container, Executable + otherList := []int{core.TypeBinary, core.TypeCompressed, core.TypeContainer, core.TypeExecutable} + fileType = otherList[rand.Intn(len(otherList))] + } + file.Type = uint8(fileType) switch file.Type { case core.TypeBinary: diff --git a/webapi/Search.go b/webapi/Search.go index cca78dc..abbdffd 100644 --- a/webapi/Search.go +++ b/webapi/Search.go @@ -215,7 +215,9 @@ func apiSearchTerminate(w http.ResponseWriter, r *http.Request) { } /* -apiExplore returns recently shared files in Peernet. Results are returned in real-time. The file type is an optional filter. +apiExplore returns recently shared files in Peernet. Results are returned in real-time. The file type is an optional filter. See TypeX. +Special type -2 = Binary, Compressed, Container, Executable. This special type includes everything except Documents, Video, Audio, Ebooks, Picture, Text. + Request: GET /explore?limit=[max records]&type=[file type] Result: 200 with JSON structure SearchResult. Check the field status. */