add flag to search paths to query message

auto-update
Zlatin Balevsky 2021-10-09 23:15:35 +01:00
parent ce806f9f4d
commit ebac1ffafa
No known key found for this signature in database
GPG Key ID: A72832072D525E41
4 changed files with 12 additions and 3 deletions

View File

@ -33,6 +33,7 @@ class MuWireSettings {
boolean throttleLoadingFiles
boolean searchComments
boolean searchCollections
boolean searchPaths
boolean browseFiles
boolean showPaths
boolean allowTracking
@ -124,6 +125,7 @@ class MuWireSettings {
sharePercentage = Integer.valueOf(props.getProperty("sharePercentage","80"))
searchComments = Boolean.valueOf(props.getProperty("searchComments","true"))
searchCollections = Boolean.valueOf(props.getProperty("searchCollections","true"))
searchPaths = Boolean.valueOf(props.getProperty("searchPaths","true"))
browseFiles = Boolean.valueOf(props.getProperty("browseFiles","true"))
showPaths = Boolean.valueOf(props.getProperty("showPaths", "true"))
allowTracking = Boolean.valueOf(props.getProperty("allowTracking","true"))
@ -222,6 +224,7 @@ class MuWireSettings {
props.setProperty("sharePercentage", String.valueOf(sharePercentage))
props.setProperty("searchComments", String.valueOf(searchComments))
props.setProperty("searchCollections", String.valueOf(searchCollections))
props.setProperty("searchPaths", String.valueOf(searchPaths))
props.setProperty("browseFiles", String.valueOf(browseFiles))
props.setProperty("showPaths", String.valueOf(showPaths))
props.setProperty("allowTracking", String.valueOf(allowTracking))

View File

@ -156,6 +156,7 @@ abstract class Connection implements Closeable {
query.searchComments = e.searchEvent.searchComments
query.compressedResults = e.searchEvent.compressedResults
query.collections = e.searchEvent.collections
query.searchPaths = e.searchEvent.searchPaths
if (e.searchEvent.searchHash != null)
query.infohash = Base64.encode(e.searchEvent.searchHash)
query.replyTo = e.replyTo.toBase64()
@ -279,9 +280,13 @@ abstract class Connection implements Closeable {
boolean compressedResults = false
if (search.compressedResults != null)
compressedResults = search.compressedResults
boolean collections
boolean collections = false
if (search.collections != null)
collections = search.collections
boolean searchPaths = false
if (search.searchPaths != null)
searchPaths = search.searchPaths
byte[] sig = null
if (search.sig != null) {
sig = Base64.decode(search.sig)
@ -336,6 +341,7 @@ abstract class Connection implements Closeable {
searchComments : searchComments,
compressedResults : compressedResults,
collections : collections,
searchPaths: searchPaths,
persona : originator)
QueryEvent event = new QueryEvent ( searchEvent : searchEvent,
replyTo : replyTo,

View File

@ -298,7 +298,7 @@ class FileManager {
files.addAll commentToFile.getOrDefault(it, [])
}
if (e.searchPaths) {
if (e.searchPaths && settings.showPaths) {
def paths = pathIndex.search e.searchTerms
paths.each {
files.addAll pathToFiles.getOrDefault(it, [])

View File

@ -139,7 +139,7 @@ class MainFrameController {
payload = String.join(" ",nonEmpty).getBytes(StandardCharsets.UTF_8)
searchEvent = new SearchEvent(searchTerms : nonEmpty, uuid : uuid, oobInfohash: true,
searchComments : core.muOptions.searchComments, compressedResults : true, persona : core.me,
collections : core.muOptions.searchCollections)
collections : core.muOptions.searchCollections, searchPaths: core.muOptions.searchPaths)
}
boolean firstHop = core.muOptions.allowUntrusted || core.muOptions.searchExtraHop