Skip to content

Commit

Permalink
Updates to Syno Auth #1844
Browse files Browse the repository at this point in the history
  • Loading branch information
clinton-hall authored Aug 26, 2021
1 parent 411e70b commit 36eddcf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions libs/custom/syno/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ def __init__(self, ip_address, port, username, password):
self._base_url = 'http://%s:%s/webapi/' % (self._ip_address, self._port)

self.full_api_list = {}
self.app_api_list = {}

def login(self, application):
self.get_api_list('SYNO.API.Auth')
login_api = 'auth.cgi?api=SYNO.API.Auth'
param = {'version': self.app_api_list['SYNO.API.Auth']['maxVersion'], 'method': 'login', 'account': self._username,
param = {'version': self.full_api_list['SYNO.API.Auth']['maxVersion'], 'method': 'login', 'account': self._username,
'passwd': self._password, 'session': application, 'format': 'cookie'}

if not self._session_expire:
Expand All @@ -32,7 +31,7 @@ def login(self, application):

def logout(self, application):
logout_api = 'auth.cgi?api=SYNO.API.Auth'
param = {'version': self.app_api_list['SYNO.API.Auth']['maxVersion'], 'method': 'logout', 'session': application}
param = {'version': self.full_api_list['SYNO.API.Auth']['maxVersion'], 'method': 'logout', 'session': application}

response = requests.get(self._base_url + logout_api, param)
if response.json()['success'] is True:
Expand All @@ -53,7 +52,7 @@ def get_api_list(self, app=None):
if app is not None:
for key in response['data']:
if app.lower() in key.lower():
self.app_api_list[key] = response['data'][key]
self.full_api_list[key] = response['data'][key]
else:
self.full_api_list = response['data']

Expand Down

0 comments on commit 36eddcf

Please sign in to comment.