mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Add quick connect
This commit is contained in:
parent
0ca38fb37c
commit
b43adb7406
3 changed files with 74 additions and 1 deletions
|
@ -356,7 +356,28 @@ define(["events", "appStorage"], function(events, appStorage) {
|
|||
instance.onAuthenticated ? instance.onAuthenticated(instance, result).then(afterOnAuthenticated) : afterOnAuthenticated()
|
||||
}, reject)
|
||||
})
|
||||
}, ApiClient.prototype.ensureWebSocket = function() {
|
||||
}, ApiClient.prototype.quickConnect = function (token) {
|
||||
if (!token) return Promise.reject();
|
||||
var url = this.getUrl("Users/AuthenticateWithQuickConnect"),
|
||||
instance = this;
|
||||
return new Promise(function(resolve, reject) {
|
||||
var postData = {
|
||||
Token: token
|
||||
};
|
||||
instance.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
data: JSON.stringify(postData),
|
||||
dataType: "json",
|
||||
contentType: "application/json"
|
||||
}).then(function(result) {
|
||||
var afterOnAuthenticated = function() {
|
||||
redetectBitrate(instance), resolve(result)
|
||||
};
|
||||
instance.onAuthenticated ? instance.onAuthenticated(instance, result).then(afterOnAuthenticated) : afterOnAuthenticated()
|
||||
}, reject)
|
||||
})
|
||||
}, ApiClient.prototype.ensureWebSocket = function() {
|
||||
if (!this.isWebSocketOpenOrConnecting() && this.isWebSocketSupported()) try {
|
||||
this.openWebSocket()
|
||||
} catch (err) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue