Merge branch 'api-key' into develop

Conflicts:
	NzbDrone.Integration.Test/NzbDroneRunner.cs
This commit is contained in:
Mark McDowall 2013-09-23 10:58:13 -07:00
commit ca3b4cb1d7
19 changed files with 179 additions and 62 deletions

View file

@ -20,9 +20,12 @@ define(function () {
delete xhr.data;
}
if (xhr) {
xhr.headers = xhr.headers || {};
xhr.headers['Authorization'] = window.NzbDrone.ApiKey;
}
return original.apply(this, arguments);
};
};
});

View file

@ -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: {
Authorization: window.NzbDrone.ApiKey
}
}).responseText;
window.NzbDrone.ServerStatus = JSON.parse(statusText);

View file

@ -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'
},

View file

@ -60,6 +60,12 @@
</div>
</footer>
</body>
<script type="text/javascript">
window.NzbDrone = 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>