mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update scripts for reuse
This commit is contained in:
parent
83d7b945d7
commit
42d8ccb0aa
2 changed files with 18 additions and 10 deletions
|
@ -2,7 +2,7 @@
|
|||
window.MediaBrowser = {};
|
||||
}
|
||||
|
||||
MediaBrowser.ConnectionManager = function (store) {
|
||||
MediaBrowser.ConnectionManager = function ($) {
|
||||
|
||||
MediaBrowser.ConnectionState = {
|
||||
Unavilable: 0,
|
||||
|
@ -67,7 +67,9 @@ MediaBrowser.ConnectionManager = function (store) {
|
|||
dataType: "json",
|
||||
|
||||
error: function () {
|
||||
}
|
||||
},
|
||||
|
||||
timeout: 5000
|
||||
|
||||
});
|
||||
}
|
||||
|
@ -126,7 +128,7 @@ MediaBrowser.ConnectionManager = function (store) {
|
|||
apiClient.serverInfo(server);
|
||||
|
||||
$(apiClient).on('authenticated', function (e, result) {
|
||||
onLocalAuthenticated(this, result);
|
||||
onLocalAuthenticated(this, result, true);
|
||||
});
|
||||
|
||||
$(this).trigger('apiclientcreated', [apiClient]);
|
||||
|
@ -145,7 +147,7 @@ MediaBrowser.ConnectionManager = function (store) {
|
|||
return apiClient;
|
||||
}
|
||||
|
||||
function onLocalAuthenticated(apiClient, result) {
|
||||
function onLocalAuthenticated(apiClient, result, saveCredentials) {
|
||||
|
||||
apiClient.getSystemInfo().done(function (systemInfo) {
|
||||
|
||||
|
@ -155,8 +157,14 @@ MediaBrowser.ConnectionManager = function (store) {
|
|||
var credentials = credentialProvider.credentials();
|
||||
|
||||
server.DateLastAccessed = new Date().getTime();
|
||||
server.UserId = result.User.Id;
|
||||
server.AccessToken = result.AccessToken;
|
||||
|
||||
if (saveCredentials) {
|
||||
server.UserId = result.User.Id;
|
||||
server.AccessToken = result.AccessToken;
|
||||
} else {
|
||||
server.UserId = null;
|
||||
server.AccessToken = null;
|
||||
}
|
||||
|
||||
credentials.addOrUpdateServer(credentials.servers, server);
|
||||
credentialProvider.credentials(credentials);
|
||||
|
@ -785,4 +793,4 @@ MediaBrowser.ConnectionManager = function (store) {
|
|||
};
|
||||
};
|
||||
|
||||
}(window.store);
|
||||
}(jQuery);
|
|
@ -2,7 +2,7 @@
|
|||
window.MediaBrowser = {};
|
||||
}
|
||||
|
||||
MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, window, FileReader) {
|
||||
MediaBrowser.ApiClient = function ($, JSON, WebSocket, setTimeout, devicePixelRatio, FileReader) {
|
||||
|
||||
/**
|
||||
* Creates a new api client instance
|
||||
|
@ -2119,7 +2119,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
|||
|
||||
function normalizeImageOptions(options) {
|
||||
|
||||
var ratio = window.devicePixelRatio || 1;
|
||||
var ratio = devicePixelRatio || 1;
|
||||
|
||||
if (ratio) {
|
||||
|
||||
|
@ -3194,7 +3194,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
|||
|
||||
};
|
||||
|
||||
}(jQuery, navigator, window.JSON, window.WebSocket, setTimeout, window, window.FileReader);
|
||||
}(jQuery, window.JSON, window.WebSocket, setTimeout, window.devicePixelRatio, window.FileReader);
|
||||
|
||||
(function (store) {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue