mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 19:08:18 -07:00
restore ability to edit user preferences from admin screen
This commit is contained in:
parent
65a75eb894
commit
b90d8515b1
@ -15,12 +15,12 @@
|
||||
},
|
||||
"devDependencies": {},
|
||||
"ignore": [],
|
||||
"version": "1.4.76",
|
||||
"_release": "1.4.76",
|
||||
"version": "1.4.77",
|
||||
"_release": "1.4.77",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "1.4.76",
|
||||
"commit": "6221303e81236b1cc47ccc4fd81b536d4c09f752"
|
||||
"tag": "1.4.77",
|
||||
"commit": "22897eca3cd924d46ea6b612b8959b6bc8912f7c"
|
||||
},
|
||||
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
|
||||
"_target": "^1.2.0",
|
||||
|
4
dashboard-ui/bower_components/emby-webcomponents/usersettings/usersettings.js
vendored
Normal file
4
dashboard-ui/bower_components/emby-webcomponents/usersettings/usersettings.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
define(['userSettingsBuilder'], function (userSettingsBuilder) {
|
||||
|
||||
return new userSettingsBuilder();
|
||||
});
|
@ -1,20 +1,24 @@
|
||||
define(['appSettings', 'apiClientResolver', 'events'], function (appsettings, apiClientResolver, events) {
|
||||
|
||||
function getUserId() {
|
||||
|
||||
var apiClient = apiClientResolver();
|
||||
|
||||
if (apiClient) {
|
||||
return apiClient.getCurrentUserId();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return new function () {
|
||||
return function (configuredUserId) {
|
||||
|
||||
var self = this;
|
||||
|
||||
function getUserId() {
|
||||
|
||||
if (configuredUserId) {
|
||||
return configuredUserId;
|
||||
}
|
||||
|
||||
var apiClient = apiClientResolver();
|
||||
|
||||
if (apiClient) {
|
||||
return apiClient.getCurrentUserId();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
self.set = function (name, value) {
|
||||
|
||||
var userId = getUserId();
|
||||
@ -94,5 +98,5 @@ define(['appSettings', 'apiClientResolver', 'events'], function (appsettings, ap
|
||||
});
|
||||
}
|
||||
};
|
||||
}();
|
||||
};
|
||||
});
|
@ -1,59 +1,60 @@
|
||||
define(['userSettings', 'appStorage'], function (userSettings, appStorage) {
|
||||
|
||||
function loadForm(page, user) {
|
||||
|
||||
page.querySelector('.chkDisplayMissingEpisodes').checked = user.Configuration.DisplayMissingEpisodes || false;
|
||||
page.querySelector('.chkDisplayUnairedEpisodes').checked = user.Configuration.DisplayUnairedEpisodes || false;
|
||||
|
||||
page.querySelector('#selectThemeSong').value = appStorage.getItem('enableThemeSongs-' + user.Id) || '';
|
||||
page.querySelector('#selectBackdrop').value = appStorage.getItem('enableBackdrops-' + user.Id) || '';
|
||||
|
||||
page.querySelector('#selectLanguage').value = userSettings.language() || '';
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
}
|
||||
|
||||
function saveUser(page, user) {
|
||||
|
||||
user.Configuration.DisplayMissingEpisodes = page.querySelector('.chkDisplayMissingEpisodes').checked;
|
||||
user.Configuration.DisplayUnairedEpisodes = page.querySelector('.chkDisplayUnairedEpisodes').checked;
|
||||
|
||||
userSettings.language(page.querySelector('#selectLanguage').value);
|
||||
|
||||
appStorage.setItem('enableThemeSongs-' + user.Id, page.querySelector('#selectThemeSong').value);
|
||||
appStorage.setItem('enableBackdrops-' + user.Id, page.querySelector('#selectBackdrop').value);
|
||||
|
||||
return ApiClient.updateUserConfiguration(user.Id, user.Configuration);
|
||||
}
|
||||
|
||||
function save(page) {
|
||||
|
||||
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
|
||||
|
||||
if (!AppInfo.enableAutoSave) {
|
||||
Dashboard.showLoadingMsg();
|
||||
}
|
||||
|
||||
ApiClient.getUser(userId).then(function (user) {
|
||||
|
||||
saveUser(page, user).then(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
if (!AppInfo.enableAutoSave) {
|
||||
require(['toast'], function (toast) {
|
||||
toast(Globalize.translate('SettingsSaved'));
|
||||
});
|
||||
}
|
||||
|
||||
}, function () {
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
define(['userSettingsBuilder', 'appStorage'], function (userSettingsBuilder, appStorage) {
|
||||
|
||||
return function (view, params) {
|
||||
|
||||
var userId = params.userId || Dashboard.getCurrentUserId();
|
||||
var userSettings = new userSettingsBuilder(userId);
|
||||
|
||||
function loadForm(page, user) {
|
||||
|
||||
page.querySelector('.chkDisplayMissingEpisodes').checked = user.Configuration.DisplayMissingEpisodes || false;
|
||||
page.querySelector('.chkDisplayUnairedEpisodes').checked = user.Configuration.DisplayUnairedEpisodes || false;
|
||||
|
||||
page.querySelector('#selectThemeSong').value = appStorage.getItem('enableThemeSongs-' + user.Id) || '';
|
||||
page.querySelector('#selectBackdrop').value = appStorage.getItem('enableBackdrops-' + user.Id) || '';
|
||||
|
||||
page.querySelector('#selectLanguage').value = userSettings.language() || '';
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
}
|
||||
|
||||
function saveUser(page, user) {
|
||||
|
||||
user.Configuration.DisplayMissingEpisodes = page.querySelector('.chkDisplayMissingEpisodes').checked;
|
||||
user.Configuration.DisplayUnairedEpisodes = page.querySelector('.chkDisplayUnairedEpisodes').checked;
|
||||
|
||||
userSettings.language(page.querySelector('#selectLanguage').value);
|
||||
|
||||
appStorage.setItem('enableThemeSongs-' + user.Id, page.querySelector('#selectThemeSong').value);
|
||||
appStorage.setItem('enableBackdrops-' + user.Id, page.querySelector('#selectBackdrop').value);
|
||||
|
||||
return ApiClient.updateUserConfiguration(user.Id, user.Configuration);
|
||||
}
|
||||
|
||||
function save(page) {
|
||||
|
||||
if (!AppInfo.enableAutoSave) {
|
||||
Dashboard.showLoadingMsg();
|
||||
}
|
||||
|
||||
ApiClient.getUser(userId).then(function (user) {
|
||||
|
||||
saveUser(page, user).then(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
if (!AppInfo.enableAutoSave) {
|
||||
require(['toast'], function (toast) {
|
||||
toast(Globalize.translate('SettingsSaved'));
|
||||
});
|
||||
}
|
||||
|
||||
}, function () {
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
view.querySelector('.displayPreferencesForm').addEventListener('submit', function (e) {
|
||||
save(view);
|
||||
e.preventDefault();
|
||||
@ -72,8 +73,6 @@
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
|
||||
|
||||
ApiClient.getUser(userId).then(function (user) {
|
||||
|
||||
loadForm(page, user);
|
||||
|
@ -187,12 +187,10 @@
|
||||
});
|
||||
}
|
||||
|
||||
function save(page) {
|
||||
function save(page, userId) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
|
||||
|
||||
if (!AppInfo.enableAutoSave) {
|
||||
Dashboard.showLoadingMsg();
|
||||
}
|
||||
@ -252,9 +250,11 @@
|
||||
|
||||
return function (view, params) {
|
||||
|
||||
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
|
||||
|
||||
function onSubmit(e) {
|
||||
|
||||
save(view);
|
||||
save(view, userId);
|
||||
|
||||
// Disable default form submission
|
||||
e.preventDefault();
|
||||
@ -318,7 +318,7 @@
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
|
||||
var userId = params.userId || Dashboard.getCurrentUserId();
|
||||
|
||||
ApiClient.getUser(userId).then(function (user) {
|
||||
|
||||
@ -334,7 +334,7 @@
|
||||
var page = this;
|
||||
|
||||
if (AppInfo.enableAutoSave) {
|
||||
save(page);
|
||||
save(page, userId);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
define(['appSettings', 'userSettings'], function (appSettings, userSettings) {
|
||||
define(['appSettings', 'userSettingsBuilder'], function (appSettings, userSettingsBuilder) {
|
||||
|
||||
function populateLanguages(select, languages) {
|
||||
|
||||
@ -16,128 +16,127 @@
|
||||
select.innerHTML = html;
|
||||
}
|
||||
|
||||
function loadForm(page, user, loggedInUser, allCulturesPromise) {
|
||||
return function (view, params) {
|
||||
|
||||
allCulturesPromise.then(function (allCultures) {
|
||||
var userId = params.userId || Dashboard.getCurrentUserId();
|
||||
var userSettings = new userSettingsBuilder(userId);
|
||||
|
||||
populateLanguages(page.querySelector('#selectAudioLanguage'), allCultures);
|
||||
populateLanguages(page.querySelector('#selectSubtitleLanguage'), allCultures);
|
||||
function loadForm(page, user, loggedInUser, allCulturesPromise) {
|
||||
|
||||
page.querySelector('#selectAudioLanguage', page).value = user.Configuration.AudioLanguagePreference || "";
|
||||
page.querySelector('#selectSubtitleLanguage', page).value = user.Configuration.SubtitleLanguagePreference || "";
|
||||
page.querySelector('.chkEpisodeAutoPlay').checked = user.Configuration.EnableNextEpisodeAutoPlay || false;
|
||||
});
|
||||
allCulturesPromise.then(function (allCultures) {
|
||||
|
||||
page.querySelector('#selectSubtitlePlaybackMode').value = user.Configuration.SubtitleMode || "";
|
||||
populateLanguages(page.querySelector('#selectAudioLanguage'), allCultures);
|
||||
populateLanguages(page.querySelector('#selectSubtitleLanguage'), allCultures);
|
||||
|
||||
page.querySelector('.chkPlayDefaultAudioTrack').checked = user.Configuration.PlayDefaultAudioTrack || false;
|
||||
page.querySelector('.chkEnableCinemaMode').checked = userSettings.enableCinemaMode();
|
||||
page.querySelector('.chkExternalVideoPlayer').checked = appSettings.enableExternalPlayers();
|
||||
|
||||
require(['qualityoptions'], function (qualityoptions) {
|
||||
|
||||
var bitrateOptions = qualityoptions.getVideoQualityOptions(appSettings.maxStreamingBitrate()).map(function (i) {
|
||||
|
||||
return '<option value="' + i.bitrate + '">' + i.name + '</option>';
|
||||
|
||||
}).join('');
|
||||
|
||||
bitrateOptions = '<option value="">' + Globalize.translate('OptionAutomatic') + '</option>' + bitrateOptions;
|
||||
|
||||
page.querySelector('#selectMaxBitrate').innerHTML = bitrateOptions;
|
||||
page.querySelector('#selectMaxChromecastBitrate').innerHTML = bitrateOptions;
|
||||
|
||||
if (appSettings.enableAutomaticBitrateDetection()) {
|
||||
page.querySelector('#selectMaxBitrate').value = '';
|
||||
} else {
|
||||
page.querySelector('#selectMaxBitrate').value = appSettings.maxStreamingBitrate();
|
||||
}
|
||||
|
||||
page.querySelector('#selectMaxChromecastBitrate').value = appSettings.maxChromecastBitrate() || '';
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
}
|
||||
|
||||
function loadPage(page) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
|
||||
|
||||
var promise1 = ApiClient.getUser(userId);
|
||||
|
||||
var promise2 = Dashboard.getCurrentUser();
|
||||
|
||||
var allCulturesPromise = ApiClient.getCultures();
|
||||
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
|
||||
loadForm(page, responses[1], responses[0], allCulturesPromise);
|
||||
|
||||
});
|
||||
|
||||
ApiClient.getNamedConfiguration("cinemamode").then(function (cinemaConfig) {
|
||||
|
||||
if (cinemaConfig.EnableIntrosForMovies || cinemaConfig.EnableIntrosForEpisodes) {
|
||||
page.querySelector('.cinemaModeOptions').classList.remove('hide');
|
||||
} else {
|
||||
page.querySelector('.cinemaModeOptions').classList.add('hide');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function saveUser(page, user) {
|
||||
|
||||
user.Configuration.AudioLanguagePreference = page.querySelector('#selectAudioLanguage').value;
|
||||
user.Configuration.SubtitleLanguagePreference = page.querySelector('#selectSubtitleLanguage').value;
|
||||
|
||||
user.Configuration.SubtitleMode = page.querySelector('#selectSubtitlePlaybackMode').value;
|
||||
user.Configuration.PlayDefaultAudioTrack = page.querySelector('.chkPlayDefaultAudioTrack').checked;
|
||||
user.Configuration.EnableNextEpisodeAutoPlay = page.querySelector('.chkEpisodeAutoPlay').checked;
|
||||
userSettings.enableCinemaMode(page.querySelector('.chkEnableCinemaMode').checked);
|
||||
|
||||
return ApiClient.updateUserConfiguration(user.Id, user.Configuration);
|
||||
}
|
||||
|
||||
function save(page) {
|
||||
|
||||
appSettings.enableExternalPlayers(page.querySelector('.chkExternalVideoPlayer').checked);
|
||||
|
||||
if (page.querySelector('#selectMaxBitrate').value) {
|
||||
appSettings.maxStreamingBitrate(page.querySelector('#selectMaxBitrate').value);
|
||||
appSettings.enableAutomaticBitrateDetection(false);
|
||||
} else {
|
||||
appSettings.enableAutomaticBitrateDetection(true);
|
||||
}
|
||||
|
||||
appSettings.maxChromecastBitrate(page.querySelector('#selectMaxChromecastBitrate').value);
|
||||
|
||||
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
|
||||
|
||||
if (!AppInfo.enableAutoSave) {
|
||||
Dashboard.showLoadingMsg();
|
||||
}
|
||||
|
||||
ApiClient.getUser(userId).then(function (result) {
|
||||
|
||||
saveUser(page, result).then(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
if (!AppInfo.enableAutoSave) {
|
||||
require(['toast'], function (toast) {
|
||||
toast(Globalize.translate('SettingsSaved'));
|
||||
});
|
||||
}
|
||||
|
||||
}, function () {
|
||||
Dashboard.hideLoadingMsg();
|
||||
page.querySelector('#selectAudioLanguage', page).value = user.Configuration.AudioLanguagePreference || "";
|
||||
page.querySelector('#selectSubtitleLanguage', page).value = user.Configuration.SubtitleLanguagePreference || "";
|
||||
page.querySelector('.chkEpisodeAutoPlay').checked = user.Configuration.EnableNextEpisodeAutoPlay || false;
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
page.querySelector('#selectSubtitlePlaybackMode').value = user.Configuration.SubtitleMode || "";
|
||||
|
||||
return function (view, params) {
|
||||
page.querySelector('.chkPlayDefaultAudioTrack').checked = user.Configuration.PlayDefaultAudioTrack || false;
|
||||
page.querySelector('.chkEnableCinemaMode').checked = userSettings.enableCinemaMode();
|
||||
page.querySelector('.chkExternalVideoPlayer').checked = appSettings.enableExternalPlayers();
|
||||
|
||||
require(['qualityoptions'], function (qualityoptions) {
|
||||
|
||||
var bitrateOptions = qualityoptions.getVideoQualityOptions(appSettings.maxStreamingBitrate()).map(function (i) {
|
||||
|
||||
return '<option value="' + i.bitrate + '">' + i.name + '</option>';
|
||||
|
||||
}).join('');
|
||||
|
||||
bitrateOptions = '<option value="">' + Globalize.translate('OptionAutomatic') + '</option>' + bitrateOptions;
|
||||
|
||||
page.querySelector('#selectMaxBitrate').innerHTML = bitrateOptions;
|
||||
page.querySelector('#selectMaxChromecastBitrate').innerHTML = bitrateOptions;
|
||||
|
||||
if (appSettings.enableAutomaticBitrateDetection()) {
|
||||
page.querySelector('#selectMaxBitrate').value = '';
|
||||
} else {
|
||||
page.querySelector('#selectMaxBitrate').value = appSettings.maxStreamingBitrate();
|
||||
}
|
||||
|
||||
page.querySelector('#selectMaxChromecastBitrate').value = appSettings.maxChromecastBitrate() || '';
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
}
|
||||
|
||||
function loadPage(page) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var promise1 = ApiClient.getUser(userId);
|
||||
|
||||
var promise2 = Dashboard.getCurrentUser();
|
||||
|
||||
var allCulturesPromise = ApiClient.getCultures();
|
||||
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
|
||||
loadForm(page, responses[1], responses[0], allCulturesPromise);
|
||||
|
||||
});
|
||||
|
||||
ApiClient.getNamedConfiguration("cinemamode").then(function (cinemaConfig) {
|
||||
|
||||
if (cinemaConfig.EnableIntrosForMovies || cinemaConfig.EnableIntrosForEpisodes) {
|
||||
page.querySelector('.cinemaModeOptions').classList.remove('hide');
|
||||
} else {
|
||||
page.querySelector('.cinemaModeOptions').classList.add('hide');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function saveUser(page, user) {
|
||||
|
||||
user.Configuration.AudioLanguagePreference = page.querySelector('#selectAudioLanguage').value;
|
||||
user.Configuration.SubtitleLanguagePreference = page.querySelector('#selectSubtitleLanguage').value;
|
||||
|
||||
user.Configuration.SubtitleMode = page.querySelector('#selectSubtitlePlaybackMode').value;
|
||||
user.Configuration.PlayDefaultAudioTrack = page.querySelector('.chkPlayDefaultAudioTrack').checked;
|
||||
user.Configuration.EnableNextEpisodeAutoPlay = page.querySelector('.chkEpisodeAutoPlay').checked;
|
||||
userSettings.enableCinemaMode(page.querySelector('.chkEnableCinemaMode').checked);
|
||||
|
||||
return ApiClient.updateUserConfiguration(user.Id, user.Configuration);
|
||||
}
|
||||
|
||||
function save(page) {
|
||||
|
||||
appSettings.enableExternalPlayers(page.querySelector('.chkExternalVideoPlayer').checked);
|
||||
|
||||
if (page.querySelector('#selectMaxBitrate').value) {
|
||||
appSettings.maxStreamingBitrate(page.querySelector('#selectMaxBitrate').value);
|
||||
appSettings.enableAutomaticBitrateDetection(false);
|
||||
} else {
|
||||
appSettings.enableAutomaticBitrateDetection(true);
|
||||
}
|
||||
|
||||
appSettings.maxChromecastBitrate(page.querySelector('#selectMaxChromecastBitrate').value);
|
||||
|
||||
if (!AppInfo.enableAutoSave) {
|
||||
Dashboard.showLoadingMsg();
|
||||
}
|
||||
|
||||
ApiClient.getUser(userId).then(function (result) {
|
||||
|
||||
saveUser(page, result).then(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
if (!AppInfo.enableAutoSave) {
|
||||
require(['toast'], function (toast) {
|
||||
toast(Globalize.translate('SettingsSaved'));
|
||||
});
|
||||
}
|
||||
|
||||
}, function () {
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
view.querySelector('#selectSubtitlePlaybackMode').addEventListener('change', function () {
|
||||
|
||||
|
@ -1202,7 +1202,7 @@ var Dashboard = {
|
||||
}
|
||||
|
||||
if (browserInfo.mobile || browserInfo.tv) {
|
||||
quality -= 30;
|
||||
quality -= 35;
|
||||
}
|
||||
|
||||
if (AppInfo.hasLowImageBandwidth) {
|
||||
@ -1976,7 +1976,8 @@ var AppInfo = {};
|
||||
define("scrollHelper", [embyWebComponentsBowerPath + "/scrollhelper"], returnFirstDependency);
|
||||
|
||||
define("appSettings", [embyWebComponentsBowerPath + "/appsettings"], updateAppSettings);
|
||||
define("userSettings", [embyWebComponentsBowerPath + "/usersettings"], returnFirstDependency);
|
||||
define("userSettings", [embyWebComponentsBowerPath + "/usersettings/usersettings"], returnFirstDependency);
|
||||
define("userSettingsBuilder", [embyWebComponentsBowerPath + "/usersettings/usersettingsbuilder"], returnFirstDependency);
|
||||
|
||||
define("material-icons", ['css!' + embyWebComponentsBowerPath + '/fonts/material-icons/style']);
|
||||
define("robotoFont", ['css!' + embyWebComponentsBowerPath + '/fonts/roboto/style']);
|
||||
|
@ -9,7 +9,7 @@
|
||||
<a href="#" data-role="button" onclick="Dashboard.navigate('userparentalcontrol.html', true);">${TabParentalControl}</a>
|
||||
<a href="#" data-role="button" onclick="Dashboard.navigate('userpassword.html', true);">${TabPassword}</a>
|
||||
</div>
|
||||
<p class="lnkEditUserPreferencesContainer hide">
|
||||
<p class="lnkEditUserPreferencesContainer">
|
||||
<a class="lnkEditUserPreferences" href="#" target="_blank">${ButtonEditOtherUserPreferences}</a>
|
||||
</p>
|
||||
<form class="editUserProfileForm">
|
||||
|
Loading…
Reference in New Issue
Block a user