|
|
@ -475,11 +475,7 @@ func (a *App) runBackend(ctx context.Context) error {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
}()
|
|
|
|
case LogoutEvent:
|
|
|
|
case LogoutEvent:
|
|
|
|
go func() {
|
|
|
|
go a.logout(ctx)
|
|
|
|
ctx, cancel := context.WithTimeout(ctx, 5*time.Minute)
|
|
|
|
|
|
|
|
defer cancel()
|
|
|
|
|
|
|
|
b.backend.Logout(ctx)
|
|
|
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
case ConnectEvent:
|
|
|
|
case ConnectEvent:
|
|
|
|
state.Prefs.WantRunning = e.Enable
|
|
|
|
state.Prefs.WantRunning = e.Enable
|
|
|
|
go b.backend.SetPrefs(state.Prefs)
|
|
|
|
go b.backend.SetPrefs(state.Prefs)
|
|
|
@ -571,7 +567,7 @@ func (a *App) runBackend(ctx context.Context) error {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (a *App) getBugReportID(ctx context.Context, bugReportChan chan<- string, fallbackLog string) {
|
|
|
|
func (a *App) getBugReportID(ctx context.Context, bugReportChan chan<- string, fallbackLog string) {
|
|
|
|
ctx, cancel := context.WithDeadline(ctx, time.Now().Add(2*time.Second))
|
|
|
|
ctx, cancel := context.WithTimeout(ctx, 2*time.Second)
|
|
|
|
defer cancel()
|
|
|
|
defer cancel()
|
|
|
|
r, err := a.localAPIClient.Call(ctx, "POST", "bugreport", nil)
|
|
|
|
r, err := a.localAPIClient.Call(ctx, "POST", "bugreport", nil)
|
|
|
|
defer r.Body().Close()
|
|
|
|
defer r.Body().Close()
|
|
|
@ -591,7 +587,7 @@ func (a *App) getBugReportID(ctx context.Context, bugReportChan chan<- string, f
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (a *App) login(ctx context.Context) {
|
|
|
|
func (a *App) login(ctx context.Context) {
|
|
|
|
ctx, cancel := context.WithDeadline(ctx, time.Now().Add(2*time.Second))
|
|
|
|
ctx, cancel := context.WithTimeout(ctx, 60*time.Second)
|
|
|
|
defer cancel()
|
|
|
|
defer cancel()
|
|
|
|
r, err := a.localAPIClient.Call(ctx, "POST", "login-interactive", nil)
|
|
|
|
r, err := a.localAPIClient.Call(ctx, "POST", "login-interactive", nil)
|
|
|
|
defer r.Body().Close()
|
|
|
|
defer r.Body().Close()
|
|
|
@ -602,6 +598,22 @@ func (a *App) login(ctx context.Context) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (a *App) logout(ctx context.Context) error {
|
|
|
|
|
|
|
|
ctx, cancel := context.WithTimeout(ctx, 60*time.Second)
|
|
|
|
|
|
|
|
defer cancel()
|
|
|
|
|
|
|
|
r, err := a.localAPIClient.Call(ctx, "POST", "logout", nil)
|
|
|
|
|
|
|
|
defer r.Body().Close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
log.Printf("logout: %s", err)
|
|
|
|
|
|
|
|
logoutctx, logoutcancel := context.WithTimeout(ctx, 5*time.Minute)
|
|
|
|
|
|
|
|
defer logoutcancel()
|
|
|
|
|
|
|
|
a.backend.Logout(logoutctx)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (a *App) processWaitingFiles(b *ipnlocal.LocalBackend) error {
|
|
|
|
func (a *App) processWaitingFiles(b *ipnlocal.LocalBackend) error {
|
|
|
|
files, err := b.WaitingFiles()
|
|
|
|
files, err := b.WaitingFiles()
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|