mirror of
https://github.com/fatedier/frp.git
synced 2026-01-11 22:23:12 +00:00
fix broken server api and dashboard info (#3662)
This commit is contained in:
@@ -121,71 +121,71 @@ function DrawProxyChart(elementId: string, serverInfo: any) {
|
||||
}
|
||||
|
||||
if (
|
||||
serverInfo.proxy_type_count.tcp != null &&
|
||||
serverInfo.proxy_type_count.tcp != 0
|
||||
serverInfo.proxyTypeCount.tcp != null &&
|
||||
serverInfo.proxyTypeCount.tcp != 0
|
||||
) {
|
||||
option.series[0].data.push({
|
||||
value: serverInfo.proxy_type_count.tcp,
|
||||
value: serverInfo.proxyTypeCount.tcp,
|
||||
name: 'TCP',
|
||||
})
|
||||
option.legend.data.push('TCP')
|
||||
}
|
||||
if (
|
||||
serverInfo.proxy_type_count.udp != null &&
|
||||
serverInfo.proxy_type_count.udp != 0
|
||||
serverInfo.proxyTypeCount.udp != null &&
|
||||
serverInfo.proxyTypeCount.udp != 0
|
||||
) {
|
||||
option.series[0].data.push({
|
||||
value: serverInfo.proxy_type_count.udp,
|
||||
value: serverInfo.proxyTypeCount.udp,
|
||||
name: 'UDP',
|
||||
})
|
||||
option.legend.data.push('UDP')
|
||||
}
|
||||
if (
|
||||
serverInfo.proxy_type_count.http != null &&
|
||||
serverInfo.proxy_type_count.http != 0
|
||||
serverInfo.proxyTypeCount.http != null &&
|
||||
serverInfo.proxyTypeCount.http != 0
|
||||
) {
|
||||
option.series[0].data.push({
|
||||
value: serverInfo.proxy_type_count.http,
|
||||
value: serverInfo.proxyTypeCount.http,
|
||||
name: 'HTTP',
|
||||
})
|
||||
option.legend.data.push('HTTP')
|
||||
}
|
||||
if (
|
||||
serverInfo.proxy_type_count.https != null &&
|
||||
serverInfo.proxy_type_count.https != 0
|
||||
serverInfo.proxyTypeCount.https != null &&
|
||||
serverInfo.proxyTypeCount.https != 0
|
||||
) {
|
||||
option.series[0].data.push({
|
||||
value: serverInfo.proxy_type_count.https,
|
||||
value: serverInfo.proxyTypeCount.https,
|
||||
name: 'HTTPS',
|
||||
})
|
||||
option.legend.data.push('HTTPS')
|
||||
}
|
||||
if (
|
||||
serverInfo.proxy_type_count.stcp != null &&
|
||||
serverInfo.proxy_type_count.stcp != 0
|
||||
serverInfo.proxyTypeCount.stcp != null &&
|
||||
serverInfo.proxyTypeCount.stcp != 0
|
||||
) {
|
||||
option.series[0].data.push({
|
||||
value: serverInfo.proxy_type_count.stcp,
|
||||
value: serverInfo.proxyTypeCount.stcp,
|
||||
name: 'STCP',
|
||||
})
|
||||
option.legend.data.push('STCP')
|
||||
}
|
||||
if (
|
||||
serverInfo.proxy_type_count.sudp != null &&
|
||||
serverInfo.proxy_type_count.sudp != 0
|
||||
serverInfo.proxyTypeCount.sudp != null &&
|
||||
serverInfo.proxyTypeCount.sudp != 0
|
||||
) {
|
||||
option.series[0].data.push({
|
||||
value: serverInfo.proxy_type_count.sudp,
|
||||
value: serverInfo.proxyTypeCount.sudp,
|
||||
name: 'SUDP',
|
||||
})
|
||||
option.legend.data.push('SUDP')
|
||||
}
|
||||
if (
|
||||
serverInfo.proxy_type_count.xtcp != null &&
|
||||
serverInfo.proxy_type_count.xtcp != 0
|
||||
serverInfo.proxyTypeCount.xtcp != null &&
|
||||
serverInfo.proxyTypeCount.xtcp != 0
|
||||
) {
|
||||
option.series[0].data.push({
|
||||
value: serverInfo.proxy_type_count.xtcp,
|
||||
value: serverInfo.proxyTypeCount.xtcp,
|
||||
name: 'XTCP',
|
||||
})
|
||||
option.legend.data.push('XTCP')
|
||||
|
||||
@@ -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 = ''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user