added cors
parent
59af8c0c3a
commit
cba7f8ca13
|
|
@ -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",
|
||||
|
|
|
|||
3
main.go
3
main.go
|
|
@ -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())
|
||||
|
|
|
|||
Loading…
Reference in New Issue