mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 19:38:20 -07:00
add back api keys
This commit is contained in:
parent
c53b56c722
commit
b67ba6badb
@ -12,6 +12,7 @@
|
||||
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
|
||||
<a href="#" data-role="button" class="ui-btn-active">${TabGeneral}</a>
|
||||
<a href="dashboardhosting.html" data-role="button">${TabHosting}</a>
|
||||
<a href="serversecurity.html" data-role="button">${TabSecurity}</a>
|
||||
</div>
|
||||
<form class="advancedConfigurationForm">
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
|
||||
<a href="advanced.html" data-role="button">${TabGeneral}</a>
|
||||
<a href="#" data-role="button" class="ui-btn-active">${TabHosting}</a>
|
||||
<a href="serversecurity.html" data-role="button">${TabSecurity}</a>
|
||||
</div>
|
||||
|
||||
<form class="dashboardHostingForm">
|
||||
|
@ -1,4 +1,4 @@
|
||||
(function ($, document, LibraryBrowser) {
|
||||
(function ($, document) {
|
||||
|
||||
function renderItems(page, item) {
|
||||
|
||||
@ -337,4 +337,4 @@
|
||||
renderItems: renderItems
|
||||
};
|
||||
|
||||
})(jQuery, document, LibraryBrowser);
|
||||
})(jQuery, document);
|
@ -1,4 +1,4 @@
|
||||
(function ($, document, LibraryBrowser, window) {
|
||||
(function ($, document, window) {
|
||||
|
||||
var currentItem;
|
||||
|
||||
@ -2092,4 +2092,4 @@
|
||||
|
||||
window.ItemDetailPage = new itemDetailPage();
|
||||
|
||||
})(jQuery, document, LibraryBrowser, window);
|
||||
})(jQuery, document, window);
|
@ -1,4 +1,4 @@
|
||||
(function ($, document, Dashboard, LibraryBrowser) {
|
||||
(function ($, document, Dashboard) {
|
||||
|
||||
function notifications() {
|
||||
|
||||
@ -205,4 +205,4 @@
|
||||
|
||||
});
|
||||
|
||||
})(jQuery, document, Dashboard, LibraryBrowser);
|
||||
})(jQuery, document, Dashboard);
|
144
dashboard-ui/scripts/serversecurity.js
Normal file
144
dashboard-ui/scripts/serversecurity.js
Normal file
@ -0,0 +1,144 @@
|
||||
(function ($, document) {
|
||||
|
||||
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)
|
||||
|
||||
}).then(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() + ' ' + LibraryBrowser.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().then(function (users) {
|
||||
|
||||
ApiClient.getJSON(ApiClient.getUrl('Auth/Keys')).then(function (result) {
|
||||
|
||||
renderKeys(page, result.Items, users);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
var form = this;
|
||||
var page = $(form).parents('.page');
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.ajax({
|
||||
type: "POST",
|
||||
url: ApiClient.getUrl('Auth/Keys', {
|
||||
|
||||
App: $('#txtAppName', form).val()
|
||||
|
||||
})
|
||||
|
||||
}).then(function () {
|
||||
|
||||
$('.newKeyPanel', page).panel('close');
|
||||
|
||||
loadData(page);
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
pageIdOn('pageinit', "serverSecurityPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
$('.btnNewKey', page).on('click', function () {
|
||||
|
||||
$('.newKeyPanel', page).panel('toggle');
|
||||
|
||||
$('#txtAppName', page).val('').focus();
|
||||
|
||||
});
|
||||
|
||||
$('.newKeyForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
});
|
||||
pageIdOn('pagebeforeshow', "serverSecurityPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
loadData(page);
|
||||
});
|
||||
|
||||
})(jQuery, document);
|
@ -1,4 +1,4 @@
|
||||
(function ($, document, LibraryBrowser, window) {
|
||||
(function ($, document, window) {
|
||||
|
||||
var currentItem;
|
||||
|
||||
@ -87,4 +87,4 @@
|
||||
|
||||
});
|
||||
|
||||
})(jQuery, document, LibraryBrowser, window);
|
||||
})(jQuery, document, window);
|
58
dashboard-ui/serversecurity.html
Normal file
58
dashboard-ui/serversecurity.html
Normal file
@ -0,0 +1,58 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>${TitleAdvanced}</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="serverSecurityPage" data-role="page" class="page type-interior advancedConfigurationPage" data-require="jqmpanel,jqmtable,scripts/serversecurity,detailtablecss">
|
||||
<div data-role="content">
|
||||
<div class="content-primary">
|
||||
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
|
||||
<a href="advanced.html" data-role="button">${TabGeneral}</a>
|
||||
<a href="dashboardhosting.html" data-role="button">${TabHosting}</a>
|
||||
<a href="#" data-role="button" class="ui-btn-active">${TabSecurity}</a>
|
||||
</div>
|
||||
<div class="detailSectionHeader" style="margin-top:2.5em;">
|
||||
<h3 style="margin:.6em 0;vertical-align:middle;display:inline-block;">
|
||||
${HeaderApiKeys}
|
||||
</h3>
|
||||
<paper-button raised class="btnNewKey submit mini" style="margin-left:1em;" title="${ButtonNew}">
|
||||
<iron-icon icon="add"></iron-icon>
|
||||
<span>${ButtonAdd}</span>
|
||||
</paper-button>
|
||||
</div>
|
||||
<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 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>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user