1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Add api key functions

This commit is contained in:
Luke Pulverenti 2014-07-11 22:31:08 -04:00
parent 5f578574d7
commit 42de7388d0
18 changed files with 288 additions and 108 deletions

View file

@ -21,7 +21,7 @@
<button style="display: none;" class="btnClearLog" type="button" data-inline="true" data-icon="forbidden" data-mini="true">Clear</button> <button style="display: none;" class="btnClearLog" type="button" data-inline="true" data-icon="forbidden" data-mini="true">Clear</button>
<div style="clear: both;"></div> <div style="clear: both;"></div>
</div> </div>
<table data-role="table" data-mode="reflow" class="tblOrganizationResults stripedTable ui-responsive table-stroke" style="display: table;"> <table data-role="table" data-mode="reflow" class="tblOrganizationResults stripedTable ui-responsive table-stroke">
<thead> <thead>
<tr> <tr>
<th data-priority="1"></th> <th data-priority="1"></th>

View file

@ -12,7 +12,7 @@
</div> </div>
<div data-role="content"> <div data-role="content">
<table class="ehsContent homeEhsContent"> <table class="ehsContent">
<tr> <tr>
<td> <td>
<div class="items"></div> <div class="items"></div>

View file

@ -13,7 +13,7 @@
} }
.backdropPage { .backdropPage {
background-color: rgba(15, 15,15, .92)!important; background-color: rgba(15, 15,15, .94)!important;
} }
.backdropContainer { .backdropContainer {
@ -73,25 +73,32 @@
top: 8px; top: 8px;
} }
@media all and (max-width: 800px) {
.hiddenSectionOnMobile {
display: none;
}
}
.firstListHeader + .sectionHeaderButton { .firstListHeader + .sectionHeaderButton {
top: 3px; top: 3px;
} }
@media all and (min-width: 900px) { @media all and (min-width: 800px) {
.ehsContent { .ehsContent {
width: 880px; width: 770px;
} }
.squareEhsContent { .squareEhsContent {
width: 750px; width: 760px;
} }
} }
@media all and (min-width: 1000px) { @media all and (min-width: 1000px) {
.ehsContent { .ehsContent {
width: 905px; width: 900px;
} }
.squareEhsContent { .squareEhsContent {
@ -102,33 +109,11 @@
@media all and (min-width: 1200px) { @media all and (min-width: 1200px) {
.ehsContent { .ehsContent {
width: 925px; width: 1000px;
} }
.squareEhsContent { .squareEhsContent {
width: 900px; width: 1000px;
}
}
@media all and (min-width: 1400px) {
.ehsContent {
width: 1080px;
}
.squareEhsContent {
width: 1220px;
}
}
@media all and (min-width: 1600px) {
.homeEhsContent {
width: 1440px;
}
.squareEhsContent {
width: 1420px;
} }
} }

View file

@ -332,11 +332,11 @@
@media all and (min-width: 540px) { @media all and (min-width: 540px) {
.backdropPosterItem { .backdropPosterItem {
width: 266px; width: 246px;
} }
.backdropPosterItem .posterItemImage { .backdropPosterItem .posterItemImage {
height: 149.625px; height: 138.375px;
} }
.smallBackdropPosterItem { .smallBackdropPosterItem {
@ -362,14 +362,6 @@
@media all and (min-width: 650px) { @media all and (min-width: 650px) {
.backdropPosterItem {
width: 282px;
}
.backdropPosterItem .posterItemImage {
height: 158.625px;
}
.smallBackdropPosterItem { .smallBackdropPosterItem {
width: 190px; width: 190px;
} }
@ -415,12 +407,28 @@
min-width: 220px; min-width: 220px;
} }
.backdropPosterItem {
width: 290px;
}
.backdropPosterItem .posterItemImage {
height: 163.125px;
}
.smallBackdropPosterItem { .smallBackdropPosterItem {
width: 208px; width: 290px;
} }
.smallBackdropPosterItem .posterItemImage { .smallBackdropPosterItem .posterItemImage {
height: 117px; height: 163.125px;
}
.miniBackdropPosterItem {
width: 190px;
}
.miniBackdropPosterItem .posterItemImage {
height: 106.875px;
} }
} }
@ -445,6 +453,30 @@
.bannerPosterItem .posterItemImage { .bannerPosterItem .posterItemImage {
height: 92.5px; height: 92.5px;
} }
.backdropPosterItem {
width: 320px;
}
.backdropPosterItem .posterItemImage {
height: 180px;
}
.portraitPosterItem {
width: 156px;
}
.portraitPosterItem .posterItemImage {
height: 234px;
}
.squarePosterItem {
width: 190px;
}
.squarePosterItem .posterItemImage {
height: 190px;
}
} }
@media all and (min-width: 1440px) { @media all and (min-width: 1440px) {
@ -454,41 +486,6 @@
/* Specify a min width just in case the container doesn't have a width */ /* Specify a min width just in case the container doesn't have a width */
min-width: 220px; min-width: 220px;
} }
.backdropPosterItem {
width: 350px;
}
.backdropPosterItem .posterItemImage {
height: 196.875px;
}
.miniBackdropPosterItem {
width: 180px;
}
.miniBackdropPosterItem .posterItemImage {
height: 101.25px;
}
.squarePosterItem {
width: 192px;
}
.squarePosterItem .posterItemImage {
height: 192px;
}
.portraitPosterItem {
width: 170px;
}
.portraitPosterItem .posterItemImage {
height: 255px;
}
.posterItemText {
}
} }

View file

@ -24,7 +24,7 @@
</p> </p>
</div> </div>
<table class="ehsContent homeEhsContent"> <table class="ehsContent">
<tr> <tr>
<td> <td>
<div class="sections"></div> <div class="sections"></div>

View file

@ -14,7 +14,7 @@
<a href="livetvseriestimers.html">${TabSeries}</a> <a href="livetvseriestimers.html">${TabSeries}</a>
</div> </div>
<div data-role="content"> <div data-role="content">
<table class="ehsContent squareEhsContent"> <table class="ehsContent">
<tr> <tr>
<td> <td>
<div id="activePrograms"> <div id="activePrograms">

View file

@ -99,16 +99,12 @@
return false; return false;
} }
// For bandwidth
if ($.browser.mobile) {
return false;
}
var userId = Dashboard.getCurrentUserId(); var userId = Dashboard.getCurrentUserId();
var val = LocalSettings.val('enableBackdrops', userId); var val = LocalSettings.val('enableBackdrops', userId);
return val != '0'; // For bandwidth
return val == '1' || (val != '0' && !$.browser.mobile);
} }
$(document).on('pagebeforeshow', ".page", function () { $(document).on('pagebeforeshow', ".page", function () {

View file

@ -22,7 +22,7 @@
SortOrder: "Ascending", SortOrder: "Ascending",
IncludeItemTypes: section.types, IncludeItemTypes: section.types,
Filters: "IsFavorite", Filters: "IsFavorite",
Limit: screenWidth >= 1920 ? 10 : (screenWidth >= 1440 ? 8 : 6), Limit: screenWidth >= 1920 ? 9 : (screenWidth >= 1440 ? 8 : 6),
Recursive: true, Recursive: true,
Fields: "PrimaryImageAspectRatio", Fields: "PrimaryImageAspectRatio",
CollapseBoxSetItems: false, CollapseBoxSetItems: false,

View file

@ -192,7 +192,13 @@
}); });
} }
function loadLibraryTiles(elem, userId, shape, index) { function loadLibraryTiles(elem, userId, shape, index, autoHideOnMobile) {
if (autoHideOnMobile) {
$(elem).addClass('hiddenSectionOnMobile');
} else {
$(elem).removeClass('hiddenSectionOnMobile');
}
getUserViews(userId).done(function (items) { getUserViews(userId).done(function (items) {
@ -273,7 +279,7 @@
SortOrder: "Descending", SortOrder: "Descending",
MediaTypes: "Video", MediaTypes: "Video",
Filters: "IsResumable", Filters: "IsResumable",
Limit: screenWidth >= 1920 ? 10 : (screenWidth >= 1440 ? 8 : 6), Limit: (screenWidth >= 1200 ? 9 : 6),
Recursive: true, Recursive: true,
Fields: "PrimaryImageAspectRatio", Fields: "PrimaryImageAspectRatio",
CollapseBoxSetItems: false, CollapseBoxSetItems: false,
@ -350,7 +356,7 @@
var options = { var options = {
Limit: screenWidth >= 1920 ? 7 : (screenWidth >= 1440 ? 5 : (screenWidth >= 800 ? 6 : 6)), Limit: screenWidth >= 1920 ? 5 : (screenWidth >= 1440 ? 5 : (screenWidth >= 800 ? 6 : 6)),
Fields: "PrimaryImageAspectRatio", Fields: "PrimaryImageAspectRatio",
Filters: "IsUnplayed", Filters: "IsUnplayed",
UserId: Dashboard.getCurrentUserId(), UserId: Dashboard.getCurrentUserId(),
@ -373,7 +379,7 @@
} }
html += LibraryBrowser.getPosterViewHtml({ html += LibraryBrowser.getPosterViewHtml({
items: result.Items, items: result.Items,
shape: 'autosmall', shape: 'auto',
defaultShape: 'square', defaultShape: 'square',
showTitle: true, showTitle: true,
centerText: true, centerText: true,
@ -390,7 +396,7 @@
ApiClient.getLiveTvRecordings({ ApiClient.getLiveTvRecordings({
userId: userId, userId: userId,
limit: 9, limit: 5,
IsInProgress: false IsInProgress: false
}).done(function (result) { }).done(function (result) {
@ -444,11 +450,11 @@
switch (index) { switch (index) {
case 0: case 0:
return 'smalllibrarytiles'; return 'smalllibrarytiles-automobile';
case 1: case 1:
return 'resume'; return 'resume';
case 2: case 2:
return ''; return 'latestmedia';
case 3: case 3:
return ''; return '';
default: default:
@ -470,7 +476,10 @@
Sections.loadLibraryTiles(elem, userId, 'backdrop', index); Sections.loadLibraryTiles(elem, userId, 'backdrop', index);
} }
else if (section == 'smalllibrarytiles') { else if (section == 'smalllibrarytiles') {
Sections.loadLibraryTiles(elem, userId, 'smallBackdrop', index); Sections.loadLibraryTiles(elem, userId, 'miniBackdrop', index);
}
else if (section == 'smalllibrarytiles-automobile') {
Sections.loadLibraryTiles(elem, userId, 'miniBackdrop', index, true);
} }
else if (section == 'librarybuttons') { else if (section == 'librarybuttons') {
Sections.loadlibraryButtons(elem, userId, index); Sections.loadlibraryButtons(elem, userId, index);
@ -484,7 +493,7 @@
} }
else if (section == 'folders') { else if (section == 'folders') {
Sections.loadLibraryFolders(elem, userId, 'smallBackdrop', index); Sections.loadLibraryFolders(elem, userId, 'backdrop', index);
} else if (section == 'latestchannelmedia') { } else if (section == 'latestchannelmedia') {
Sections.loadLatestChannelMedia(elem, userId); Sections.loadLatestChannelMedia(elem, userId);

View file

@ -311,7 +311,7 @@
$('#scenesCollapsible', page).hide(); $('#scenesCollapsible', page).hide();
} else { } else {
$('#scenesCollapsible', page).show(); $('#scenesCollapsible', page).show();
renderScenes(page, item, user, 4); renderScenes(page, item, user, 3);
} }
if (!item.SpecialFeatureCount || item.SpecialFeatureCount == 0 || item.Type == "Series") { if (!item.SpecialFeatureCount || item.SpecialFeatureCount == 0 || item.Type == "Series") {

View file

@ -305,6 +305,12 @@
function onGroupedPosterItemClick(e) { function onGroupedPosterItemClick(e) {
if ($(e.target).is('.posterItemOverlayTarget') ||
$(e.target).parents('.posterItemOverlayTarget').length) {
e.preventDefault();
return;
}
var posterItem = this; var posterItem = this;
var itemId = posterItem.getAttribute('data-itemid'); var itemId = posterItem.getAttribute('data-itemid');

View file

@ -9,7 +9,7 @@
userId: Dashboard.getCurrentUserId(), userId: Dashboard.getCurrentUserId(),
IsAiring: true, IsAiring: true,
limit: 12 limit: 10
}).done(function (result) { }).done(function (result) {
@ -32,7 +32,7 @@
userId: Dashboard.getCurrentUserId(), userId: Dashboard.getCurrentUserId(),
IsAiring: false, IsAiring: false,
HasAired: false, HasAired: false,
limit: 12 limit: 10
}).done(function (result) { }).done(function (result) {

View file

@ -50,7 +50,7 @@
SortOrder: "Descending", SortOrder: "Descending",
IncludeItemTypes: "Movie", IncludeItemTypes: "Movie",
Filters: "IsResumable", Filters: "IsResumable",
Limit: screenWidth >= 1920 ? 6 : (screenWidth >= 1440 ? 6 : 3), Limit: (screenWidth >= 1200 ? 6 : 3),
Recursive: true, Recursive: true,
Fields: "PrimaryImageAspectRatio", Fields: "PrimaryImageAspectRatio",
CollapseBoxSetItems: false, CollapseBoxSetItems: false,
@ -81,7 +81,7 @@
userId: Dashboard.getCurrentUserId(), userId: Dashboard.getCurrentUserId(),
categoryLimit: screenWidth >= 1200 ? 4 : 3, categoryLimit: screenWidth >= 1200 ? 4 : 3,
itemLimit: screenWidth >= 1920 ? 6 : (screenWidth >= 1440 ? 6 : 7), ItemLimit: (screenWidth >= 1200 ? 6 : 5),
Fields: "PrimaryImageAspectRatio" Fields: "PrimaryImageAspectRatio"
}); });

View file

@ -11,7 +11,7 @@
var options = { var options = {
IncludeItemTypes: "Audio", IncludeItemTypes: "Audio",
Limit: screenWidth >= 1920 ? 14 : (screenWidth >= 1440 ? 14 : 12), Limit: screenWidth >= 1920 ? 15 : (screenWidth >= 1200 ? 10 : 12),
Fields: "PrimaryImageAspectRatio", Fields: "PrimaryImageAspectRatio",
ParentId: parentId ParentId: parentId
}; };
@ -34,7 +34,7 @@
SortBy: "DatePlayed", SortBy: "DatePlayed",
SortOrder: "Descending", SortOrder: "Descending",
IncludeItemTypes: "Audio", IncludeItemTypes: "Audio",
Limit: screenWidth >= 1920 ? 7 : (screenWidth >= 1440 ? 7 : 6), Limit: screenWidth >= 1920 ? 5 : (screenWidth >= 1200 ? 5 : 6),
Recursive: true, Recursive: true,
Fields: "PrimaryImageAspectRatio,AudioInfo", Fields: "PrimaryImageAspectRatio,AudioInfo",
Filters: "IsPlayed", Filters: "IsPlayed",
@ -64,7 +64,7 @@
SortBy: "PlayCount", SortBy: "PlayCount",
SortOrder: "Descending", SortOrder: "Descending",
IncludeItemTypes: "Audio", IncludeItemTypes: "Audio",
Limit: screenWidth >= 1920 ? 14 : (screenWidth >= 1440 ? 14 : 12), Limit: screenWidth >= 1920 ? 10 : (screenWidth >= 1200 ? 10 : 12),
Recursive: true, Recursive: true,
Fields: "PrimaryImageAspectRatio,AudioInfo", Fields: "PrimaryImageAspectRatio,AudioInfo",
Filters: "IsPlayed", Filters: "IsPlayed",

View file

@ -1 +1,145 @@
 (function ($, document, apiClient) {
function revoke(page, key) {
Dashboard.confirm(Globalize.translate('MessageConfirmRevokeApiKey'), Globalize.translate('HeaderConfirmRevokeApiKey'), function (result) {
if (result) {
Dashboard.showLoadingMsg();
ApiClient.ajax({
type: "DELETE",
url: apiClient.getUrl('Auth/Keys/' + key)
}).done(function () {
loadData(page);
});
}
});
}
function renderKeys(page, keys, users) {
var rows = keys.map(function (item) {
var html = '';
html += '<tr>';
html += '<td>';
html += '<button data-token="' + item.AccessToken + '" class="btnRevoke" data-mini="true" title="' + Globalize.translate('ButtonRevoke') + '" style="margin:0;">' + Globalize.translate('ButtonRevoke') + '</button>';
html += '</td>';
html += '<td style="vertical-align:middle;">';
html += (item.AccessToken);
html += '</td>';
html += '<td style="vertical-align:middle;">';
html += (item.AppName || '');
html += '</td>';
html += '<td style="vertical-align:middle;">';
html += (item.DeviceName || '');
html += '</td>';
html += '<td style="vertical-align:middle;">';
var user = users.filter(function (u) {
return u.Id == item.UserId;
})[0];
if (user) {
html += user.Name;
}
html += '</td>';
html += '<td style="vertical-align:middle;">';
var date = parseISO8601Date(item.DateCreated, { toLocal: true });
html += date.toLocaleDateString() + ' ' + LiveTvHelpers.getDisplayTime(date);
html += '</td>';
html += '</tr>';
return html;
}).join('');
var elem = $('.resultBody', page).html(rows).parents('.tblApiKeys').table("refresh").trigger('create');
$('.btnRevoke', elem).on('click', function () {
revoke(page, this.getAttribute('data-token'));
});
Dashboard.hideLoadingMsg();
}
function loadData(page) {
Dashboard.showLoadingMsg();
ApiClient.getUsers().done(function (users) {
ApiClient.getJSON(ApiClient.getUrl('Auth/Keys')).done(function (result) {
renderKeys(page, result.Items, users);
});
});
}
$(document).on('pageinit', "#serverSecurityPage", function () {
var page = this;
$('.btnNewKey', page).on('click', function () {
$('.newKeyPanel', page).panel('toggle');
$('#txtAppName', page).val('').focus();
});
}).on('pageshow', "#serverSecurityPage", function () {
var page = this;
loadData(page);
});
window.ServerSecurityPage = {
onSubmit: function(e) {
var form = this;
var page = $(form).parents('.page');
Dashboard.showLoadingMsg();
ApiClient.ajax({
type: "POST",
url: apiClient.getUrl('Auth/Keys/', {
App: $('#txtAppName', form).val()
})
}).done(function () {
$('.newKeyPanel', page).panel('close');
loadData(page);
});
return false;
}
};
})(jQuery, document, ApiClient);

View file

@ -46,7 +46,8 @@
var val = LocalSettings.val('enableThemeSongs', userId); var val = LocalSettings.val('enableThemeSongs', userId);
return val == '1'; // For bandwidth
return val == '1' || (val != '0' && !$.browser.mobile);
} }
function getPlayer() { function getPlayer() {

View file

@ -95,7 +95,7 @@
SortOrder: "Descending", SortOrder: "Descending",
IncludeItemTypes: "Episode", IncludeItemTypes: "Episode",
Filters: "IsResumable", Filters: "IsResumable",
Limit: screenWidth >= 1920 ? 6 : 4, Limit: screenWidth >= 1200 ? 6 : 4,
Recursive: true, Recursive: true,
Fields: "PrimaryImageAspectRatio,SeriesInfo,UserData", Fields: "PrimaryImageAspectRatio,SeriesInfo,UserData",
ExcludeLocationTypes: "Virtual", ExcludeLocationTypes: "Virtual",

View file

@ -16,9 +16,51 @@
<a href="#" data-role="button" class="ui-btn-active">${TabSecurity}</a> <a href="#" data-role="button" class="ui-btn-active">${TabSecurity}</a>
</div> </div>
<h2 style="margin-top: -10px;">
<span>${HeaderApiKeys}</span>
<button class="btnNewKey" style="float: right; margin: -4px 0 0; vertical-align: top;" data-icon="plus" data-mini="true" data-inline="true" type="button">${ButtonNew}</button>
</h2>
<p>${HeaderApiKeysHelp}</p>
<br />
<table data-role="table" data-mode="reflow" class="tblApiKeys stripedTable ui-responsive table-stroke" style="display: table;">
<thead>
<tr>
<th></th>
<th>${HeaderApiKey}</th>
<th>${HeaderApp}</th>
<th>${HeaderDevice}</th>
<th>${HeaderUser}</th>
<th>${HeaderDateIssued}</th>
</tr>
</thead>
<tbody class="resultBody">
</tbody>
</table>
</div> </div>
</div> </div>
<div data-role="panel" class="newKeyPanel" data-position="right" data-display="overlay" data-position-fixed="true">
<form class="newKeyForm">
<h3>${HeaderNewApiKey}</h3>
<p>${HeaderNewApiKeyHelp}</p>
<div>
<label for="txtAppName">${LabelAppName}</label>
<input type="text" id="txtAppName" required="required" />
<div class="fieldDescription">${LabelAppNameExample}</div>
</div>
<br />
<p>
<button type="submit" data-icon="plus" data-mini="true" data-theme="b">${ButtonCreate}</button>
</p>
</form>
</div>
<script type="text/javascript">
$('.newKeyForm').off('submit', ServerSecurityPage.onSubmit).on('submit', ServerSecurityPage.onSubmit);
</script>
</div> </div>
</body> </body>
</html> </html>