2022-07-11 09:12:50 +00:00
|
|
|
package handles
|
2022-06-26 12:25:02 +00:00
|
|
|
|
|
|
|
import (
|
2022-06-26 12:31:04 +00:00
|
|
|
"fmt"
|
2022-08-03 06:26:59 +00:00
|
|
|
|
2022-08-31 13:01:15 +00:00
|
|
|
"github.com/alist-org/alist/v3/internal/op"
|
2022-06-26 12:25:02 +00:00
|
|
|
"github.com/alist-org/alist/v3/server/common"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
)
|
|
|
|
|
2022-08-30 06:39:10 +00:00
|
|
|
func ListDriverInfo(c *gin.Context) {
|
2022-08-31 13:01:15 +00:00
|
|
|
common.SuccessResp(c, op.GetDriverInfoMap())
|
2022-06-26 12:25:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func ListDriverNames(c *gin.Context) {
|
2022-08-31 13:01:15 +00:00
|
|
|
common.SuccessResp(c, op.GetDriverNames())
|
2022-06-26 12:25:02 +00:00
|
|
|
}
|
|
|
|
|
2022-08-30 06:39:10 +00:00
|
|
|
func GetDriverInfo(c *gin.Context) {
|
2022-06-26 12:25:02 +00:00
|
|
|
driverName := c.Query("driver")
|
2022-08-31 13:01:15 +00:00
|
|
|
infoMap := op.GetDriverInfoMap()
|
2022-08-30 06:39:10 +00:00
|
|
|
items, ok := infoMap[driverName]
|
2022-06-26 12:25:02 +00:00
|
|
|
if !ok {
|
2022-06-26 12:31:04 +00:00
|
|
|
common.ErrorStrResp(c, fmt.Sprintf("driver [%s] not found", driverName), 404)
|
2022-06-26 12:25:02 +00:00
|
|
|
return
|
|
|
|
}
|
2022-06-26 12:31:04 +00:00
|
|
|
common.SuccessResp(c, items)
|
2022-06-26 12:25:02 +00:00
|
|
|
}
|