feat: publish sanitized custom.97 source
This commit is contained in:
1022 files changed
+69903
-19207
No files matched your search
@@ -0,0 +1,40 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/http"
|
||||
|
||||
"github.com/QuantumNous/new-api/common"
|
||||
"github.com/QuantumNous/new-api/model"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func GetChannelPriorityOrder(c *gin.Context) {
|
||||
order, err := model.GetChannelPriorityOrder()
|
||||
if err != nil {
|
||||
common.ApiError(c, err)
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"success": true, "data": order})
|
||||
}
|
||||
|
||||
func ReorderChannelPriority(c *gin.Context) {
|
||||
var move model.ChannelPriorityMove
|
||||
if err := common.DecodeJson(c.Request.Body, &move); err != nil {
|
||||
common.ApiErrorT(c, "Invalid channel priority move")
|
||||
return
|
||||
}
|
||||
order, err := model.ReorderChannelPriority(move)
|
||||
if err != nil {
|
||||
if errors.Is(err, model.ErrChannelPriorityConflict) || errors.Is(err, model.ErrChannelPriorityInvalid) || errors.Is(err, model.ErrChannelPriorityRange) {
|
||||
common.ApiErrorT(c, err.Error())
|
||||
} else {
|
||||
common.ApiError(c, err)
|
||||
}
|
||||
return
|
||||
}
|
||||
if !move.Preview && len(order.Changes) > 0 {
|
||||
model.InitChannelCache()
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"success": true, "data": order})
|
||||
}
|
||||
Reference in new issue
Block a user