fix broken server api and dashboard info (#3662)

This commit is contained in:
fatedier
2023-10-11 15:01:07 +08:00
committed by GitHub
parent 7cc67e852e
commit df12cc2b9d
14 changed files with 223 additions and 224 deletions

View File

@@ -4,42 +4,43 @@ class BaseProxy {
encryption: boolean
compression: boolean
conns: number
traffic_in: number
traffic_out: number
last_start_time: string
last_close_time: string
trafficIn: number
trafficOut: number
lastStartTime: string
lastCloseTime: string
status: string
client_version: string
clientVersion: string
addr: string
port: number
custom_domains: string
host_header_rewrite: string
customDomains: string
hostHeaderRewrite: string
locations: string
subdomain: string
constructor(proxyStats: any) {
this.name = proxyStats.name
this.type = ''
if (proxyStats.conf != null) {
this.encryption = proxyStats.conf.use_encryption
this.compression = proxyStats.conf.use_compression
} else {
this.encryption = false
this.compression = false
this.encryption = false
this.compression = false
if (proxyStats.conf != null && proxyStats.conf.useEncryption != null) {
this.encryption = proxyStats.conf.useEncryption
}
this.conns = proxyStats.cur_conns
this.traffic_in = proxyStats.today_traffic_in
this.traffic_out = proxyStats.today_traffic_out
this.last_start_time = proxyStats.last_start_time
this.last_close_time = proxyStats.last_close_time
if (proxyStats.conf != null && proxyStats.conf.useCompression != null) {
this.compression = proxyStats.conf.useCompression
}
this.conns = proxyStats.curConns
this.trafficIn = proxyStats.todayTrafficIn
this.trafficOut = proxyStats.todayTrafficOut
this.lastStartTime = proxyStats.lastStartTime
this.lastCloseTime = proxyStats.lastCloseTime
this.status = proxyStats.status
this.client_version = proxyStats.client_version
this.clientVersion = proxyStats.clientVersion
this.addr = ''
this.port = 0
this.custom_domains = ''
this.host_header_rewrite = ''
this.customDomains = ''
this.hostHeaderRewrite = ''
this.locations = ''
this.subdomain = ''
}
@@ -50,8 +51,8 @@ class TCPProxy extends BaseProxy {
super(proxyStats)
this.type = 'tcp'
if (proxyStats.conf != null) {
this.addr = ':' + proxyStats.conf.remote_port
this.port = proxyStats.conf.remote_port
this.addr = ':' + proxyStats.conf.remotePort
this.port = proxyStats.conf.remotePort
} else {
this.addr = ''
this.port = 0
@@ -64,8 +65,8 @@ class UDPProxy extends BaseProxy {
super(proxyStats)
this.type = 'udp'
if (proxyStats.conf != null) {
this.addr = ':' + proxyStats.conf.remote_port
this.port = proxyStats.conf.remote_port
this.addr = ':' + proxyStats.conf.remotePort
this.port = proxyStats.conf.remotePort
} else {
this.addr = ''
this.port = 0
@@ -74,43 +75,35 @@ class UDPProxy extends BaseProxy {
}
class HTTPProxy extends BaseProxy {
constructor(proxyStats: any, port: number, subdomain_host: string) {
constructor(proxyStats: any, port: number, subdomainHost: string) {
super(proxyStats)
this.type = 'http'
this.port = port
if (proxyStats.conf != null) {
this.custom_domains = proxyStats.conf.custom_domains
this.host_header_rewrite = proxyStats.conf.host_header_rewrite
this.locations = proxyStats.conf.locations
if (proxyStats.conf.subdomain != '') {
this.subdomain = proxyStats.conf.subdomain + '.' + subdomain_host
} else {
this.subdomain = ''
if (proxyStats.conf.customDomains != null) {
this.customDomains = proxyStats.conf.customDomains
}
} else {
this.custom_domains = ''
this.host_header_rewrite = ''
this.subdomain = ''
this.locations = ''
this.hostHeaderRewrite = proxyStats.conf.hostHeaderRewrite
this.locations = proxyStats.conf.locations
if (proxyStats.conf.subdomain != null && proxyStats.conf.subdomain != '') {
this.subdomain = proxyStats.conf.subdomain + '.' + subdomainHost
}
}
}
}
class HTTPSProxy extends BaseProxy {
constructor(proxyStats: any, port: number, subdomain_host: string) {
constructor(proxyStats: any, port: number, subdomainHost: string) {
super(proxyStats)
this.type = 'https'
this.port = port
if (proxyStats.conf != null) {
this.custom_domains = proxyStats.conf.custom_domains
if (proxyStats.conf.subdomain != '') {
this.subdomain = proxyStats.conf.subdomain + '.' + subdomain_host
} else {
this.subdomain = ''
if (proxyStats.conf.customDomains != null) {
this.customDomains = proxyStats.conf.customDomains
}
if (proxyStats.conf.subdomain != null && proxyStats.conf.subdomain != '') {
this.subdomain = proxyStats.conf.subdomain + '.' + subdomainHost
}
} else {
this.custom_domains = ''
this.subdomain = ''
}
}
}