diff options
| author | Farhad H. P. Shirvan <9374298+farhadh@users.noreply.github.com> | 2026-04-28 19:46:55 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-28 19:46:55 +0300 |
| commit | f21ed9229695ed1cbcc86d65b52d98cfc9116f5a (patch) | |
| tree | d1c96f66fe973005aebc6b065e949f3725f1527d /web/controller | |
| parent | 22de983752fb4cc10bd16b756c4ccaab239e2e3b (diff) | |
feat: add panel update functionality via web GUI (#4117)
* feat: add panel update functionality via web GUI
* feat: enhance panel update notifications in web GUI
* feat: implement panel update modal and enhance translation strings
* fix design
Diffstat (limited to 'web/controller')
| -rw-r--r-- | web/controller/server.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/web/controller/server.go b/web/controller/server.go index d32209e1..188e987a 100644 --- a/web/controller/server.go +++ b/web/controller/server.go @@ -22,6 +22,7 @@ type ServerController struct { serverService service.ServerService settingService service.SettingService + panelService service.PanelService lastStatus *service.Status @@ -43,6 +44,7 @@ func (a *ServerController) initRouter(g *gin.RouterGroup) { g.GET("/status", a.status) g.GET("/cpuHistory/:bucket", a.getCpuHistoryBucket) g.GET("/getXrayVersion", a.getXrayVersion) + g.GET("/getPanelUpdateInfo", a.getPanelUpdateInfo) g.GET("/getConfigJson", a.getConfigJson) g.GET("/getDb", a.getDb) g.GET("/getNewUUID", a.getNewUUID) @@ -54,6 +56,7 @@ func (a *ServerController) initRouter(g *gin.RouterGroup) { g.POST("/stopXrayService", a.stopXrayService) g.POST("/restartXrayService", a.restartXrayService) g.POST("/installXray/:version", a.installXray) + g.POST("/updatePanel", a.updatePanel) g.POST("/updateGeofile", a.updateGeofile) g.POST("/updateGeofile/:fileName", a.updateGeofile) g.POST("/logs/:count", a.getLogs) @@ -131,6 +134,16 @@ func (a *ServerController) getXrayVersion(c *gin.Context) { jsonObj(c, versions, nil) } +// getPanelUpdateInfo retrieves the current and latest panel version. +func (a *ServerController) getPanelUpdateInfo(c *gin.Context) { + info, err := a.panelService.GetUpdateInfo() + if err != nil { + jsonMsg(c, I18nWeb(c, "pages.index.panelUpdateCheckPopover"), err) + return + } + jsonObj(c, info, nil) +} + // installXray installs or updates Xray to the specified version. func (a *ServerController) installXray(c *gin.Context) { version := c.Param("version") @@ -138,6 +151,12 @@ func (a *ServerController) installXray(c *gin.Context) { jsonMsg(c, I18nWeb(c, "pages.index.xraySwitchVersionPopover"), err) } +// updatePanel starts a panel self-update to the latest release. +func (a *ServerController) updatePanel(c *gin.Context) { + err := a.panelService.StartUpdate() + jsonMsg(c, I18nWeb(c, "pages.index.panelUpdateStartedPopover"), err) +} + // updateGeofile updates the specified geo file for Xray. func (a *ServerController) updateGeofile(c *gin.Context) { fileName := c.Param("fileName") |
