mirror of https://github.com/synctv-org/synctv
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
777 B
Go
28 lines
777 B
Go
package vendors
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
dbModel "github.com/synctv-org/synctv/internal/model"
|
|
"github.com/synctv-org/synctv/internal/vendor"
|
|
"github.com/synctv-org/synctv/server/model"
|
|
"golang.org/x/exp/maps"
|
|
)
|
|
|
|
func Backends(ctx *gin.Context) {
|
|
var backends []string
|
|
switch ctx.Param("vendor") {
|
|
case dbModel.VendorBilibili:
|
|
backends = maps.Keys(vendor.LoadClients().BilibiliClients())
|
|
case dbModel.VendorAlist:
|
|
backends = maps.Keys(vendor.LoadClients().AlistClients())
|
|
case dbModel.VendorEmby:
|
|
backends = maps.Keys(vendor.LoadClients().EmbyClients())
|
|
default:
|
|
ctx.AbortWithStatusJSON(http.StatusBadRequest, model.NewApiErrorStringResp("invalid vendor name"))
|
|
return
|
|
}
|
|
ctx.JSON(http.StatusOK, model.NewApiDataResp(backends))
|
|
}
|