mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-17 21:25:39 -04:00
Added API key authentication
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user