Removed Spaces CDN

This commit is contained in:
2024-08-09 12:09:51 +02:00
parent aa87e8c65f
commit f1697323fc
11 changed files with 106 additions and 150 deletions

View File

@ -1,18 +1,16 @@
package episode
import (
"fmt"
"net/http"
"github.com/aerogo/aero"
"github.com/animenotifier/notify.moe/arn"
minio "github.com/minio/minio-go/v7"
)
// Subtitles returns the subtitles.
func Subtitles(ctx aero.Context) error {
id := ctx.Get("id")
language := ctx.Get("language")
// language := ctx.Get("language")
// Get episode
episode, err := arn.GetEpisode(id)
@ -31,12 +29,13 @@ func Subtitles(ctx aero.Context) error {
ctx.Response().SetHeader("Access-Control-Allow-Origin", "*")
ctx.Response().SetHeader("Content-Type", "text/vtt; charset=utf-8")
obj, err := arn.Spaces.GetObject(ctx.Request().Context(), "arn", fmt.Sprintf("videos/anime/%s/%d.%s.vtt", anime.ID, episode.Number, language), minio.GetObjectOptions{})
// obj, err := arn.Spaces.GetObject(ctx.Request().Context(), "arn", fmt.Sprintf("videos/anime/%s/%d.%s.vtt", anime.ID, episode.Number, language), minio.GetObjectOptions{})
if err != nil {
return ctx.Error(http.StatusInternalServerError, err)
}
// if err != nil {
// return ctx.Error(http.StatusInternalServerError, err)
// }
defer obj.Close()
return ctx.ReadAll(obj)
// defer obj.Close()
// return ctx.ReadAll(obj)
return nil
}