Fixed: fixed bug scrcpy and shell is disconnect when switch page

This commit is contained in:
Kenta420 2024-02-19 14:24:05 +07:00
parent 9543d4541c
commit 0fe469b5c6
43 changed files with 1378 additions and 1366 deletions

View file

@ -185,10 +185,25 @@ func (ar *AuthRouter) Route(r chi.Router) {
json.NewEncoder(w).Encode(value)
})
r.Get("/refresh", func(w http.ResponseWriter, r *http.Request) {
r.Post("/refresh", func(w http.ResponseWriter, r *http.Request) {
// get refresh token from query string
refreshToken := r.URL.Query().Get("refresh_token")
redirectTo := r.URL.Query().Get("redirect_to")
// get refresh token from body and redirect_to from body and mashal it to struct
var refreshToken string
var redirectTo string
err := json.NewDecoder(r.Body).Decode(&struct {
RefreshToken string `json:"refresh_token"`
RedirectTo string `json:"redirect_to"`
}{refreshToken, redirectTo})
if err != nil {
http.Error(w, "Error decoding body", http.StatusBadRequest)
return
}
// refreshToken := r.URL.Query().Get("refresh_token")
// redirectTo := r.URL.Query().Get("redirect_to")
if refreshToken == "" {
http.Error(w, "Refresh token not found", http.StatusBadRequest)
return