Merge branch 'reverse-proxy' into develop

This commit is contained in:
Mark McDowall
2014-01-06 17:17:16 -08:00
22 changed files with 168 additions and 93 deletions

View File

@@ -2,46 +2,46 @@
font-family: 'Open Sans';
font-style: normal;
font-weight: 300;
src: url('/Content/fonts/opensans-light.eot');
src: url('./fonts/opensans-light.eot');
src: local('Open Sans Light'),
local('OpenSans-Light'),
url('/Content/fonts/opensans-light.eot?#iefix') format('embedded-opentype'),
url('/Content/fonts/opensans-light.woff') format('woff'),
url('/Content/fonts/opensans-light.ttf') format('truetype');
url('./fonts/opensans-light.eot?#iefix') format('embedded-opentype'),
url('./fonts/opensans-light.woff') format('woff'),
url('./fonts/opensans-light.ttf') format('truetype');
}
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
src: url('/Content/fonts/opensans-regular.eot');
src: url('./fonts/opensans-regular.eot');
src: local('Open Sans'),
local('OpenSans'),
url('/Content/fonts/opensans-regular.eot?#iefix') format('embedded-opentype'),
url('/Content/fonts/opensans-regular.woff') format('woff'),
url('/Content/fonts/opensans-regular.ttf') format('truetype')
url('./fonts/opensans-regular.eot?#iefix') format('embedded-opentype'),
url('./fonts/opensans-regular.woff') format('woff'),
url('./fonts/opensans-regular.ttf') format('truetype')
}
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 600;
src: url('/Content/fonts/opensans-semibold.eot');
src: url('./fonts/opensans-semibold.eot');
src: local('Open Sans SemiBold'),
local('OpenSans-SemiBold'),
url('/Content/fonts/opensans-semibold.eot?#iefix') format('embedded-opentype'),
url('/Content/fonts/opensans-semibold.woff') format('woff'),
url('/Content/fonts/opensans-semibold.ttf') format('truetype')
url('./fonts/opensans-semibold.eot?#iefix') format('embedded-opentype'),
url('./fonts/opensans-semibold.woff') format('woff'),
url('./fonts/opensans-semibold.ttf') format('truetype')
}
@font-face {
font-family: 'Ubuntu Mono';
font-style: normal;
font-weight: 400;
src: url('/Content/fonts/ubuntumono-regular.eot');
src: url('./fonts/ubuntumono-regular.eot');
src: local('Open Sans'),
local('OpenSans'),
url('/Content/fonts/ubuntumono-regular.eot?#iefix') format('embedded-opentype'),
url('/Content/fonts/ubuntumono-regular.woff') format('woff'),
url('/Content/fonts/ubuntumono-regular.ttf') format('truetype')
url('./fonts/ubuntumono-regular.eot?#iefix') format('embedded-opentype'),
url('./fonts/ubuntumono-regular.woff') format('woff'),
url('./fonts/ubuntumono-regular.ttf') format('truetype')
}

View File

