forked from Silverfish/proton-bridge
GODT-1388: Refactor Alternative routing
This commit is contained in:
@ -129,7 +129,7 @@ func (f *frontendCLI) changePort(c *ishell.Context) {
|
||||
}
|
||||
|
||||
func (f *frontendCLI) allowProxy(c *ishell.Context) {
|
||||
if f.settings.GetBool(settings.AllowProxyKey) {
|
||||
if f.bridge.GetProxyAllowed() {
|
||||
f.Println("Bridge is already set to use alternative routing to connect to Proton if it is being blocked.")
|
||||
return
|
||||
}
|
||||
@ -137,13 +137,12 @@ func (f *frontendCLI) allowProxy(c *ishell.Context) {
|
||||
f.Println("Bridge is currently set to NOT use alternative routing to connect to Proton if it is being blocked.")
|
||||
|
||||
if f.yesNoQuestion("Are you sure you want to allow bridge to do this") {
|
||||
f.settings.SetBool(settings.AllowProxyKey, true)
|
||||
f.bridge.AllowProxy()
|
||||
f.bridge.SetProxyAllowed(true)
|
||||
}
|
||||
}
|
||||
|
||||
func (f *frontendCLI) disallowProxy(c *ishell.Context) {
|
||||
if !f.settings.GetBool(settings.AllowProxyKey) {
|
||||
if !f.bridge.GetProxyAllowed() {
|
||||
f.Println("Bridge is already set to NOT use alternative routing to connect to Proton if it is being blocked.")
|
||||
return
|
||||
}
|
||||
@ -151,8 +150,7 @@ func (f *frontendCLI) disallowProxy(c *ishell.Context) {
|
||||
f.Println("Bridge is currently set to use alternative routing to connect to Proton if it is being blocked.")
|
||||
|
||||
if f.yesNoQuestion("Are you sure you want to stop bridge from doing this") {
|
||||
f.settings.SetBool(settings.AllowProxyKey, false)
|
||||
f.bridge.DisallowProxy()
|
||||
f.bridge.SetProxyAllowed(false)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -99,12 +99,8 @@ func (f *FrontendQt) toggleAutostart(makeItEnabled bool) {
|
||||
}
|
||||
|
||||
func (f *FrontendQt) toggleDoH(makeItEnabled bool) {
|
||||
if f.settings.GetBool(settings.AllowProxyKey) == makeItEnabled {
|
||||
f.qml.SetIsDoHEnabled(makeItEnabled)
|
||||
return
|
||||
}
|
||||
f.settings.SetBool(settings.AllowProxyKey, makeItEnabled)
|
||||
f.restart()
|
||||
f.bridge.SetProxyAllowed(makeItEnabled)
|
||||
f.qml.SetIsDoHEnabled(f.bridge.GetProxyAllowed())
|
||||
}
|
||||
|
||||
func (f *FrontendQt) toggleUseSSLforSMTP(makeItEnabled bool) {
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
//go:build build_qt
|
||||
// +build build_qt
|
||||
|
||||
package qt
|
||||
@ -232,7 +233,7 @@ func (q *QMLBackend) setup(f *FrontendQt) {
|
||||
}()
|
||||
})
|
||||
|
||||
q.SetIsDoHEnabled(f.settings.GetBool(settings.AllowProxyKey))
|
||||
q.SetIsDoHEnabled(f.bridge.GetProxyAllowed())
|
||||
q.ConnectToggleDoH(f.toggleDoH)
|
||||
|
||||
q.SetUseSSLforSMTP(f.settings.GetBool(settings.SMTPSSLKey))
|
||||
|
||||
@ -75,8 +75,8 @@ type Bridger interface {
|
||||
UserManager
|
||||
|
||||
ReportBug(osType, osVersion, description, accountName, address, emailClient string, attachLogs bool) error
|
||||
AllowProxy()
|
||||
DisallowProxy()
|
||||
SetProxyAllowed(bool)
|
||||
GetProxyAllowed() bool
|
||||
EnableCache() error
|
||||
DisableCache() error
|
||||
MigrateCache(from, to string) error
|
||||
|
||||
Reference in New Issue
Block a user