1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-vps-admin.git synced 2025-02-12 10:31:52 +00:00

Fix V2Ray stats

This commit is contained in:
Ycarus (Yannick Chabanois) 2023-08-28 10:16:20 +02:00
parent b0da254f01
commit d77ffb6208
2 changed files with 9 additions and 2 deletions

6
debian/changelog vendored
View file

@ -1,3 +1,9 @@
omr-vps-admin (0.3+20230828) unstable; urgency=medium
* Fix V2Ray stats
-- OpenMPTCProuter <contact@openmptcprouter.com> Fri, 28 Aug 2023 10:15:54 +0200
omr-vps-admin (0.3+20230825) unstable; urgency=medium
* Add V2Ray VMESS, SOCKS and TROJAN protocols support

View file

@ -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'