mirror of
https://github.com/v2rayA/v2rayA.git
synced 2026-11-20 23:02:25 +03:00
44 lines
1.2 KiB
Go
44 lines
1.2 KiB
Go
package controller
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/v2rayA/v2rayA/common"
|
|
"github.com/v2rayA/v2rayA/conf"
|
|
"github.com/v2rayA/v2rayA/core/v2ray/asset/dat"
|
|
"github.com/v2rayA/v2rayA/core/v2ray/service"
|
|
"github.com/v2rayA/v2rayA/core/v2ray/where"
|
|
"net/http"
|
|
)
|
|
|
|
func GetVersion(ctx *gin.Context) {
|
|
var lite int
|
|
if conf.GetEnvironmentConfig().Lite {
|
|
lite = 1
|
|
}
|
|
variant, versionErr := service.CheckV5()
|
|
common.ResponseSuccess(ctx, gin.H{
|
|
"version": conf.Version,
|
|
"foundNew": conf.FoundNew,
|
|
"remoteVersion": conf.RemoteVersion,
|
|
"serviceValid": service.IsV2rayServiceValid(),
|
|
"v5": versionErr == nil, // FIXME: Compomise on compatibility.
|
|
"lite": lite,
|
|
"loadBalanceValid": variant == where.V2ray && versionErr == nil,
|
|
"variant": variant,
|
|
})
|
|
}
|
|
|
|
func GetRemoteGFWListVersion(ctx *gin.Context) {
|
|
//c, err := httpClient.GetHttpClientAutomatically()
|
|
//if err != nil {
|
|
// tools.ResponseError(ctx, err)
|
|
// return
|
|
//}
|
|
g, err := dat.GetRemoteGFWListUpdateTime(http.DefaultClient)
|
|
if err != nil {
|
|
common.ResponseError(ctx, logError(err))
|
|
return
|
|
}
|
|
common.ResponseSuccess(ctx, gin.H{"remoteGFWListVersion": g.UpdateTime.Local().Format("2006-01-02")})
|
|
}
|