diff options
Diffstat (limited to 'web/controller/xray_setting.go')
| -rw-r--r-- | web/controller/xray_setting.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/web/controller/xray_setting.go b/web/controller/xray_setting.go index d4deacd9..09e9115f 100644 --- a/web/controller/xray_setting.go +++ b/web/controller/xray_setting.go @@ -26,6 +26,7 @@ func (a *XraySettingController) initRouter(g *gin.RouterGroup) { g.POST("/update", a.updateSetting) g.GET("/getXrayResult", a.getXrayResult) g.GET("/getDefaultJsonConfig", a.getDefaultXrayConfig) + g.POST("/warp/:action", a.warp) } func (a *XraySettingController) getXraySetting(c *gin.Context) { @@ -61,3 +62,25 @@ func (a *XraySettingController) getDefaultXrayConfig(c *gin.Context) { func (a *XraySettingController) getXrayResult(c *gin.Context) { jsonObj(c, a.XrayService.GetXrayResult(), nil) } + +func (a *XraySettingController) warp(c *gin.Context) { + action := c.Param("action") + var resp string + var err error + switch action { + case "data": + resp, err = a.XraySettingService.GetWarp() + case "config": + resp, err = a.XraySettingService.GetWarpConfig() + case "reg": + skey := c.PostForm("privateKey") + pkey := c.PostForm("publicKey") + resp, err = a.XraySettingService.RegWarp(skey, pkey) + case "license": + license := c.PostForm("license") + println(license) + resp, err = a.XraySettingService.SetWarpLicence(license) + } + + jsonObj(c, resp, err) +} |
