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

Fix error when API try to remove a port that doesn't exist in Shadowsocks

This commit is contained in:
Ycarus (Yannick Chabanois) 2023-10-13 11:44:17 +02:00
parent d560968d43
commit abd9cc54fe
2 changed files with 10 additions and 2 deletions

6
debian/changelog vendored
View file

@ -1,3 +1,9 @@
omr-vps-admin (0.4+20231013) unstable; urgency=medium
* Fix error when API try to remove a Shadowsocks port that doesn't exist
-- OpenMPTCProuter <contact@openmptcprouter.com> Fri, 13 Oct 2023 11:43:24 +0200
omr-vps-admin (0.4+20231009) unstable; urgency=medium
* Add Shadowsocks-go traffic support

View file

@ -305,9 +305,11 @@ def remove_ss_user(port):
content = re.sub(",\s*}", "}", content) # pylint: disable=W1401
data = json.loads(content)
if 'port_key' in data:
del data['port_key'][str(port)]
if str(port) in data['port_key']:
del data['port_key'][str(port)]
else:
del data['port_conf'][str(port)]
if str(port) in data['port_conf']:
del data['port_conf'][str(port)]
with open('/etc/shadowsocks-libev/manager.json', 'w') as f:
json.dump(data, f, indent=4)
try: