refactor: remove dead code from anime and auth packages
This commit is contained in:
@@ -459,10 +459,6 @@ func (h *Handler) HandleSearch(w http.ResponseWriter, r *http.Request) {
|
|||||||
renderNotFoundPage(r, w)
|
renderNotFoundPage(r, w)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Handler) HandleStudioDetails(w http.ResponseWriter, r *http.Request) {
|
|
||||||
renderNotFoundPage(r, w)
|
|
||||||
}
|
|
||||||
|
|
||||||
func renderNotFoundPage(r *http.Request, w http.ResponseWriter) {
|
func renderNotFoundPage(r *http.Request, w http.ResponseWriter) {
|
||||||
w.WriteHeader(http.StatusNotFound)
|
w.WriteHeader(http.StatusNotFound)
|
||||||
if err := templates.GetRenderer().ExecuteTemplate(r.Context(), w, "not_found.gohtml", map[string]any{
|
if err := templates.GetRenderer().ExecuteTemplate(r.Context(), w, "not_found.gohtml", map[string]any{
|
||||||
|
|||||||
@@ -128,18 +128,3 @@ func (s *Service) GetDiscoverSection(ctx context.Context, userID string, section
|
|||||||
"WatchlistMap": watchlistMap,
|
"WatchlistMap": watchlistMap,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// filterUnique deduplicates anime list by mal id, respecting limit.
|
|
||||||
func (s *Service) filterUnique(animes []jikan.Anime, seen map[int]bool, limit int) []jikan.Anime {
|
|
||||||
unique := make([]jikan.Anime, 0)
|
|
||||||
for _, a := range animes {
|
|
||||||
if !seen[a.MalID] {
|
|
||||||
seen[a.MalID] = true
|
|
||||||
unique = append(unique, a)
|
|
||||||
}
|
|
||||||
if len(unique) >= limit {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return unique
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -17,14 +17,6 @@ func NewHandler(authService *Service) *Handler {
|
|||||||
return &Handler{authService: authService}
|
return &Handler{authService: authService}
|
||||||
}
|
}
|
||||||
|
|
||||||
// rateLimitErrorFromQuery checks for rate limit errors in the query string
|
|
||||||
func rateLimitErrorFromQuery(r *http.Request) string {
|
|
||||||
if r.URL.Query().Get("error") == "rate_limited" {
|
|
||||||
return rateLimitFormError
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
// HandleLoginPage renders the login form
|
// HandleLoginPage renders the login form
|
||||||
func (h *Handler) HandleLoginPage(w http.ResponseWriter, r *http.Request) {
|
func (h *Handler) HandleLoginPage(w http.ResponseWriter, r *http.Request) {
|
||||||
if err := templates.GetRenderer().ExecuteTemplate(r.Context(), w, "login.gohtml", map[string]any{
|
if err := templates.GetRenderer().ExecuteTemplate(r.Context(), w, "login.gohtml", map[string]any{
|
||||||
|
|||||||
Reference in New Issue
Block a user