mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
enable user device access
This commit is contained in:
parent
1784c702e6
commit
faf35ed3d7
7 changed files with 99 additions and 20 deletions
|
@ -1284,7 +1284,8 @@ var Dashboard = {
|
||||||
initializeApiClient(apiClient);
|
initializeApiClient(apiClient);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (Dashboard.serverAddress() && Dashboard.getCurrentUserId() && Dashboard.getAccessToken() && !Dashboard.isServerlessPage()) {
|
if (!Dashboard.isServerlessPage()) {
|
||||||
|
if (Dashboard.serverAddress() && Dashboard.getCurrentUserId() && Dashboard.getAccessToken()) {
|
||||||
window.ApiClient = new MediaBrowser.ApiClient(Dashboard.serverAddress(), appName, appVersion, deviceName, deviceId, capabilities);
|
window.ApiClient = new MediaBrowser.ApiClient(Dashboard.serverAddress(), appName, appVersion, deviceName, deviceId, capabilities);
|
||||||
|
|
||||||
ApiClient.setCurrentUserId(Dashboard.getCurrentUserId(), Dashboard.getAccessToken());
|
ApiClient.setCurrentUserId(Dashboard.getCurrentUserId(), Dashboard.getAccessToken());
|
||||||
|
@ -1292,6 +1293,9 @@ var Dashboard = {
|
||||||
initializeApiClient(ApiClient);
|
initializeApiClient(ApiClient);
|
||||||
|
|
||||||
ConnectionManager.addApiClient(ApiClient, true).fail(Dashboard.logout);
|
ConnectionManager.addApiClient(ApiClient, true).fail(Dashboard.logout);
|
||||||
|
} else {
|
||||||
|
Dashboard.logout();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -227,6 +227,12 @@
|
||||||
|
|
||||||
function showSyncButtonsPerUser(page) {
|
function showSyncButtonsPerUser(page) {
|
||||||
|
|
||||||
|
var apiClient = ConnectionManager.currentApiClient();
|
||||||
|
|
||||||
|
if (!apiClient) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Dashboard.getCurrentUser().done(function (user) {
|
Dashboard.getCurrentUser().done(function (user) {
|
||||||
|
|
||||||
if (user.Policy.EnableSync) {
|
if (user.Policy.EnableSync) {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
html += '<fieldset data-role="controlgroup">';
|
html += '<fieldset data-role="controlgroup">';
|
||||||
|
|
||||||
html += '<legend>' + Globalize.translate('HeaderMediaFolders') + '</legend>';
|
html += '<legend>' + Globalize.translate('HeaderLibraryAccess') + '</legend>';
|
||||||
|
|
||||||
for (var i = 0, length = mediaFolders.length; i < length; i++) {
|
for (var i = 0, length = mediaFolders.length; i < length; i++) {
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
html += '<fieldset data-role="controlgroup">';
|
html += '<fieldset data-role="controlgroup">';
|
||||||
|
|
||||||
html += '<legend>' + Globalize.translate('HeaderChannels') + '</legend>';
|
html += '<legend>' + Globalize.translate('HeaderChannelAccess') + '</legend>';
|
||||||
|
|
||||||
for (var i = 0, length = channels.length; i < length; i++) {
|
for (var i = 0, length = channels.length; i < length; i++) {
|
||||||
|
|
||||||
|
@ -56,7 +56,37 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadUser(page, user, loggedInUser, mediaFolders, channels) {
|
function loadDevices(page, user, devices) {
|
||||||
|
|
||||||
|
var html = '';
|
||||||
|
|
||||||
|
html += '<fieldset data-role="controlgroup">';
|
||||||
|
|
||||||
|
html += '<legend>' + Globalize.translate('HeaderSelectDevices') + '</legend>';
|
||||||
|
|
||||||
|
for (var i = 0, length = devices.length; i < length; i++) {
|
||||||
|
|
||||||
|
var device = devices[i];
|
||||||
|
|
||||||
|
var id = 'device' + i;
|
||||||
|
|
||||||
|
var checkedAttribute = user.Policy.EnableAllDevices || user.Policy.EnabledDevices.indexOf(device.Id) != -1 ? ' checked="checked"' : '';
|
||||||
|
|
||||||
|
html += '<input class="chkDevice" data-deviceid="' + device.Id + '" type="checkbox" id="' + id + '"' + checkedAttribute + ' />';
|
||||||
|
html += '<label for="' + id + '">' + device.Name;
|
||||||
|
|
||||||
|
html += '<br/><span style="font-weight:normal;font-size: 90%;">' + device.AppName + '</span>';
|
||||||
|
html += '</label>';
|
||||||
|
}
|
||||||
|
|
||||||
|
html += '</fieldset>';
|
||||||
|
|
||||||
|
$('.deviceAccess', page).show().html(html).trigger('create');
|
||||||
|
|
||||||
|
$('#chkEnableAllDevices', page).checked(user.Policy.EnableAllDevices).checkboxradio('refresh').trigger('change');
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadUser(page, user, loggedInUser, mediaFolders, channels, devices) {
|
||||||
|
|
||||||
$(page).trigger('userloaded', [user]);
|
$(page).trigger('userloaded', [user]);
|
||||||
|
|
||||||
|
@ -64,6 +94,7 @@
|
||||||
|
|
||||||
loadChannels(page, user, channels);
|
loadChannels(page, user, channels);
|
||||||
loadMediaFolders(page, user, mediaFolders);
|
loadMediaFolders(page, user, mediaFolders);
|
||||||
|
loadDevices(page, user, devices);
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
}
|
}
|
||||||
|
@ -89,6 +120,16 @@
|
||||||
|
|
||||||
}).get();
|
}).get();
|
||||||
|
|
||||||
|
user.Policy.EnableAllDevices = $('#chkEnableAllDevices', page).checked();
|
||||||
|
|
||||||
|
user.Policy.EnabledDevices = user.Policy.EnableAllDevices ?
|
||||||
|
[] :
|
||||||
|
$('.chkDevice:checked', page).map(function () {
|
||||||
|
|
||||||
|
return this.getAttribute('data-deviceid');
|
||||||
|
|
||||||
|
}).get();
|
||||||
|
|
||||||
ApiClient.updateUserPolicy(user.Id, user.Policy).done(function () {
|
ApiClient.updateUserPolicy(user.Id, user.Policy).done(function () {
|
||||||
onSaveComplete(page);
|
onSaveComplete(page);
|
||||||
});
|
});
|
||||||
|
@ -113,7 +154,21 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$(document).on('pageshow', "#userLibraryAccessPage", function () {
|
$(document).on('pageinit', "#userLibraryAccessPage", function () {
|
||||||
|
|
||||||
|
var page = this;
|
||||||
|
|
||||||
|
$('#chkEnableAllDevices', page).on('change', function () {
|
||||||
|
|
||||||
|
if (this.checked) {
|
||||||
|
$('.deviceAccessListContainer', page).hide();
|
||||||
|
} else {
|
||||||
|
$('.deviceAccessListContainer', page).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}).on('pageshow', "#userLibraryAccessPage", function () {
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
|
||||||
|
@ -138,14 +193,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
var promise2 = Dashboard.getCurrentUser();
|
var promise2 = Dashboard.getCurrentUser();
|
||||||
|
|
||||||
var promise4 = ApiClient.getJSON(ApiClient.getUrl("Library/MediaFolders", { IsHidden: false }));
|
var promise4 = ApiClient.getJSON(ApiClient.getUrl("Library/MediaFolders", { IsHidden: false }));
|
||||||
|
|
||||||
var promise5 = ApiClient.getJSON(ApiClient.getUrl("Channels"));
|
var promise5 = ApiClient.getJSON(ApiClient.getUrl("Channels"));
|
||||||
|
var promise6 = ApiClient.getJSON(ApiClient.getUrl('Devices', {
|
||||||
|
SupportsUniqueIdentifier: true
|
||||||
|
}));
|
||||||
|
|
||||||
$.when(promise1, promise2, promise4, promise5).done(function (response1, response2, response4, response5) {
|
$.when(promise1, promise2, promise4, promise5, promise6).done(function (response1, response2, response4, response5, response6) {
|
||||||
|
|
||||||
loadUser(page, response1[0] || response1, response2[0], response4[0].Items, response5[0].Items);
|
loadUser(page, response1[0] || response1, response2[0], response4[0].Items, response5[0].Items, response6[0].Items);
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
<div data-role="controlgroup" data-type="horizontal" class="localnav" id="userProfileNavigation" data-mini="true">
|
<div data-role="controlgroup" data-type="horizontal" class="localnav" id="userProfileNavigation" data-mini="true">
|
||||||
<a href="#" data-role="button" class="ui-btn-active">${TabProfile}</a>
|
<a href="#" data-role="button" class="ui-btn-active">${TabProfile}</a>
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('userlibraryaccess.html', true);">${TabLibraryAccess}</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('userlibraryaccess.html', true);">${TabAccess}</a>
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('userparentalcontrol.html', true);">${TabParentalControl}</a>
|
<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>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('userpassword.html', true);">${TabPassword}</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -87,9 +87,6 @@
|
||||||
<button type="submit" data-theme="b" data-icon="check" data-mini="true">
|
<button type="submit" data-theme="b" data-icon="check" data-mini="true">
|
||||||
${ButtonSave}
|
${ButtonSave}
|
||||||
</button>
|
</button>
|
||||||
<button type="button" onclick="history.back();" data-icon="delete" data-mini="true">
|
|
||||||
${ButtonCancel}
|
|
||||||
</button>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<div class="content-primary">
|
<div class="content-primary">
|
||||||
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
|
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('useredit.html', true);">${TabProfile}</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('useredit.html', true);">${TabProfile}</a>
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('userlibraryaccess.html', true);" class="ui-btn-active">${TabLibraryAccess}</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('userlibraryaccess.html', true);" class="ui-btn-active">${TabAccess}</a>
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('userparentalcontrol.html', true);">${TabParentalControl}</a>
|
<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>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('userpassword.html', true);">${TabPassword}</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -30,6 +30,22 @@
|
||||||
<br />
|
<br />
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div class="ui-controlgroup-label">${HeaderDeviceAccess}</div>
|
||||||
|
<div>
|
||||||
|
<label for="chkEnableAllDevices">${OptionEnableAccessFromAllDevices}</label>
|
||||||
|
<input type="checkbox" id="chkEnableAllDevices" />
|
||||||
|
</div>
|
||||||
|
<div class="deviceAccessListContainer">
|
||||||
|
<br />
|
||||||
|
<div class="deviceAccess">
|
||||||
|
</div>
|
||||||
|
<div class="fieldDescription">${DeviceAccessHelp}</div>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
<ul data-role="listview" class="ulForm">
|
<ul data-role="listview" class="ulForm">
|
||||||
<li>
|
<li>
|
||||||
<button type="submit" data-theme="b" data-icon="check">
|
<button type="submit" data-theme="b" data-icon="check">
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<div class="content-primary">
|
<div class="content-primary">
|
||||||
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
|
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('useredit.html', true);">${TabProfile}</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('useredit.html', true);">${TabProfile}</a>
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('userlibraryaccess.html', true);">${TabLibraryAccess}</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('userlibraryaccess.html', true);">${TabAccess}</a>
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('userparentalcontrol.html', true);" class="ui-btn-active">${TabParentalControl}</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('userparentalcontrol.html', true);" class="ui-btn-active">${TabParentalControl}</a>
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('userpassword.html', true);">${TabPassword}</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('userpassword.html', true);">${TabPassword}</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<div class="content-primary">
|
<div class="content-primary">
|
||||||
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
|
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('useredit.html', true);">${TabProfile}</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('useredit.html', true);">${TabProfile}</a>
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('userlibraryaccess.html', true);">${TabLibraryAccess}</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('userlibraryaccess.html', true);">${TabAccess}</a>
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('userparentalcontrol.html', true);">${TabParentalControl}</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('userparentalcontrol.html', true);">${TabParentalControl}</a>
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('userpassword.html', true);" class="ui-btn-active">${TabPassword}</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('userpassword.html', true);" class="ui-btn-active">${TabPassword}</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue