alist/server/handles/driver.go

29 lines
602 B
Go

package handles
import (
"fmt"
"github.com/alist-org/alist/v3/internal/op"
"github.com/alist-org/alist/v3/server/common"
"github.com/gin-gonic/gin"
)
func ListDriverInfo(c *gin.Context) {
common.SuccessResp(c, op.GetDriverInfoMap())
}
func ListDriverNames(c *gin.Context) {
common.SuccessResp(c, op.GetDriverNames())
}
func GetDriverInfo(c *gin.Context) {
driverName := c.Query("driver")
infoMap := op.GetDriverInfoMap()
items, ok := infoMap[driverName]
if !ok {
common.ErrorStrResp(c, fmt.Sprintf("driver [%s] not found", driverName), 404)
return
}
common.SuccessResp(c, items)
}