1
0
mirror of https://github.com/taigrr/crocgui synced 2025-01-18 04:03:16 -08:00

additional settings

This commit is contained in:
Chris Howey 2021-02-20 14:16:39 -06:00
parent ae5dbd3d18
commit ebfac6f2e2
4 changed files with 43 additions and 20 deletions

View File

@ -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)

19
recv.go
View File

@ -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)

21
send.go
View File

@ -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 {

View File

@ -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()))),
),
))
}