added dialog informing browser tab closing
This commit is contained in:
@ -57,7 +57,7 @@ func (a *App) AniListLogin() {
|
||||
|
||||
serverDone := &sync.WaitGroup{}
|
||||
serverDone.Add(1)
|
||||
handleAniListCallback(serverDone)
|
||||
a.handleAniListCallback(serverDone)
|
||||
serverDone.Wait()
|
||||
} else {
|
||||
aniListJwt.TokenType = string(tokenType.Data)
|
||||
@ -68,7 +68,7 @@ func (a *App) AniListLogin() {
|
||||
}
|
||||
}
|
||||
|
||||
func handleAniListCallback(wg *sync.WaitGroup) {
|
||||
func (a *App) handleAniListCallback(wg *sync.WaitGroup) {
|
||||
mux := http.NewServeMux()
|
||||
srv := &http.Server{Addr: ":6734", Handler: mux}
|
||||
mux.HandleFunc("/callback", func(w http.ResponseWriter, r *http.Request) {
|
||||
@ -98,9 +98,16 @@ func handleAniListCallback(wg *sync.WaitGroup) {
|
||||
Key: "anilistRefreshToken",
|
||||
Data: []byte(aniListJwt.RefreshToken),
|
||||
})
|
||||
_, err := runtime.MessageDialog(a.ctx, runtime.MessageDialogOptions{
|
||||
Title: "AniList Authorization",
|
||||
Message: "It is now safe to close your browser tab",
|
||||
})
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
fmt.Println("Shutting down...")
|
||||
aniCancel()
|
||||
err := srv.Shutdown(context.Background())
|
||||
err = srv.Shutdown(context.Background())
|
||||
if err != nil {
|
||||
log.Println("server.Shutdown:", err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user