mirror of
https://github.com/hrfee/jellyfin-accounts.git
synced 2025-12-13 14:01:13 +00:00
Added user email modification to admin page
Pressing the user settings button brings up a list of all jellyfin users, and allows you to add or change their stored email addresses. Additionally, changed emails.json to use user ID instead of username. The program automatically converts the file to the new format at start.
This commit is contained in:
@@ -35,11 +35,21 @@ class Jellyfin:
|
||||
"User-Agent": self.useragent,
|
||||
"X-Emby-Authorization": self.auth
|
||||
}
|
||||
def getUsers(self, username="all"):
|
||||
response = requests.get(self.server+"/emby/Users/Public").json()
|
||||
if username == "all":
|
||||
return response
|
||||
def getUsers(self, username="all", id="all", public=True):
|
||||
if public:
|
||||
response = requests.get(self.server+"/emby/Users/Public").json()
|
||||
else:
|
||||
response = requests.get(self.server+"/emby/Users",
|
||||
headers=self.header,
|
||||
params={'Username': self.username,
|
||||
'Pw': self.password})
|
||||
if response.status_code == 200:
|
||||
response = response.json()
|
||||
else:
|
||||
raise self.AuthenticationRequiredError
|
||||
if username == "all" and id == "all":
|
||||
return response
|
||||
elif id == "all":
|
||||
match = False
|
||||
for user in response:
|
||||
if user['Name'] == username:
|
||||
@@ -47,6 +57,14 @@ class Jellyfin:
|
||||
return user
|
||||
if not match:
|
||||
raise self.UserNotFoundError
|
||||
else:
|
||||
match = False
|
||||
for user in response:
|
||||
if user['Id'] == id:
|
||||
match = True
|
||||
return user
|
||||
if not match:
|
||||
raise self.UserNotFoundError
|
||||
def authenticate(self, username, password):
|
||||
self.username = username
|
||||
self.password = password
|
||||
|
||||
Reference in New Issue
Block a user