Add option to not search extra hop, only considered if connecting only to trusted peers, issue #6
This commit is contained in:
@@ -11,6 +11,7 @@ class MuWireSettings {
|
|||||||
|
|
||||||
final boolean isLeaf
|
final boolean isLeaf
|
||||||
boolean allowUntrusted
|
boolean allowUntrusted
|
||||||
|
boolean searchExtraHop
|
||||||
boolean allowTrustLists
|
boolean allowTrustLists
|
||||||
int trustListInterval
|
int trustListInterval
|
||||||
Set<Persona> trustSubscriptions
|
Set<Persona> trustSubscriptions
|
||||||
@@ -38,6 +39,7 @@ class MuWireSettings {
|
|||||||
MuWireSettings(Properties props) {
|
MuWireSettings(Properties props) {
|
||||||
isLeaf = Boolean.valueOf(props.get("leaf","false"))
|
isLeaf = Boolean.valueOf(props.get("leaf","false"))
|
||||||
allowUntrusted = Boolean.valueOf(props.getProperty("allowUntrusted","true"))
|
allowUntrusted = Boolean.valueOf(props.getProperty("allowUntrusted","true"))
|
||||||
|
searchExtraHop = Boolean.valueOf(props.getProperty("searchExtraHop","false"))
|
||||||
allowTrustLists = Boolean.valueOf(props.getProperty("allowTrustLists","true"))
|
allowTrustLists = Boolean.valueOf(props.getProperty("allowTrustLists","true"))
|
||||||
trustListInterval = Integer.valueOf(props.getProperty("trustListInterval","1"))
|
trustListInterval = Integer.valueOf(props.getProperty("trustListInterval","1"))
|
||||||
crawlerResponse = CrawlerResponse.valueOf(props.get("crawlerResponse","REGISTERED"))
|
crawlerResponse = CrawlerResponse.valueOf(props.get("crawlerResponse","REGISTERED"))
|
||||||
@@ -76,6 +78,7 @@ class MuWireSettings {
|
|||||||
Properties props = new Properties()
|
Properties props = new Properties()
|
||||||
props.setProperty("leaf", isLeaf.toString())
|
props.setProperty("leaf", isLeaf.toString())
|
||||||
props.setProperty("allowUntrusted", allowUntrusted.toString())
|
props.setProperty("allowUntrusted", allowUntrusted.toString())
|
||||||
|
props.setProperty("searchExtraHop", String.valueOf(searchExtraHop))
|
||||||
props.setProperty("allowTrustLists", String.valueOf(allowTrustLists))
|
props.setProperty("allowTrustLists", String.valueOf(allowTrustLists))
|
||||||
props.setProperty("trustListInterval", String.valueOf(trustListInterval))
|
props.setProperty("trustListInterval", String.valueOf(trustListInterval))
|
||||||
props.setProperty("crawlerResponse", crawlerResponse.toString())
|
props.setProperty("crawlerResponse", crawlerResponse.toString())
|
||||||
|
@@ -86,7 +86,8 @@ class MainFrameController {
|
|||||||
terms.each { if (it.length() > 0) nonEmpty << it }
|
terms.each { if (it.length() > 0) nonEmpty << it }
|
||||||
searchEvent = new SearchEvent(searchTerms : nonEmpty, uuid : uuid, oobInfohash: true)
|
searchEvent = new SearchEvent(searchTerms : nonEmpty, uuid : uuid, oobInfohash: true)
|
||||||
}
|
}
|
||||||
core.eventBus.publish(new QueryEvent(searchEvent : searchEvent, firstHop : true,
|
boolean firstHop = core.muOptions.allowUntrusted || core.muOptions.searchExtraHop
|
||||||
|
core.eventBus.publish(new QueryEvent(searchEvent : searchEvent, firstHop : firstHop,
|
||||||
replyTo: core.me.destination, receivedOn: core.me.destination,
|
replyTo: core.me.destination, receivedOn: core.me.destination,
|
||||||
originator : core.me))
|
originator : core.me))
|
||||||
}
|
}
|
||||||
|
@@ -96,6 +96,10 @@ class OptionsController {
|
|||||||
model.onlyTrusted = onlyTrusted
|
model.onlyTrusted = onlyTrusted
|
||||||
settings.setAllowUntrusted(!onlyTrusted)
|
settings.setAllowUntrusted(!onlyTrusted)
|
||||||
|
|
||||||
|
boolean searchExtraHop = view.searchExtraHopCheckbox.model.isSelected()
|
||||||
|
model.searchExtraHop = searchExtraHop
|
||||||
|
settings.searchExtraHop = searchExtraHop
|
||||||
|
|
||||||
boolean trustLists = view.allowTrustListsCheckbox.model.isSelected()
|
boolean trustLists = view.allowTrustListsCheckbox.model.isSelected()
|
||||||
model.trustLists = trustLists
|
model.trustLists = trustLists
|
||||||
settings.allowTrustLists = trustLists
|
settings.allowTrustLists = trustLists
|
||||||
|
@@ -38,6 +38,7 @@ class OptionsModel {
|
|||||||
|
|
||||||
// trust options
|
// trust options
|
||||||
@Observable boolean onlyTrusted
|
@Observable boolean onlyTrusted
|
||||||
|
@Observable boolean searchExtraHop
|
||||||
@Observable boolean trustLists
|
@Observable boolean trustLists
|
||||||
@Observable String trustListInterval
|
@Observable String trustListInterval
|
||||||
|
|
||||||
@@ -73,6 +74,7 @@ class OptionsModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onlyTrusted = !settings.allowUntrusted()
|
onlyTrusted = !settings.allowUntrusted()
|
||||||
|
searchExtraHop = settings.searchExtraHop
|
||||||
trustLists = settings.allowTrustLists
|
trustLists = settings.allowTrustLists
|
||||||
trustListInterval = String.valueOf(settings.trustListInterval)
|
trustListInterval = String.valueOf(settings.trustListInterval)
|
||||||
}
|
}
|
||||||
|
@@ -55,6 +55,7 @@ class OptionsView {
|
|||||||
def outBwField
|
def outBwField
|
||||||
|
|
||||||
def allowUntrustedCheckbox
|
def allowUntrustedCheckbox
|
||||||
|
def searchExtraHopCheckbox
|
||||||
def allowTrustListsCheckbox
|
def allowTrustListsCheckbox
|
||||||
def trustListIntervalField
|
def trustListIntervalField
|
||||||
|
|
||||||
@@ -138,11 +139,13 @@ class OptionsView {
|
|||||||
gridBagLayout()
|
gridBagLayout()
|
||||||
label(text : "Allow only trusted connections", constraints : gbc(gridx: 0, gridy : 0))
|
label(text : "Allow only trusted connections", constraints : gbc(gridx: 0, gridy : 0))
|
||||||
allowUntrustedCheckbox = checkBox(selected : bind {model.onlyTrusted}, constraints : gbc(gridx: 1, gridy : 0))
|
allowUntrustedCheckbox = checkBox(selected : bind {model.onlyTrusted}, constraints : gbc(gridx: 1, gridy : 0))
|
||||||
label(text : "Allow others to view my trust list", constraints : gbc(gridx: 0, gridy : 1))
|
label(text : "Search extra hop", constraints : gbc(gridx:0, gridy:1))
|
||||||
allowTrustListsCheckbox = checkBox(selected : bind {model.trustLists}, constraints : gbc(gridx: 1, gridy : 1))
|
searchExtraHopCheckbox = checkBox(selected : bind {model.searchExtraHop}, constraints : gbc(gridx: 1, gridy : 1))
|
||||||
label(text : "Update trust lists every ", constraints : gbc(gridx:0, gridy:2))
|
label(text : "Allow others to view my trust list", constraints : gbc(gridx: 0, gridy : 2))
|
||||||
trustListIntervalField = textField(text : bind {model.trustListInterval}, constraints:gbc(gridx:1, gridy:2))
|
allowTrustListsCheckbox = checkBox(selected : bind {model.trustLists}, constraints : gbc(gridx: 1, gridy : 2))
|
||||||
label(text : "hours", constraints : gbc(gridx: 2, gridy:2))
|
label(text : "Update trust lists every ", constraints : gbc(gridx:0, gridy:3))
|
||||||
|
trustListIntervalField = textField(text : bind {model.trustListInterval}, constraints:gbc(gridx:1, gridy:3))
|
||||||
|
label(text : "hours", constraints : gbc(gridx: 2, gridy:3))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user