Add special type -2 to /explore.

This commit is contained in:
Kleissner
2021-09-25 13:09:40 +02:00
parent 175f1fb438
commit 3fbb1a824b
2 changed files with 9 additions and 1 deletions

View File

@@ -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:

View File

@@ -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.
*/