mirror of
https://github.com/alireza0/x-ui.git
synced 2026-03-16 06:02:31 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ae72aa8d1 | ||
|
|
1b0828eb3e | ||
|
|
b6252151f4 | ||
|
|
832d561d52 | ||
|
|
d7fd3e2109 |
@@ -14,7 +14,7 @@ case $1 in
|
||||
;;
|
||||
armv7 | arm | arm32)
|
||||
ARCH="arm32-v7a"
|
||||
FNAME="arm32"
|
||||
FNAME="arm"
|
||||
;;
|
||||
*)
|
||||
ARCH="64"
|
||||
|
||||
29
README.md
29
README.md
@@ -209,7 +209,6 @@ docker build -t x-ui .
|
||||
| :----: | --------------------------------- | ----------------------------------------- |
|
||||
| `GET` | `"/"` | Get all inbounds |
|
||||
| `GET` | `"/get/:id"` | Get inbound with inbound.id |
|
||||
| `GET` | `"/createbackup"` | Telegram bot sends backup to admins |
|
||||
| `POST` | `"/add"` | Add inbound |
|
||||
| `POST` | `"/del/:id"` | Delete inbound |
|
||||
| `POST` | `"/update/:id"` | Update inbound |
|
||||
@@ -224,11 +223,33 @@ docker build -t x-ui .
|
||||
| `POST` | `"/delDepletedClients/:id"` | Delete inbound depleted clients (-1: all) |
|
||||
| `POST` | `"/onlines"` | Get online users ( list of emails ) |
|
||||
|
||||
|
||||
\*- The field `clientId` should be filled by:
|
||||
|
||||
- `client.id` for VMess and VLESS
|
||||
- `client.password` for Trojan
|
||||
- `client.email` for Shadowsocks
|
||||
- `client.id` for VMess and VLESS
|
||||
- `client.password` for Trojan
|
||||
- `client.email` for Shadowsocks
|
||||
|
||||
|
||||
- `/xui/API/server` base for following actions:
|
||||
|
||||
| Method | Path | Action |
|
||||
| :----: | --------------------------------- | ----------------------------------------- |
|
||||
| `GET` | `"/status"` | Get server status |
|
||||
| `GET` | `"/getDb"` | Get database backup |
|
||||
| `GET` | `"/createbackup"` | Telegram bot sends backup to admins |
|
||||
| `GET` | `"/getConfigJson"` | Get config.json |
|
||||
| `GET` | `"/getXrayVersion"` | Get last xray versions |
|
||||
| `GET` | `"/getNewVlessEnc"` | Get new vless enc |
|
||||
| `GET` | `"/getNewX25519Cert"` | Get new x25519 cert |
|
||||
| `GET` | `"/getNewmldsa65"` | Get new mldsa65 |
|
||||
| `POST` | `"/getNewEchCert"` | Get new ech cert |
|
||||
| `POST` | `"/importDB"` | Import database to x-ui |
|
||||
| `POST` | `"/stopXrayService"` | Stop xray service |
|
||||
| `POST` | `"/restartXrayService"` | Restart xray service |
|
||||
| `POST` | `"/installXray/:version"` | Install specific version of xray |
|
||||
| `POST` | `"/logs/:count"` | Get panel/xray logs |
|
||||
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.9.0
|
||||
1.9.1
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"x-ui/config"
|
||||
"x-ui/database/model"
|
||||
"x-ui/xray"
|
||||
"github.com/alireza0/x-ui/config"
|
||||
"github.com/alireza0/x-ui/database/model"
|
||||
"github.com/alireza0/x-ui/xray"
|
||||
|
||||
"gorm.io/driver/sqlite"
|
||||
"gorm.io/gorm"
|
||||
|
||||
@@ -3,8 +3,8 @@ package model
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"x-ui/util/json_util"
|
||||
"x-ui/xray"
|
||||
"github.com/alireza0/x-ui/util/json_util"
|
||||
"github.com/alireza0/x-ui/xray"
|
||||
)
|
||||
|
||||
type Protocol string
|
||||
|
||||
14
main.go
14
main.go
@@ -12,13 +12,13 @@ import (
|
||||
"syscall"
|
||||
_ "unsafe"
|
||||
|
||||
"x-ui/config"
|
||||
"x-ui/database"
|
||||
"x-ui/logger"
|
||||
"x-ui/sub"
|
||||
"x-ui/web"
|
||||
"x-ui/web/global"
|
||||
"x-ui/web/service"
|
||||
"github.com/alireza0/x-ui/config"
|
||||
"github.com/alireza0/x-ui/database"
|
||||
"github.com/alireza0/x-ui/logger"
|
||||
"github.com/alireza0/x-ui/sub"
|
||||
"github.com/alireza0/x-ui/web"
|
||||
"github.com/alireza0/x-ui/web/global"
|
||||
"github.com/alireza0/x-ui/web/service"
|
||||
|
||||
"github.com/op/go-logging"
|
||||
"github.com/shirou/gopsutil/v4/net"
|
||||
|
||||
12
sub/sub.go
12
sub/sub.go
@@ -8,12 +8,12 @@ import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"x-ui/config"
|
||||
"x-ui/logger"
|
||||
"x-ui/util/common"
|
||||
"x-ui/web/middleware"
|
||||
"x-ui/web/network"
|
||||
"x-ui/web/service"
|
||||
"github.com/alireza0/x-ui/config"
|
||||
"github.com/alireza0/x-ui/logger"
|
||||
"github.com/alireza0/x-ui/util/common"
|
||||
"github.com/alireza0/x-ui/web/middleware"
|
||||
"github.com/alireza0/x-ui/web/network"
|
||||
"github.com/alireza0/x-ui/web/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
@@ -6,12 +6,12 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"x-ui/database/model"
|
||||
"x-ui/logger"
|
||||
"x-ui/util/json_util"
|
||||
"x-ui/util/random"
|
||||
"x-ui/web/service"
|
||||
"x-ui/xray"
|
||||
"github.com/alireza0/x-ui/database/model"
|
||||
"github.com/alireza0/x-ui/logger"
|
||||
"github.com/alireza0/x-ui/util/json_util"
|
||||
"github.com/alireza0/x-ui/util/random"
|
||||
"github.com/alireza0/x-ui/web/service"
|
||||
"github.com/alireza0/x-ui/xray"
|
||||
)
|
||||
|
||||
//go:embed default.json
|
||||
|
||||
@@ -7,13 +7,13 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"x-ui/database"
|
||||
"x-ui/database/model"
|
||||
"x-ui/logger"
|
||||
"x-ui/util/common"
|
||||
"x-ui/util/random"
|
||||
"x-ui/web/service"
|
||||
"x-ui/xray"
|
||||
"github.com/alireza0/x-ui/database"
|
||||
"github.com/alireza0/x-ui/database/model"
|
||||
"github.com/alireza0/x-ui/logger"
|
||||
"github.com/alireza0/x-ui/util/common"
|
||||
"github.com/alireza0/x-ui/util/random"
|
||||
"github.com/alireza0/x-ui/web/service"
|
||||
"github.com/alireza0/x-ui/xray"
|
||||
|
||||
"github.com/goccy/go-json"
|
||||
)
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"x-ui/logger"
|
||||
"github.com/alireza0/x-ui/logger"
|
||||
)
|
||||
|
||||
func NewErrorf(format string, a ...interface{}) error {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"x-ui/web/service"
|
||||
"github.com/alireza0/x-ui/web/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@@ -9,27 +9,36 @@ import (
|
||||
type APIController struct {
|
||||
BaseController
|
||||
inboundController *InboundController
|
||||
serverController *ServerController
|
||||
Tgbot service.Tgbot
|
||||
}
|
||||
|
||||
func NewAPIController(g *gin.RouterGroup) *APIController {
|
||||
a := &APIController{}
|
||||
func NewAPIController(g *gin.RouterGroup, s *ServerController) *APIController {
|
||||
a := &APIController{
|
||||
serverController: s,
|
||||
}
|
||||
a.initRouter(g)
|
||||
return a
|
||||
}
|
||||
|
||||
func (a *APIController) initRouter(g *gin.RouterGroup) {
|
||||
g = g.Group("/xui/API/inbounds")
|
||||
g.Use(a.checkLogin)
|
||||
api := g.Group("/xui/API")
|
||||
api.Use(a.checkLogin)
|
||||
|
||||
a.inboundController = NewInboundController(g)
|
||||
a.inboundApi(api)
|
||||
a.serverApi(api)
|
||||
}
|
||||
|
||||
func (a *APIController) inboundApi(api *gin.RouterGroup) {
|
||||
inboundsApi := api.Group("/inbounds")
|
||||
|
||||
a.inboundController = &InboundController{}
|
||||
|
||||
inboundRoutes := []struct {
|
||||
Method string
|
||||
Path string
|
||||
Handler gin.HandlerFunc
|
||||
}{
|
||||
{"GET", "/createbackup", a.createBackup},
|
||||
{"GET", "/", a.inboundController.getInbounds},
|
||||
{"GET", "/get/:id", a.inboundController.getInbound},
|
||||
{"GET", "/getClientTraffics/:email", a.inboundController.getClientTraffics},
|
||||
@@ -48,7 +57,37 @@ func (a *APIController) initRouter(g *gin.RouterGroup) {
|
||||
}
|
||||
|
||||
for _, route := range inboundRoutes {
|
||||
g.Handle(route.Method, route.Path, route.Handler)
|
||||
inboundsApi.Handle(route.Method, route.Path, route.Handler)
|
||||
}
|
||||
}
|
||||
|
||||
func (a *APIController) serverApi(api *gin.RouterGroup) {
|
||||
serverApi := api.Group("/server")
|
||||
|
||||
serverRoutes := []struct {
|
||||
Method string
|
||||
Path string
|
||||
Handler gin.HandlerFunc
|
||||
}{
|
||||
{"GET", "/status", a.serverController.status},
|
||||
{"GET", "/getDb", a.serverController.getDb},
|
||||
{"GET", "/createbackup", a.createBackup},
|
||||
{"GET", "/getConfigJson", a.serverController.getConfigJson},
|
||||
{"GET", "/getXrayVersion", a.serverController.getXrayVersion},
|
||||
{"GET", "/getNewVlessEnc", a.serverController.getNewVlessEnc},
|
||||
{"GET", "/getNewX25519Cert", a.serverController.getNewX25519Cert},
|
||||
{"GET", "/getNewmldsa65", a.serverController.getNewmldsa65},
|
||||
|
||||
{"POST", "/getNewEchCert", a.serverController.getNewEchCert},
|
||||
{"POST", "/importDB", a.serverController.importDB},
|
||||
{"POST", "/stopXrayService", a.serverController.stopXrayService},
|
||||
{"POST", "/restartXrayService", a.serverController.restartXrayService},
|
||||
{"POST", "/installXray/:version", a.serverController.installXray},
|
||||
{"POST", "/logs/:count", a.serverController.getLogs},
|
||||
}
|
||||
|
||||
for _, route := range serverRoutes {
|
||||
serverApi.Handle(route.Method, route.Path, route.Handler)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@ package controller
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"x-ui/logger"
|
||||
"x-ui/web/locale"
|
||||
"x-ui/web/session"
|
||||
"github.com/alireza0/x-ui/logger"
|
||||
"github.com/alireza0/x-ui/web/locale"
|
||||
"github.com/alireza0/x-ui/web/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
@@ -5,9 +5,9 @@ import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"x-ui/database/model"
|
||||
"x-ui/web/service"
|
||||
"x-ui/web/session"
|
||||
"github.com/alireza0/x-ui/database/model"
|
||||
"github.com/alireza0/x-ui/web/service"
|
||||
"github.com/alireza0/x-ui/web/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@@ -99,8 +99,7 @@ func (a *InboundController) addInbound(c *gin.Context) {
|
||||
inbound.Tag = fmt.Sprintf("inbound-%v:%v", inbound.Listen, inbound.Port)
|
||||
}
|
||||
|
||||
needRestart := false
|
||||
inbound, needRestart, err = a.inboundService.AddInbound(inbound)
|
||||
inbound, needRestart, err := a.inboundService.AddInbound(inbound)
|
||||
jsonMsgObj(c, I18nWeb(c, "pages.inbounds.create"), inbound, err)
|
||||
if err == nil && needRestart {
|
||||
a.xrayService.SetToNeedRestart()
|
||||
@@ -113,8 +112,7 @@ func (a *InboundController) delInbound(c *gin.Context) {
|
||||
jsonMsg(c, I18nWeb(c, "delete"), err)
|
||||
return
|
||||
}
|
||||
needRestart := true
|
||||
needRestart, err = a.inboundService.DelInbound(id)
|
||||
needRestart, err := a.inboundService.DelInbound(id)
|
||||
jsonMsgObj(c, I18nWeb(c, "delete"), id, err)
|
||||
if err == nil && needRestart {
|
||||
a.xrayService.SetToNeedRestart()
|
||||
@@ -135,8 +133,7 @@ func (a *InboundController) updateInbound(c *gin.Context) {
|
||||
jsonMsg(c, I18nWeb(c, "pages.inbounds.update"), err)
|
||||
return
|
||||
}
|
||||
needRestart := true
|
||||
inbound, needRestart, err = a.inboundService.UpdateInbound(inbound)
|
||||
inbound, needRestart, err := a.inboundService.UpdateInbound(inbound)
|
||||
jsonMsgObj(c, I18nWeb(c, "pages.inbounds.update"), inbound, err)
|
||||
if err == nil && needRestart {
|
||||
a.xrayService.SetToNeedRestart()
|
||||
@@ -151,9 +148,7 @@ func (a *InboundController) addInboundClient(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
needRestart := true
|
||||
|
||||
needRestart, err = a.inboundService.AddInboundClient(data)
|
||||
needRestart, err := a.inboundService.AddInboundClient(data)
|
||||
if err != nil {
|
||||
jsonMsg(c, "Something went wrong!", err)
|
||||
return
|
||||
@@ -172,9 +167,7 @@ func (a *InboundController) delInboundClient(c *gin.Context) {
|
||||
}
|
||||
clientId := c.Param("clientId")
|
||||
|
||||
needRestart := true
|
||||
|
||||
needRestart, err = a.inboundService.DelInboundClient(id, clientId)
|
||||
needRestart, err := a.inboundService.DelInboundClient(id, clientId)
|
||||
if err != nil {
|
||||
jsonMsg(c, "Something went wrong!", err)
|
||||
return
|
||||
@@ -195,9 +188,7 @@ func (a *InboundController) updateInboundClient(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
needRestart := true
|
||||
|
||||
needRestart, err = a.inboundService.UpdateInboundClient(inbound, clientId)
|
||||
needRestart, err := a.inboundService.UpdateInboundClient(inbound, clientId)
|
||||
if err != nil {
|
||||
jsonMsg(c, "Something went wrong!", err)
|
||||
return
|
||||
@@ -216,9 +207,7 @@ func (a *InboundController) resetClientTraffic(c *gin.Context) {
|
||||
}
|
||||
email := c.Param("email")
|
||||
|
||||
needRestart := true
|
||||
|
||||
needRestart, err = a.inboundService.ResetClientTraffic(id, email)
|
||||
needRestart, err := a.inboundService.ResetClientTraffic(id, email)
|
||||
if err != nil {
|
||||
jsonMsg(c, "Something went wrong!", err)
|
||||
return
|
||||
@@ -292,8 +281,7 @@ func (a *InboundController) importInbound(c *gin.Context) {
|
||||
inbound.ClientStats[index].Enable = true
|
||||
}
|
||||
|
||||
needRestart := false
|
||||
inbound, needRestart, err = a.inboundService.AddInbound(inbound)
|
||||
inbound, needRestart, err := a.inboundService.AddInbound(inbound)
|
||||
jsonMsgObj(c, I18nWeb(c, "pages.inbounds.create"), inbound, err)
|
||||
if err == nil && needRestart {
|
||||
a.xrayService.SetToNeedRestart()
|
||||
|
||||
@@ -5,9 +5,9 @@ import (
|
||||
"text/template"
|
||||
"time"
|
||||
|
||||
"x-ui/logger"
|
||||
"x-ui/web/service"
|
||||
"x-ui/web/session"
|
||||
"github.com/alireza0/x-ui/logger"
|
||||
"github.com/alireza0/x-ui/web/service"
|
||||
"github.com/alireza0/x-ui/web/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"regexp"
|
||||
"time"
|
||||
|
||||
"x-ui/web/global"
|
||||
"x-ui/web/service"
|
||||
"github.com/alireza0/x-ui/web/global"
|
||||
"github.com/alireza0/x-ui/web/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@@ -39,20 +39,20 @@ func (a *ServerController) initRouter(g *gin.RouterGroup) {
|
||||
g = g.Group("/server")
|
||||
|
||||
g.Use(a.checkLogin)
|
||||
g.GET("/status", a.status)
|
||||
g.GET("/getDb", a.getDb)
|
||||
g.GET("/getConfigJson", a.getConfigJson)
|
||||
g.GET("/getNewmldsa65", a.getNewmldsa65)
|
||||
g.GET("/getNewVlessEnc", a.getNewVlessEnc)
|
||||
g.GET("/getXrayVersion", a.getXrayVersion)
|
||||
g.GET("/getNewX25519Cert", a.getNewX25519Cert)
|
||||
|
||||
g.POST("/status", a.status)
|
||||
g.POST("/getXrayVersion", a.getXrayVersion)
|
||||
g.POST("/getNewEchCert", a.getNewEchCert)
|
||||
g.POST("/stopXrayService", a.stopXrayService)
|
||||
g.POST("/restartXrayService", a.restartXrayService)
|
||||
g.POST("/installXray/:version", a.installXray)
|
||||
g.POST("/logs/:count", a.getLogs)
|
||||
g.POST("/getConfigJson", a.getConfigJson)
|
||||
g.POST("/importDB", a.importDB)
|
||||
g.POST("/getNewX25519Cert", a.getNewX25519Cert)
|
||||
g.POST("/getNewmldsa65", a.getNewmldsa65)
|
||||
g.POST("/getNewEchCert", a.getNewEchCert)
|
||||
}
|
||||
|
||||
func (a *ServerController) refreshStatus() {
|
||||
|
||||
@@ -4,9 +4,9 @@ import (
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"x-ui/web/entity"
|
||||
"x-ui/web/service"
|
||||
"x-ui/web/session"
|
||||
"github.com/alireza0/x-ui/web/entity"
|
||||
"github.com/alireza0/x-ui/web/service"
|
||||
"github.com/alireza0/x-ui/web/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
@@ -5,9 +5,9 @@ import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"x-ui/config"
|
||||
"x-ui/logger"
|
||||
"x-ui/web/entity"
|
||||
"github.com/alireza0/x-ui/config"
|
||||
"github.com/alireza0/x-ui/logger"
|
||||
"github.com/alireza0/x-ui/web/entity"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"x-ui/web/service"
|
||||
"github.com/alireza0/x-ui/web/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"x-ui/util/common"
|
||||
"github.com/alireza0/x-ui/util/common"
|
||||
)
|
||||
|
||||
type Msg struct {
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
},
|
||||
async getNewX25519Cert(){
|
||||
inModal.loading(true);
|
||||
const msg = await HttpUtil.post('/server/getNewX25519Cert');
|
||||
const msg = await HttpUtil.get('/server/getNewX25519Cert');
|
||||
inModal.loading(false);
|
||||
if (!msg.success) {
|
||||
return;
|
||||
@@ -138,7 +138,7 @@
|
||||
},
|
||||
async getNewmldsa65() {
|
||||
inModal.loading(true);
|
||||
const msg = await HttpUtil.post('/server/getNewmldsa65');
|
||||
const msg = await HttpUtil.get('/server/getNewmldsa65');
|
||||
inModal.loading(false);
|
||||
if (!msg.success) {
|
||||
return;
|
||||
|
||||
@@ -535,7 +535,7 @@
|
||||
this.loadingTip = tip;
|
||||
},
|
||||
async getStatus() {
|
||||
const msg = await HttpUtil.post('/server/status');
|
||||
const msg = await HttpUtil.get('/server/status');
|
||||
if (msg.success) {
|
||||
this.setStatus(msg.obj);
|
||||
}
|
||||
@@ -545,7 +545,7 @@
|
||||
},
|
||||
async openSelectV2rayVersion() {
|
||||
this.loading(true);
|
||||
const msg = await HttpUtil.post('server/getXrayVersion');
|
||||
const msg = await HttpUtil.get('server/getXrayVersion');
|
||||
this.loading(false);
|
||||
if (!msg.success) {
|
||||
return;
|
||||
@@ -595,7 +595,7 @@
|
||||
},
|
||||
async openConfig() {
|
||||
this.loading(true);
|
||||
const msg = await HttpUtil.post('server/getConfigJson');
|
||||
const msg = await HttpUtil.get('server/getConfigJson');
|
||||
this.loading(false);
|
||||
if (!msg.success) {
|
||||
return;
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"x-ui/web/service"
|
||||
"github.com/alireza0/x-ui/web/service"
|
||||
|
||||
"github.com/shirou/gopsutil/v4/cpu"
|
||||
)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package job
|
||||
|
||||
import "x-ui/web/service"
|
||||
import "github.com/alireza0/x-ui/web/service"
|
||||
|
||||
type CheckXrayRunningJob struct {
|
||||
xrayService service.XrayService
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package job
|
||||
|
||||
import (
|
||||
"x-ui/web/service"
|
||||
"github.com/alireza0/x-ui/web/service"
|
||||
)
|
||||
|
||||
type LoginStatus byte
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package job
|
||||
|
||||
import (
|
||||
"x-ui/logger"
|
||||
"x-ui/web/service"
|
||||
"github.com/alireza0/x-ui/logger"
|
||||
"github.com/alireza0/x-ui/web/service"
|
||||
)
|
||||
|
||||
type XrayTrafficJob struct {
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"io/fs"
|
||||
"strings"
|
||||
|
||||
"x-ui/logger"
|
||||
"github.com/alireza0/x-ui/logger"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||
@@ -48,10 +48,10 @@ func InitLocalizer(i18nFS embed.FS, settingService SettingService) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func createTemplateData(params []string, seperator ...string) map[string]interface{} {
|
||||
func createTemplateData(params []string, separator ...string) map[string]interface{} {
|
||||
var sep string = "=="
|
||||
if len(seperator) > 0 {
|
||||
sep = seperator[0]
|
||||
if len(separator) > 0 {
|
||||
sep = separator[0]
|
||||
}
|
||||
|
||||
templateData := make(map[string]interface{})
|
||||
|
||||
@@ -6,11 +6,11 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"x-ui/database"
|
||||
"x-ui/database/model"
|
||||
"x-ui/logger"
|
||||
"x-ui/util/common"
|
||||
"x-ui/xray"
|
||||
"github.com/alireza0/x-ui/database"
|
||||
"github.com/alireza0/x-ui/database/model"
|
||||
"github.com/alireza0/x-ui/logger"
|
||||
"github.com/alireza0/x-ui/util/common"
|
||||
"github.com/alireza0/x-ui/xray"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"x-ui/logger"
|
||||
"github.com/alireza0/x-ui/logger"
|
||||
)
|
||||
|
||||
type PanelService struct{}
|
||||
|
||||
@@ -17,12 +17,12 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"x-ui/config"
|
||||
"x-ui/database"
|
||||
"x-ui/logger"
|
||||
"x-ui/util/common"
|
||||
"x-ui/util/sys"
|
||||
"x-ui/xray"
|
||||
"github.com/alireza0/x-ui/config"
|
||||
"github.com/alireza0/x-ui/database"
|
||||
"github.com/alireza0/x-ui/logger"
|
||||
"github.com/alireza0/x-ui/util/common"
|
||||
"github.com/alireza0/x-ui/util/sys"
|
||||
"github.com/alireza0/x-ui/xray"
|
||||
|
||||
"github.com/shirou/gopsutil/v4/cpu"
|
||||
"github.com/shirou/gopsutil/v4/disk"
|
||||
|
||||
@@ -10,13 +10,13 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"x-ui/database"
|
||||
"x-ui/database/model"
|
||||
"x-ui/logger"
|
||||
"x-ui/util/common"
|
||||
"x-ui/util/random"
|
||||
"x-ui/util/reflect_util"
|
||||
"x-ui/web/entity"
|
||||
"github.com/alireza0/x-ui/database"
|
||||
"github.com/alireza0/x-ui/database/model"
|
||||
"github.com/alireza0/x-ui/logger"
|
||||
"github.com/alireza0/x-ui/util/common"
|
||||
"github.com/alireza0/x-ui/util/random"
|
||||
"github.com/alireza0/x-ui/util/reflect_util"
|
||||
"github.com/alireza0/x-ui/web/entity"
|
||||
)
|
||||
|
||||
//go:embed config.json
|
||||
|
||||
@@ -9,13 +9,13 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"x-ui/config"
|
||||
"x-ui/database"
|
||||
"x-ui/database/model"
|
||||
"x-ui/logger"
|
||||
"x-ui/util/common"
|
||||
"x-ui/web/locale"
|
||||
"x-ui/xray"
|
||||
"github.com/alireza0/x-ui/config"
|
||||
"github.com/alireza0/x-ui/database"
|
||||
"github.com/alireza0/x-ui/database/model"
|
||||
"github.com/alireza0/x-ui/logger"
|
||||
"github.com/alireza0/x-ui/util/common"
|
||||
"github.com/alireza0/x-ui/web/locale"
|
||||
"github.com/alireza0/x-ui/xray"
|
||||
|
||||
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
|
||||
)
|
||||
|
||||
@@ -3,9 +3,9 @@ package service
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"x-ui/database"
|
||||
"x-ui/database/model"
|
||||
"x-ui/logger"
|
||||
"github.com/alireza0/x-ui/database"
|
||||
"github.com/alireza0/x-ui/database/model"
|
||||
"github.com/alireza0/x-ui/logger"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
@@ -7,8 +7,9 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
"x-ui/logger"
|
||||
"x-ui/util/common"
|
||||
|
||||
"github.com/alireza0/x-ui/logger"
|
||||
"github.com/alireza0/x-ui/util/common"
|
||||
)
|
||||
|
||||
type WarpService struct {
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"runtime"
|
||||
"sync"
|
||||
|
||||
"x-ui/logger"
|
||||
"x-ui/xray"
|
||||
"github.com/alireza0/x-ui/logger"
|
||||
"github.com/alireza0/x-ui/xray"
|
||||
|
||||
"go.uber.org/atomic"
|
||||
)
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
_ "embed"
|
||||
"encoding/json"
|
||||
|
||||
"x-ui/util/common"
|
||||
"x-ui/xray"
|
||||
"github.com/alireza0/x-ui/util/common"
|
||||
"github.com/alireza0/x-ui/xray"
|
||||
)
|
||||
|
||||
type XraySettingService struct {
|
||||
|
||||
@@ -3,7 +3,7 @@ package session
|
||||
import (
|
||||
"encoding/gob"
|
||||
|
||||
"x-ui/database/model"
|
||||
"github.com/alireza0/x-ui/database/model"
|
||||
|
||||
"github.com/gin-contrib/sessions"
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
20
web/web.go
20
web/web.go
@@ -14,15 +14,15 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"x-ui/config"
|
||||
"x-ui/logger"
|
||||
"x-ui/util/common"
|
||||
"x-ui/web/controller"
|
||||
"x-ui/web/job"
|
||||
"x-ui/web/locale"
|
||||
"x-ui/web/middleware"
|
||||
"x-ui/web/network"
|
||||
"x-ui/web/service"
|
||||
"github.com/alireza0/x-ui/config"
|
||||
"github.com/alireza0/x-ui/logger"
|
||||
"github.com/alireza0/x-ui/util/common"
|
||||
"github.com/alireza0/x-ui/web/controller"
|
||||
"github.com/alireza0/x-ui/web/job"
|
||||
"github.com/alireza0/x-ui/web/locale"
|
||||
"github.com/alireza0/x-ui/web/middleware"
|
||||
"github.com/alireza0/x-ui/web/network"
|
||||
"github.com/alireza0/x-ui/web/service"
|
||||
|
||||
"github.com/gin-contrib/gzip"
|
||||
"github.com/gin-contrib/sessions"
|
||||
@@ -228,7 +228,7 @@ func (s *Server) initRouter() (*gin.Engine, error) {
|
||||
s.index = controller.NewIndexController(g)
|
||||
s.server = controller.NewServerController(g)
|
||||
s.xui = controller.NewXUIController(g)
|
||||
s.api = controller.NewAPIController(g)
|
||||
s.api = controller.NewAPIController(g, s.server)
|
||||
|
||||
return engine, nil
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"regexp"
|
||||
"time"
|
||||
|
||||
"x-ui/logger"
|
||||
"x-ui/util/common"
|
||||
"github.com/alireza0/x-ui/logger"
|
||||
"github.com/alireza0/x-ui/util/common"
|
||||
|
||||
"github.com/xtls/xray-core/app/proxyman/command"
|
||||
statsService "github.com/xtls/xray-core/app/stats/command"
|
||||
|
||||
@@ -3,7 +3,7 @@ package xray
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"x-ui/util/json_util"
|
||||
"github.com/alireza0/x-ui/util/json_util"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
|
||||
@@ -3,7 +3,7 @@ package xray
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"x-ui/util/json_util"
|
||||
"github.com/alireza0/x-ui/util/json_util"
|
||||
)
|
||||
|
||||
type InboundConfig struct {
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"x-ui/logger"
|
||||
"github.com/alireza0/x-ui/logger"
|
||||
)
|
||||
|
||||
func NewLogWriter() *LogWriter {
|
||||
|
||||
@@ -12,9 +12,9 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"x-ui/config"
|
||||
"x-ui/logger"
|
||||
"x-ui/util/common"
|
||||
"github.com/alireza0/x-ui/config"
|
||||
"github.com/alireza0/x-ui/logger"
|
||||
"github.com/alireza0/x-ui/util/common"
|
||||
)
|
||||
|
||||
func GetBinaryName() string {
|
||||
|
||||
Reference in New Issue
Block a user