mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
Added API key authentication
This commit is contained in:
parent
689f27bee6
commit
57fdbe6e08
11 changed files with 114 additions and 15 deletions
|
@ -20,9 +20,15 @@ define(function () {
|
|||
|
||||
delete xhr.data;
|
||||
}
|
||||
if (xhr) {
|
||||
if (!xhr.headers) {
|
||||
xhr.headers = {};
|
||||
}
|
||||
|
||||
xhr.headers["ApiKey"] = window.NzbDrone.ApiKey;
|
||||
}
|
||||
|
||||
return original.apply(this, arguments);
|
||||
};
|
||||
};
|
||||
|
||||
});
|
|
@ -1,10 +1,12 @@
|
|||
window.NzbDrone = {};
|
||||
window.NzbDrone.ApiRoot = '/api';
|
||||
|
||||
var statusText = $.ajax({
|
||||
type : 'GET',
|
||||
url : window.NzbDrone.ApiRoot + '/system/status',
|
||||
async: false
|
||||
async: false,
|
||||
headers: {
|
||||
ApiKey: window.NzbDrone.ApiKey
|
||||
}
|
||||
}).responseText;
|
||||
|
||||
window.NzbDrone.ServerStatus = JSON.parse(statusText);
|
||||
|
|
15
UI/app.js
15
UI/app.js
|
@ -33,12 +33,19 @@ require.config({
|
|||
$: {
|
||||
exports: '$',
|
||||
|
||||
init: function () {
|
||||
deps :
|
||||
[
|
||||
'Mixins/jquery.ajax'
|
||||
],
|
||||
|
||||
init: function (AjaxMixin) {
|
||||
require(
|
||||
[
|
||||
'jQuery/ToTheTop',
|
||||
'Instrumentation/ErrorHandler'
|
||||
]);
|
||||
|
||||
AjaxMixin.apply($);
|
||||
}
|
||||
|
||||
},
|
||||
|
@ -75,14 +82,10 @@ require.config({
|
|||
backbone: {
|
||||
deps :
|
||||
[
|
||||
'Mixins/backbone.ajax',
|
||||
'underscore',
|
||||
'$'
|
||||
],
|
||||
exports: 'Backbone',
|
||||
init : function (AjaxMixin) {
|
||||
AjaxMixin.apply(Backbone);
|
||||
}
|
||||
exports: 'Backbone'
|
||||
},
|
||||
|
||||
|
||||
|
|
|
@ -60,6 +60,12 @@
|
|||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
<script type="text/javascript">
|
||||
window.NzbDrone = {};
|
||||
window.NzbDrone.ApiKey = 'API_KEY';
|
||||
</script>
|
||||
|
||||
<script src="/polyfills.js"></script>
|
||||
<script src="/JsLibraries/jquery.js"></script>
|
||||
<script src="/JsLibraries/messenger.js"></script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue