added cors

pull/2/head
Nilo Roberto C Paim 2022-03-01 07:46:46 -03:00
parent 59af8c0c3a
commit cba7f8ca13
2 changed files with 4 additions and 2 deletions

View File

@ -16,8 +16,6 @@ func CheckStream(c *fiber.Ctx) error {
var fil *os.File
defer fil.Close()
fil, err := os.Open("/var/nginx/hls/" + data["channel"] + "/index.m3u8")
if errors.Is(err, os.ErrNotExist) {
c.Status(fiber.StatusNotFound)
@ -26,6 +24,7 @@ func CheckStream(c *fiber.Ctx) error {
})
}
fil.Close()
c.Status(fiber.StatusOK)
return c.JSON(fiber.Map{
"message": "Stream existente",

View File

@ -19,6 +19,9 @@ func main() {
app.Use(cors.New(cors.Config{
AllowCredentials: true,
AllowOrigins: "http://*, https://*",
AllowHeaders: "Origin, Content-Type, Accept, Authorization, Access-Control-Allow-Origin",
AllowMethods: "GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS",
}))
app.Use(logger.New())