mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
move usersettings to server
This commit is contained in:
parent
8fc34293c7
commit
5ec5a0d9fa
48 changed files with 1295 additions and 815 deletions
|
@ -965,7 +965,7 @@ var AppInfo = {};
|
|||
}
|
||||
|
||||
var localApiClient;
|
||||
function bindConnectionManagerEvents(connectionManager, events) {
|
||||
function bindConnectionManagerEvents(connectionManager, events, userSettings) {
|
||||
|
||||
window.Events = events;
|
||||
events.on(ConnectionManager, 'apiclientcreated', onApiClientCreated);
|
||||
|
@ -987,9 +987,15 @@ var AppInfo = {};
|
|||
// newApiClient.normalizeImageOptions = normalizeImageOptions;
|
||||
//});
|
||||
|
||||
events.on(connectionManager, 'localusersignedin', function (e, user) {
|
||||
// Use this instead of the event because it will fire and wait for the promise before firing events to all listeners
|
||||
connectionManager.onLocalUserSignedIn = function (user) {
|
||||
localApiClient = connectionManager.getApiClient(user.ServerId);
|
||||
window.ApiClient = localApiClient;
|
||||
return userSettings.setUserInfo(user.Id, localApiClient);
|
||||
};
|
||||
|
||||
events.on(connectionManager, 'localusersignedout', function () {
|
||||
userSettings.setUserInfo(null, null);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1000,7 +1006,7 @@ var AppInfo = {};
|
|||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
require(['connectionManagerFactory', 'apphost', 'credentialprovider', 'events'], function (connectionManagerExports, apphost, credentialProvider, events) {
|
||||
require(['connectionManagerFactory', 'apphost', 'credentialprovider', 'events', 'userSettings'], function (connectionManagerExports, apphost, credentialProvider, events, userSettings) {
|
||||
|
||||
window.MediaBrowser = Object.assign(window.MediaBrowser || {}, connectionManagerExports);
|
||||
|
||||
|
@ -1014,7 +1020,7 @@ var AppInfo = {};
|
|||
connectionManager = new MediaBrowser.ConnectionManager(credentialProviderInstance, appInfo.appName, appInfo.appVersion, appInfo.deviceName, appInfo.deviceId, capabilities, window.devicePixelRatio);
|
||||
|
||||
defineConnectionManager(connectionManager);
|
||||
bindConnectionManagerEvents(connectionManager, events);
|
||||
bindConnectionManagerEvents(connectionManager, events, userSettings);
|
||||
|
||||
if (Dashboard.isConnectMode()) {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue