chore: fix whitespace
This commit is contained in:
@@ -199,15 +199,15 @@ func (h *Handler) HandleEpisodeData(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
json.NewEncoder(w).Encode(map[string]any{
|
json.NewEncoder(w).Encode(map[string]any{
|
||||||
"mal_id": watchData.MalID,
|
"mal_id": watchData.MalID,
|
||||||
"title": watchData.Title,
|
"title": watchData.Title,
|
||||||
"current_episode": watchData.CurrentEpisode,
|
"current_episode": watchData.CurrentEpisode,
|
||||||
"total_episodes": anime.Episodes,
|
"total_episodes": anime.Episodes,
|
||||||
"initial_mode": watchData.InitialMode,
|
"initial_mode": watchData.InitialMode,
|
||||||
"token": "", // The token might be per-source, wait, in Go it was per-mode?
|
"token": "", // The token might be per-source, wait, in Go it was per-mode?
|
||||||
"available_modes": watchData.AvailableModes,
|
"available_modes": watchData.AvailableModes,
|
||||||
"mode_sources": watchData.ModeSources,
|
"mode_sources": watchData.ModeSources,
|
||||||
"segments": watchData.Segments,
|
"segments": watchData.Segments,
|
||||||
"episode_title": "", // Find episode title if possible
|
"episode_title": "", // Find episode title if possible
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ func RequireAuth(next http.Handler) http.Handler {
|
|||||||
r = r.WithContext(ctx)
|
r = r.WithContext(ctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
user, ok := r.Context().Value(ctxpkg.UserKey).(*database.User)
|
user, ok := r.Context().Value(ctxpkg.UserKey).(*database.User)
|
||||||
if !ok || user == nil {
|
if !ok || user == nil {
|
||||||
if strings.HasPrefix(r.URL.Path, "/api/") {
|
if strings.HasPrefix(r.URL.Path, "/api/") {
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ func NewRouter(cfg Config) http.Handler {
|
|||||||
middleware.InitAuth(cfg.AuthService)
|
middleware.InitAuth(cfg.AuthService)
|
||||||
|
|
||||||
animeHandler := anime.NewHandler(cfg.JikanClient, cfg.DB)
|
animeHandler := anime.NewHandler(cfg.JikanClient, cfg.DB)
|
||||||
|
|
||||||
playbackSvc := playback.NewService(cfg.DB, cfg.SQLDB, playback.Config{
|
playbackSvc := playback.NewService(cfg.DB, cfg.SQLDB, playback.Config{
|
||||||
ProxyTokenSecret: cfg.PlaybackProxySecret,
|
ProxyTokenSecret: cfg.PlaybackProxySecret,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ func GetRenderer() *Renderer {
|
|||||||
renderer = &Renderer{
|
renderer = &Renderer{
|
||||||
templates: make(map[string]*template.Template),
|
templates: make(map[string]*template.Template),
|
||||||
}
|
}
|
||||||
|
|
||||||
funcs := template.FuncMap{
|
funcs := template.FuncMap{
|
||||||
"dict": func(values ...any) map[string]any {
|
"dict": func(values ...any) map[string]any {
|
||||||
m := make(map[string]any)
|
m := make(map[string]any)
|
||||||
@@ -62,12 +62,12 @@ func GetRenderer() *Renderer {
|
|||||||
tmpl := template.New(name).Funcs(funcs)
|
tmpl := template.New(name).Funcs(funcs)
|
||||||
// Parse base first so it establishes the core definitions
|
// Parse base first so it establishes the core definitions
|
||||||
tmpl = template.Must(tmpl.ParseFiles(filepath.Join(".", "templates", "base.gohtml")))
|
tmpl = template.Must(tmpl.ParseFiles(filepath.Join(".", "templates", "base.gohtml")))
|
||||||
|
|
||||||
// Parse all components next so they are available to the page
|
// Parse all components next so they are available to the page
|
||||||
if len(components) > 0 {
|
if len(components) > 0 {
|
||||||
tmpl = template.Must(tmpl.ParseFiles(components...))
|
tmpl = template.Must(tmpl.ParseFiles(components...))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse the page itself last
|
// Parse the page itself last
|
||||||
tmpl = template.Must(tmpl.ParseFiles(page))
|
tmpl = template.Must(tmpl.ParseFiles(page))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user