mirror of
https://github.com/Ysurac/openmptcprouter-vps-admin.git
synced 2025-03-09 15:40:05 +00:00
Fix V2Ray stats
This commit is contained in:
parent
b0da254f01
commit
d77ffb6208
2 changed files with 9 additions and 2 deletions
|
@ -114,7 +114,8 @@ def get_bytes_v2ray(t,user):
|
|||
else:
|
||||
side="uplink"
|
||||
try:
|
||||
data = subprocess.check_output('/usr/bin/v2ctl api --server=127.0.0.1:10085 StatsService.GetStats ' + "'" + 'name: "user>>>' + user + '>>>traffic>>>' + side + '"' + "'" + ' 2>/dev/null | grep value | cut -d: -f2 | tr -d " "', shell = True)
|
||||
data = subprocess.check_output('/usr/bin/v2ray api stats --server=127.0.0.1:10085 -json ' + "'" + 'user>>>' + user + '>>>traffic>>>' + side + "'" + ' 2>/dev/null | jq -r .stat[0].value | tr -d " "', shell = True)
|
||||
#data = subprocess.check_output('/usr/bin/v2ctl api --server=127.0.0.1:10085 StatsService.GetStats ' + "'" + 'name: "user>>>' + user + '>>>traffic>>>' + side + '"' + "'" + ' 2>/dev/null | grep value | cut -d: -f2 | tr -d " "', shell = True)
|
||||
except:
|
||||
return 0
|
||||
if data.decode("utf-8") != '':
|
||||
|
@ -1096,7 +1097,7 @@ async def status(userid: Optional[int] = Query(None), serial: Optional[str] = Qu
|
|||
ss_traffic = 0
|
||||
v2ray_tx = 0
|
||||
v2ray_rx = 0
|
||||
if os.path.isfile('/etc/v2ray/v2ray-server.json') and proxy == 'v2ray' and checkIfProcessRunning('v2ray'):
|
||||
if os.path.isfile('/etc/v2ray/v2ray-server.json') and 'v2ray' in proxy and checkIfProcessRunning('v2ray'):
|
||||
v2ray_tx = get_bytes_v2ray('tx',username)
|
||||
v2ray_rx = get_bytes_v2ray('rx',username)
|
||||
vpn = 'glorytun_tcp'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue