mirror of
https://github.com/v2rayA/v2rayA.git
synced 2026-11-20 23:02:25 +03:00
37 lines
815 B
Go
37 lines
815 B
Go
package controller
|
|
|
|
import (
|
|
"V2RayA/persistence/configure"
|
|
"V2RayA/service"
|
|
"V2RayA/tools"
|
|
"errors"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func PutGFWList(ctx *gin.Context) {
|
|
localGFWListVersion, err := service.CheckAndUpdateGFWList()
|
|
if err != nil {
|
|
tools.ResponseError(ctx, err)
|
|
return
|
|
}
|
|
tools.ResponseSuccess(ctx, gin.H{
|
|
"localGFWListVersion": localGFWListVersion,
|
|
})
|
|
}
|
|
|
|
func PutSubscription(ctx *gin.Context) {
|
|
var data configure.Which
|
|
err := ctx.ShouldBindJSON(&data)
|
|
index := data.ID - 1
|
|
if err != nil || data.TYPE != configure.SubscriptionType || index < 0 || index >= configure.GetLenSubscriptions() {
|
|
tools.ResponseError(ctx, errors.New("参数有误"))
|
|
return
|
|
}
|
|
err = service.UpdateSubscription(index, false)
|
|
if err != nil {
|
|
tools.ResponseError(ctx, err)
|
|
return
|
|
}
|
|
GetTouch(ctx)
|
|
}
|