mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2026-04-27 22:05:38 +00:00
Migrate to current auth methods
This commit is contained in:
parent
beb97eceea
commit
bb4221122e
5 changed files with 13 additions and 12 deletions
|
|
@ -305,7 +305,7 @@ class PlayUtils(object):
|
|||
self.info["Method"] = "DirectStream"
|
||||
|
||||
if self.item["Type"] == "Audio":
|
||||
self.info["Path"] = "%s/Audio/%s/stream.%s?static=true&api_key=%s" % (
|
||||
self.info["Path"] = "%s/Audio/%s/stream.%s?static=true&ApiKey=%s" % (
|
||||
self.info["ServerAddress"],
|
||||
self.item["Id"],
|
||||
source.get("Container", "mp4").split(",")[0],
|
||||
|
|
@ -313,7 +313,7 @@ class PlayUtils(object):
|
|||
)
|
||||
else:
|
||||
self.info["Path"] = (
|
||||
"%s/Videos/%s/stream?static=true&MediaSourceId=%s&api_key=%s"
|
||||
"%s/Videos/%s/stream?static=true&MediaSourceId=%s&ApiKey=%s"
|
||||
% (
|
||||
self.info["ServerAddress"],
|
||||
self.item["Id"],
|
||||
|
|
@ -730,7 +730,7 @@ class PlayUtils(object):
|
|||
):
|
||||
url = "%s%s" % (self.info["ServerAddress"], stream["DeliveryUrl"])
|
||||
else:
|
||||
url = "%s/Videos/%s/%s/Subtitles/%s/Stream.%s?api_key=%s" % (
|
||||
url = "%s/Videos/%s/%s/Subtitles/%s/Stream.%s?ApiKey=%s" % (
|
||||
self.info["ServerAddress"],
|
||||
self.item["Id"],
|
||||
source["Id"],
|
||||
|
|
|
|||
|
|
@ -422,7 +422,7 @@ class API(object):
|
|||
"User-Agent": self.config.data["http.user_agent"]
|
||||
or "%s/%s"
|
||||
% (self.config.data["app.name"], self.config.data["app.version"]),
|
||||
"x-emby-authorization": auth,
|
||||
"Authorization": auth,
|
||||
}
|
||||
|
||||
def send_request(
|
||||
|
|
@ -481,9 +481,10 @@ class API(object):
|
|||
return {}
|
||||
|
||||
def validate_authentication_token(self, server):
|
||||
auth_token_header = {"X-MediaBrowser-Token": server["AccessToken"]}
|
||||
headers = self.get_default_headers()
|
||||
headers.update(auth_token_header)
|
||||
auth_header = headers.get("Authorization", "")
|
||||
auth_header += ", Token=%s" % quote(server["AccessToken"])
|
||||
headers.update({"Authorization": auth_header})
|
||||
|
||||
response = self.send_request(server["address"], "system/info", headers=headers)
|
||||
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ class HTTP(object):
|
|||
}
|
||||
)
|
||||
|
||||
if "x-emby-authorization" not in data["headers"]:
|
||||
if "Authorization" not in data["headers"]:
|
||||
self._authorization(data)
|
||||
|
||||
return data
|
||||
|
|
@ -261,15 +261,15 @@ class HTTP(object):
|
|||
self.config.data.get("app.version", "0.0.0"), safe=""
|
||||
)
|
||||
|
||||
data["headers"].update({"x-emby-authorization": auth})
|
||||
data["headers"].update({"Authorization": auth})
|
||||
|
||||
if self.config.data.get("auth.token") and self.config.data.get("auth.user_id"):
|
||||
|
||||
auth += ", UserId=%s" % quote(self.config.data.get("auth.user_id"), safe="")
|
||||
auth += ", Token=%s" % quote(self.config.data.get("auth.token"), safe="")
|
||||
data["headers"].update(
|
||||
{
|
||||
"x-emby-authorization": auth,
|
||||
"X-MediaBrowser-Token": self.config.data.get("auth.token"),
|
||||
"Authorization": auth,
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class WSClient(threading.Thread):
|
|||
if server.startswith("https")
|
||||
else server.replace("http://", "ws://")
|
||||
)
|
||||
wsc_url = "%s/socket?api_key=%s&device_id=%s" % (server, token, device_id)
|
||||
wsc_url = "%s/socket?ApiKey=%s&device_id=%s" % (server, token, device_id)
|
||||
|
||||
LOG.info("Websocket url: %s", wsc_url)
|
||||
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ class Actions(object):
|
|||
LOG.info("[ playlist/%s ] %s", item["Id"], item["Name"])
|
||||
|
||||
self.set_listitem(item, listitem, None, False)
|
||||
path = "{}/Audio/{}/stream.mp3?static=true&api_key={}".format(
|
||||
path = "{}/Audio/{}/stream.mp3?static=true&ApiKey={}".format(
|
||||
server_address, item["Id"], token
|
||||
)
|
||||
listitem.setPath(path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue