mirror of
https://codeberg.org/VnPower/PixivFE
synced 2024-12-06 19:16:23 +01:00
fix more
This commit is contained in:
+9
-9
@@ -64,15 +64,15 @@ func WebAPIRequest(context context.Context, URL, token string) HttpResponse {
|
||||
}
|
||||
|
||||
func webAPIRequest(context context.Context, URL, token string) HttpResponse {
|
||||
req, err := http.NewRequestWithContext(r.Context(), "GET", URL, nil)
|
||||
if err != nil {
|
||||
return HttpResponse{
|
||||
Ok: false,
|
||||
StatusCode: 0,
|
||||
Body: "",
|
||||
Message: fmt.Sprintf("Failed to create a request to %s\n.", URL),
|
||||
}
|
||||
}
|
||||
req, err := http.NewRequestWithContext(context, "GET", URL, nil)
|
||||
if err != nil {
|
||||
return HttpResponse{
|
||||
Ok: false,
|
||||
StatusCode: 0,
|
||||
Body: "",
|
||||
Message: fmt.Sprintf("Failed to create a request to %s\n.", URL),
|
||||
}
|
||||
}
|
||||
|
||||
req.Header.Add("User-Agent", config.GlobalServerConfig.UserAgent)
|
||||
req.Header.Add("Accept-Language", config.GlobalServerConfig.AcceptLanguage)
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
func PromptUserToLoginPage(w http.ResponseWriter, r CompatRequest) error {
|
||||
r.Status(http.StatusUnauthorized)
|
||||
r.Response.StatusCode = http.StatusUnauthorized
|
||||
return Render(w, r, Data_unauthorized{})
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ func RankingCalendarPage(w http.ResponseWriter, r CompatRequest) error {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
now := r.Context().Time()
|
||||
now := time.Now()
|
||||
year = now.Year()
|
||||
month = int(now.Month())
|
||||
}
|
||||
|
||||
+2
-2
@@ -113,8 +113,8 @@ func setArtworkPreview(w http.ResponseWriter, r CompatRequest) error {
|
||||
}
|
||||
|
||||
func setLogout(w http.ResponseWriter, r CompatRequest) error {
|
||||
session.ClearCookie(r.Request, session.Cookie_Token)
|
||||
session.ClearCookie(r.Request, session.Cookie_CSRF)
|
||||
session.ClearCookie(w, session.Cookie_Token)
|
||||
session.ClearCookie(w, session.Cookie_CSRF)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user