added dialog informing browser tab closing
This commit is contained in:
parent
a0e193e343
commit
0f647e85cb
@ -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)
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ func (a *App) MyAnimeListLogin() {
|
||||
runtime.BrowserOpenURL(a.ctx, getMyAnimeListCodeUrl)
|
||||
serverDone := &sync.WaitGroup{}
|
||||
serverDone.Add(1)
|
||||
handleMyAnimeListCallback(serverDone, verifier)
|
||||
a.handleMyAnimeListCallback(serverDone, verifier)
|
||||
serverDone.Wait()
|
||||
} else {
|
||||
myAnimeListJwt.TokenType = string(tokenType.Data)
|
||||
@ -115,7 +115,7 @@ func (a *App) MyAnimeListLogin() {
|
||||
}
|
||||
}
|
||||
|
||||
func handleMyAnimeListCallback(wg *sync.WaitGroup, verifier *CodeVerifier) {
|
||||
func (a *App) handleMyAnimeListCallback(wg *sync.WaitGroup, verifier *CodeVerifier) {
|
||||
mux := http.NewServeMux()
|
||||
srv := &http.Server{Addr: ":6734", Handler: mux}
|
||||
mux.HandleFunc("/callback", func(w http.ResponseWriter, r *http.Request) {
|
||||
@ -145,9 +145,16 @@ func handleMyAnimeListCallback(wg *sync.WaitGroup, verifier *CodeVerifier) {
|
||||
Key: "MyAnimeListRefreshToken",
|
||||
Data: []byte(myAnimeListJwt.RefreshToken),
|
||||
})
|
||||
_, err := runtime.MessageDialog(a.ctx, runtime.MessageDialogOptions{
|
||||
Title: "MyAnimeList Authorization",
|
||||
Message: "It is now safe to close your browser tab",
|
||||
})
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
fmt.Println("Shutting down...")
|
||||
myAnimeListCancel()
|
||||
err := srv.Shutdown(context.Background())
|
||||
err = srv.Shutdown(context.Background())
|
||||
if err != nil {
|
||||
log.Println("server.Shutdown:", err)
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ func (a *App) SimklLogin() {
|
||||
|
||||
serverDone := &sync.WaitGroup{}
|
||||
serverDone.Add(1)
|
||||
handleSimklCallback(serverDone)
|
||||
a.handleSimklCallback(serverDone)
|
||||
serverDone.Wait()
|
||||
} else {
|
||||
simklJwt.TokenType = string(tokenType.Data)
|
||||
@ -62,7 +62,7 @@ func (a *App) SimklLogin() {
|
||||
}
|
||||
}
|
||||
|
||||
func handleSimklCallback(wg *sync.WaitGroup) {
|
||||
func (a *App) handleSimklCallback(wg *sync.WaitGroup) {
|
||||
mux := http.NewServeMux()
|
||||
srv := &http.Server{Addr: ":6734", Handler: mux}
|
||||
mux.HandleFunc("/callback", func(w http.ResponseWriter, r *http.Request) {
|
||||
@ -88,9 +88,16 @@ func handleSimklCallback(wg *sync.WaitGroup) {
|
||||
Key: "SimklScope",
|
||||
Data: []byte(simklJwt.Scope),
|
||||
})
|
||||
_, err := runtime.MessageDialog(a.ctx, runtime.MessageDialogOptions{
|
||||
Title: "Simkl Authorization",
|
||||
Message: "It is now safe to close your browser tab",
|
||||
})
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
fmt.Println("Shutting down...")
|
||||
simklCancel()
|
||||
err := srv.Shutdown(context.Background())
|
||||
err = srv.Shutdown(context.Background())
|
||||
if err != nil {
|
||||
log.Println("server.Shutdown:", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user