diff --git a/main.go b/main.go index ad11b4d..0d3c361 100644 --- a/main.go +++ b/main.go @@ -20,6 +20,10 @@ func main() { a.Preferences().StringWithFallback("relay-address", "croc.schollz.com:9009") a.Preferences().StringWithFallback("relay-password", "pass123") a.Preferences().StringWithFallback("relay-ports", "9009,9010,9011,9012,9013") + a.Preferences().BoolWithFallback("disable-local", true) + a.Preferences().BoolWithFallback("force-local", false) + a.Preferences().BoolWithFallback("disable-multiplexing", false) + a.Preferences().BoolWithFallback("disable-compression", false) textlogores := fyne.NewStaticResource("text-logo", textlogobytes) textlogo := canvas.NewImageFromResource(textlogores) diff --git a/recv.go b/recv.go index 3de63dc..0742872 100644 --- a/recv.go +++ b/recv.go @@ -34,14 +34,17 @@ func recvTabItem(a fyne.App) *container.TabItem { widget.NewForm(&widget.FormItem{Text: "Receive Code", Widget: recvEntry}), widget.NewButtonWithIcon("Download", theme.DownloadIcon(), func() { receiver, err := croc.New(croc.Options{ - IsSender: false, - SharedSecret: recvEntry.Text, - Debug: false, - RelayAddress: a.Preferences().String("relay-address"), - RelayPassword: a.Preferences().String("relay-password"), - Stdout: false, - NoPrompt: true, - DisableLocal: true, + IsSender: false, + SharedSecret: recvEntry.Text, + Debug: false, + RelayAddress: a.Preferences().String("relay-address"), + RelayPassword: a.Preferences().String("relay-password"), + Stdout: false, + NoPrompt: true, + DisableLocal: a.Preferences().Bool("disable-local"), + NoMultiplexing: a.Preferences().Bool("disable-multiplexing"), + OnlyLocal: a.Preferences().Bool("force-local"), + NoCompress: a.Preferences().Bool("disable-compression"), }) if err != nil { log.Println("Receive setup error:", err) diff --git a/send.go b/send.go index b8ec37d..632af25 100644 --- a/send.go +++ b/send.go @@ -44,15 +44,18 @@ func sendTabItem(a fyne.App, w fyne.Window) *container.TabItem { } randomName := utils.GetRandomName() sender, err := croc.New(croc.Options{ - IsSender: true, - SharedSecret: randomName, - Debug: false, - RelayAddress: a.Preferences().String("relay-address"), - RelayPorts: strings.Split(a.Preferences().String("relay-ports"), ","), - RelayPassword: a.Preferences().String("relay-password"), - Stdout: false, - NoPrompt: true, - DisableLocal: true, + IsSender: true, + SharedSecret: randomName, + Debug: false, + RelayAddress: a.Preferences().String("relay-address"), + RelayPorts: strings.Split(a.Preferences().String("relay-ports"), ","), + RelayPassword: a.Preferences().String("relay-password"), + Stdout: false, + NoPrompt: true, + DisableLocal: a.Preferences().Bool("disable-local"), + NoMultiplexing: a.Preferences().Bool("disable-multiplexing"), + OnlyLocal: a.Preferences().Bool("force-local"), + NoCompress: a.Preferences().Bool("disable-compression"), }) var filename string if err != nil { diff --git a/settings.go b/settings.go index 44c5901..5ae63f8 100644 --- a/settings.go +++ b/settings.go @@ -10,10 +10,23 @@ import ( func settingsTabItem(a fyne.App) *container.TabItem { return container.NewTabItemWithIcon("Settings", theme.SettingsIcon(), container.NewVBox( + widget.NewLabelWithStyle("Relay", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}), widget.NewForm( - widget.NewFormItem("Relay Address", widget.NewEntryWithData(binding.BindPreferenceString("relay-address", a.Preferences()))), - widget.NewFormItem("Relay Password", widget.NewEntryWithData(binding.BindPreferenceString("relay-password", a.Preferences()))), - widget.NewFormItem("Relay Ports", widget.NewEntryWithData(binding.BindPreferenceString("relay-ports", a.Preferences()))), + widget.NewFormItem("Address", widget.NewEntryWithData(binding.BindPreferenceString("relay-address", a.Preferences()))), + widget.NewFormItem("Ports", widget.NewEntryWithData(binding.BindPreferenceString("relay-ports", a.Preferences()))), + widget.NewFormItem("Password", widget.NewEntryWithData(binding.BindPreferenceString("relay-password", a.Preferences()))), + ), + widget.NewSeparator(), + widget.NewLabelWithStyle("Network Local", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}), + widget.NewForm( + widget.NewFormItem("", widget.NewCheckWithData("Disable Local", binding.BindPreferenceBool("disable-local", a.Preferences()))), + widget.NewFormItem("", widget.NewCheckWithData("Force Local Only", binding.BindPreferenceBool("force-local", a.Preferences()))), + ), + widget.NewSeparator(), + widget.NewLabelWithStyle("Transfer Options", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}), + widget.NewForm( + widget.NewFormItem("", widget.NewCheckWithData("Disable Multiplexing", binding.BindPreferenceBool("disable-multiplexing", a.Preferences()))), + widget.NewFormItem("", widget.NewCheckWithData("Disable Compression", binding.BindPreferenceBool("disable-compression", a.Preferences()))), ), )) }