@@ -2,10 +2,11 @@
define(
[
'handlebars'
], function (Handlebars) {
'handlebars',
'System/StatusModel'
], function (Handlebars, StatusModel) {
var placeHolder = '/Content/Images/poster-dark.jpg';
var placeHolder = StatusModel.get('urlBase') + '/Content/Images/poster-dark.jpg';
window.NzbDrone.imageError = function (img) {
if (!img.src.contains(placeHolder)) {
@@ -17,4 +18,8 @@ define(
Handlebars.registerHelper('defaultImg', function () {
return new Handlebars.SafeString('onerror=window.NzbDrone.imageError(this)');
});
Handlebars.registerHelper('UrlBase', function () {
return new Handlebars.SafeString(StatusModel.get('urlBase'));
});
});

View File

@@ -2,8 +2,9 @@
define(
[
'handlebars',
'System/StatusModel',
'underscore'
], function (Handlebars, _) {
], function (Handlebars, StatusModel, _) {
Handlebars.registerHelper('poster', function () {
var poster = _.where(this.images, {coverType: 'poster'});
@@ -32,7 +33,7 @@ define(
});
Handlebars.registerHelper('route', function () {
return '/series/' + this.titleSlug;
return StatusModel.get('urlBase') + '/series/' + this.titleSlug;
});
Handlebars.registerHelper('percentOfEpisodes', function () {

View File

@@ -3,47 +3,47 @@
<div class="span12">
<ul id="main-menu-region">
<div class="pull-left logo">
<a href="/">
<img src="/Content/Images/logo.png" alt="NzbDrone">
<a href="{{UrlBase}}/">
<img src="{{UrlBase}}/Content/Images/logo.png" alt="NzbDrone">
</a>
</div>
<li>
<a href="/">
<a href="{{UrlBase}}/">
<i class="icon-play"></i>
<br>
Series
</a>
</li>
<li>
<a href="/calendar">
<a href="{{UrlBase}}/calendar">
<i class="icon-calendar"></i>
<br>
Calendar
</a>
</li>
<li>
<a href="/history">
<a href="{{UrlBase}}/history">
<i class="icon-time"></i>
<br>
History
</a>
</li>
<li>
<a href="/missing">
<a href="{{UrlBase}}/missing">
<i class="icon-warning-sign"></i>
<br>
Missing
</a>
</li>
<li>
<a href="/settings">
<a href="{{UrlBase}}/settings">
<i class="icon-cogs"></i>
<br>
Settings
</a>
</li>
<li>
<a href="/system">
<a href="{{UrlBase}}/system">
<i class="icon-laptop"></i>
<br>
System

View File

@@ -29,7 +29,7 @@ define(
//look down for <a/>
var href = event.target.getAttribute('href');
//if couldn't find it look up
//if couldn't find it look up'
if (!href && target.parent('a') && target.parent('a')[0]) {
var linkElement = target.parent('a')[0];

View File

@@ -17,7 +17,6 @@ define(
this.route('series/:query', this.seriesDetails);
},
series: function () {
this.setTitle('NzbDrone');
AppLayout.mainRegion.show(new SeriesIndexLayout());

View File

@@ -6,8 +6,9 @@ define(
'Settings/Indexers/ItemView',
'Settings/Indexers/EditView',
'Settings/Indexers/Collection',
'System/StatusModel',
'underscore'
], function (AppLayout, Marionette, IndexerItemView, IndexerEditView, IndexerCollection, _) {
], function (AppLayout, Marionette, IndexerItemView, IndexerEditView, IndexerCollection, StatusModel, _) {
return Marionette.CompositeView.extend({
itemView : IndexerItemView,
itemViewContainer: '#x-indexers',
@@ -29,10 +30,10 @@ define(
var self = this;
//TODO: Is there a better way to deal with changing URLs?
var schemaCollection = new IndexerCollection();
schemaCollection.url = '/api/indexer/schema';
schemaCollection.url = StatusModel.get('urlBase') + '/api/indexer/schema';
schemaCollection.fetch({
success: function (collection) {
collection.url = '/api/indexer';
collection.url = './api/indexer';
var model = _.first(collection.models);
model.set({

View File

@@ -2,15 +2,16 @@
define([
'AppLayout',
'Settings/Notifications/Collection',
'Settings/Notifications/AddView'
], function (AppLayout, NotificationCollection, AddSelectionNotificationView) {
'Settings/Notifications/AddView',
'System/StatusModel'
], function (AppLayout, NotificationCollection, AddSelectionNotificationView, StatusModel) {
return ({
open: function (collection) {
var schemaCollection = new NotificationCollection();
schemaCollection.url = '/api/notification/schema';
schemaCollection.url = StatusModel.get('urlBase') + '/api/notification/schema';
schemaCollection.fetch();
schemaCollection.url = '/api/notification';
schemaCollection.url = StatusModel.get('urlBase') + '/api/notification';
var view = new AddSelectionNotificationView({ collection: schemaCollection, notificationCollection: collection});
AppLayout.modalRegion.show(view);

View File

@@ -1,3 +1,4 @@
<div>
<img src="/Content/Images/404.png" style="height:400px; margin-top: 50px"/>
<img src="{{UrlBase}}/Content/Images/404.png" style="height:400px; margin-top: 50px"/>
</div>

View File

@@ -30,7 +30,7 @@ define(
var tryingToReconnect = false;
var messengerId = 'signalR';
this.signalRconnection = $.connection('/signalr');
this.signalRconnection = $.connection(StatusModel.get('urlBase') + '/signalr');
this.signalRconnection.stateChanged(function (change) {
console.debug('SignalR: [{0}]'.format(getStatus(change.newState)));

View File

@@ -1,11 +1,12 @@
'use strict';
define(
[
'backbone'
], function (Backbone) {
'backbone',
'System/StatusModel'
], function (Backbone, StatusModel) {
return Backbone.Model.extend({
url: function () {
return '/log/' + this.get('filename');
return StatusModel.get('urlBase') + '/log/' + this.get('filename');
},
parse: function (contents) {

View File

@@ -1,15 +1,16 @@
'use strict';
define(
[
'Cells/NzbDroneCell'
], function (NzbDroneCell) {
'Cells/NzbDroneCell',
'System/StatusModel'
], function (NzbDroneCell, StatusModel) {
return NzbDroneCell.extend({
className: 'download-log-cell',
render: function () {
this.$el.empty();
this.$el.html('<a href="/log/{0}" class="no-router" target="_blank">Download</a>'.format(this.cellValue));
this.$el.html('<a href="{0}/log/{1}" class="no-router" target="_blank">Download</a>'.format(StatusModel.get('urlBase'), this.cellValue));
return this;
}

View File

@@ -232,7 +232,7 @@ define(
});
app.addInitializer(function () {
Backbone.history.start({ pushState: true });
Backbone.history.start({ pushState: true, root: serverStatusModel.get('urlBase') });
RouteBinder.bind();
AppLayout.navbarRegion.show(new NavbarView());
$('body').addClass('started');

View File

@@ -65,7 +65,7 @@
<div id="errors"></div>
<script type="text/javascript">
window.NzbDrone = {
ApiRoot: '/api',
ApiRoot: 'API_ROOT',
ApiKey : 'API_KEY',
Version: 'APP_VERSION'
};

View File

@@ -2,8 +2,9 @@
define(
[
'backbone',
'jquery'
], function (Backbone,$) {
'jquery',
'System/StatusModel'
], function (Backbone, $, StatusModel) {
//This module will automatically route all relative links through backbone router rather than
//causing links to reload pages.
@@ -45,7 +46,9 @@ define(
if (!href.startsWith('http')) {
Backbone.history.navigate(href, { trigger: true });
var relativeHref = href.replace(StatusModel.get('urlBase'), '');
Backbone.history.navigate(relativeHref, { trigger: true });
}
else {