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

View File

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

View File

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

View File

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