ui option for allowing untrusted connections

pull/4/head
Zlatin Balevsky 2019-06-05 15:47:44 +01:00
parent 2edeb046be
commit cdb6e22522
3 changed files with 16 additions and 4 deletions

View File

@ -52,7 +52,11 @@ class OptionsController {
text = view.updateField.text text = view.updateField.text
model.updateCheckInterval = text model.updateCheckInterval = text
settings.updateCheckInterval = Integer.valueOf(text) settings.updateCheckInterval = Integer.valueOf(text)
boolean allowUntrusted = view.allowUntrustedCheckbox.model.isSelected()
model.allowUntrusted = allowUntrusted
settings.setAllowUntrusted(allowUntrusted)
File settingsFile = new File(core.home, "MuWire.properties") File settingsFile = new File(core.home, "MuWire.properties")
settingsFile.withOutputStream { settingsFile.withOutputStream {
settings.write(it) settings.write(it)

View File

@ -1,6 +1,7 @@
package com.muwire.gui package com.muwire.gui
import com.muwire.core.Core import com.muwire.core.Core
import com.muwire.core.MuWireSettings
import griffon.core.artifact.GriffonModel import griffon.core.artifact.GriffonModel
import griffon.transform.Observable import griffon.transform.Observable
@ -10,6 +11,7 @@ import griffon.metadata.ArtifactProviderFor
class OptionsModel { class OptionsModel {
@Observable String downloadRetryInterval @Observable String downloadRetryInterval
@Observable String updateCheckInterval @Observable String updateCheckInterval
@Observable boolean allowUntrusted
// i2p options // i2p options
@Observable String inboundLength @Observable String inboundLength
@ -18,8 +20,10 @@ class OptionsModel {
@Observable String outboundQuantity @Observable String outboundQuantity
void mvcGroupInit(Map<String, String> args) { void mvcGroupInit(Map<String, String> args) {
downloadRetryInterval = application.context.get("muwire-settings").downloadRetryInterval MuWireSettings settings = application.context.get("muwire-settings")
updateCheckInterval = application.context.get("muwire-settings").updateCheckInterval downloadRetryInterval = settings.downloadRetryInterval
updateCheckInterval = settings.updateCheckInterval
allowUntrusted = settings.allowUntrusted()
Core core = application.context.get("core") Core core = application.context.get("core")
inboundLength = core.i2pOptions["inbound.length"] inboundLength = core.i2pOptions["inbound.length"]

View File

@ -27,6 +27,7 @@ class OptionsView {
def i def i
def retryField def retryField
def updateField def updateField
def allowUntrustedCheckbox
def inboundLengthField def inboundLengthField
def inboundQuantityField def inboundQuantityField
@ -50,7 +51,10 @@ class OptionsView {
label(text : "Check for updates every", constraints : gbc(gridx : 0, gridy: 1)) label(text : "Check for updates every", constraints : gbc(gridx : 0, gridy: 1))
updateField = textField(text : bind {model.updateCheckInterval }, columns : 2, constraints : gbc(gridx : 1, gridy: 1)) updateField = textField(text : bind {model.updateCheckInterval }, columns : 2, constraints : gbc(gridx : 1, gridy: 1))
label(text : "hours", constraints : gbc(gridx: 2, gridy : 1)) label(text : "hours", constraints : gbc(gridx: 2, gridy : 1))
label(text : "Allow untrusted connections", constraints : gbc(gridx: 0, gridy : 2))
allowUntrustedCheckbox = checkBox(selected : bind {model.allowUntrusted}, constraints : gbc(gridx: 1, gridy : 2))
} }
i = builder.panel { i = builder.panel {
gridBagLayout() gridBagLayout()