Skip to content

Commit

Permalink
Fix Shadowsocks-go new API add/remove user
Browse files Browse the repository at this point in the history
  • Loading branch information
Ysurac committed Oct 25, 2024
1 parent 371ce38 commit bec293d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
omr-vps-admin (0.13+20241025) unstable; urgency=medium

* Fix Shadowsocks-go new API support on add/remove user

-- OpenMPTCProuter <[email protected]> Fri, 25 Oct 2024 10:09:14 +0200

omr-vps-admin (0.13+20241016) unstable; urgency=medium

* Add Shadowsocks-go new API support
Expand Down
20 changes: 14 additions & 6 deletions omr-admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,22 +391,30 @@ def remove_ss_user(port):

def add_ss_go_user(user, key=''):
try:
r = requests.post(url="http://127.0.0.1:65279/v1/servers/ss-2022/users", json= {'username': user,'uPSK': key})
#r = requests.post(url="http://127.0.0.1:65279/api/ssm/v1/servers/ss-2022/users", json= {'username': user,'uPSK': key})
r = requests.post(url="http://127.0.0.1:65279/api/ssm/v1/servers/ss-2022/users", json= {'username': user,'uPSK': key})
except requests.exceptions.Timeout:
LOG.debug("Shadowsocks go add timeout")
except requests.exceptions.RequestException as err:
LOG.debug("Shadowsocks go add error (" + str(err) + ")")
try:
r = requests.post(url="http://127.0.0.1:65279/v1/servers/ss-2022/users", json= {'username': user,'uPSK': key})
except requests.exceptions.Timeout:
LOG.debug("Shadowsocks go add timeout")
except requests.exceptions.RequestException as err:
LOG.debug("Shadowsocks go add error (" + str(err) + ")")
return key

def remove_ss_go_user(user):
try:
r = requests.delete(url="http://127.0.0.1:65279/v1/servers/ss-2022/users/" + user)
#r = requests.delete(url="http://127.0.0.1:65279/api/ssm/v1/servers/ss-2022/users/" + user)
r = requests.delete(url="http://127.0.0.1:65279/api/ssm/v1/servers/ss-2022/users/" + user)
except requests.exceptions.Timeout:
LOG.debug("Shadowsocks go remove timeout")
except requests.exceptions.RequestException as err:
LOG.debug("Shadowsocks go remove error (" + str(err) + ")")
try:
r = requests.delete(url="http://127.0.0.1:65279/v1/servers/ss-2022/users/" + user)
except requests.exceptions.Timeout:
LOG.debug("Shadowsocks go remove timeout")
except requests.exceptions.RequestException as err:
LOG.debug("Shadowsocks go remove error (" + str(err) + ")")

def v2ray_add_user(user, v2rayuuid='', restart=1):
if v2rayuuid == '':
Expand Down

0 comments on commit bec293d

Please sign in to comment.