Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMHSanaei <ho3ein.sanaei@gmail.com>2023-04-11 15:11:04 +0300
committerMHSanaei <ho3ein.sanaei@gmail.com>2023-04-11 15:11:04 +0300
commit7412bf17a927df4715b65962de5f683dade83395 (patch)
tree9a2ae08341c95ff8aa75c84c9b5c823cdb0c921a /web/controller
parent519f2b462ee3340c959c57f5f92319dc011833e6 (diff)
bug fix
Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
Diffstat (limited to 'web/controller')
-rw-r--r--web/controller/server.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/web/controller/server.go b/web/controller/server.go
index 43a1fadc..c5a3965b 100644
--- a/web/controller/server.go
+++ b/web/controller/server.go
@@ -39,6 +39,8 @@ func (a *ServerController) initRouter(g *gin.RouterGroup) {
g.POST("/restartXrayService", a.restartXrayService)
g.POST("/installXray/:version", a.installXray)
g.POST("/logs/:count", a.getLogs)
+ g.POST("/getConfigJson", a.getConfigJson)
+ g.GET("/getDb", a.getDb)
}
func (a *ServerController) refreshStatus() {
@@ -117,3 +119,26 @@ func (a *ServerController) getLogs(c *gin.Context) {
}
jsonObj(c, logs, nil)
}
+
+func (a *ServerController) getConfigJson(c *gin.Context) {
+ configJson, err := a.serverService.GetConfigJson()
+ if err != nil {
+ jsonMsg(c, I18n(c, "getLogs"), err)
+ return
+ }
+ jsonObj(c, configJson, nil)
+}
+
+func (a *ServerController) getDb(c *gin.Context) {
+ db, err := a.serverService.GetDb()
+ if err != nil {
+ jsonMsg(c, I18n(c, "getLogs"), err)
+ return
+ }
+ // Set the headers for the response
+ c.Header("Content-Type", "application/octet-stream")
+ c.Header("Content-Disposition", "attachment; filename=xui.db")
+
+ // Write the file contents to the response
+ c.Writer.Write(db)
+}