add panel usage to main page

This commit is contained in:
MHSanaei
2023-08-09 00:37:05 +03:30
parent 05bc655e16
commit e00c3f1823
4 changed files with 57 additions and 23 deletions

View File

@@ -13,6 +13,7 @@ import (
"strings"
"sync"
"syscall"
"time"
"x-ui/config"
"x-ui/logger"
@@ -101,16 +102,18 @@ type process struct {
version string
apiPort int
config *Config
lines *queue.Queue
exitErr error
config *Config
lines *queue.Queue
exitErr error
startTime time.Time
}
func newProcess(config *Config) *process {
return &process{
version: "Unknown",
config: config,
lines: queue.New(100),
version: "Unknown",
config: config,
lines: queue.New(100),
startTime: time.Now(),
}
}
@@ -154,6 +157,10 @@ func (p *Process) GetConfig() *Config {
return p.config
}
func (p *Process) GetUptime() uint64 {
return uint64(time.Since(p.startTime).Seconds())
}
func (p *process) refreshAPIPort() {
for _, inbound := range p.config.InboundConfigs {
if inbound.Tag == "api" {