From 5fb2a082125a03d07b9cbf3c8afa2b7d9f2f4dff Mon Sep 17 00:00:00 2001 From: Laszlo Ancsin Date: Fri, 15 Feb 2019 12:22:34 +0100 Subject: [PATCH 1/8] New feature: custom locations --- .../20190215115310_customlocations.js | 37 ++++++++ src/backend/models/proxy_host.js | 5 +- src/backend/schema/endpoints/proxy-hosts.json | 44 +++++++++ src/frontend/js/app/nginx/proxy/form.ejs | 12 +++ src/frontend/js/app/nginx/proxy/form.js | 90 +++++++++++++++++++ .../js/app/nginx/proxy/location-item.ejs | 63 +++++++++++++ src/frontend/js/models/proxy-host-location.js | 37 ++++++++ 7 files changed, 287 insertions(+), 1 deletion(-) create mode 100644 src/backend/migrations/20190215115310_customlocations.js create mode 100644 src/frontend/js/app/nginx/proxy/location-item.ejs create mode 100644 src/frontend/js/models/proxy-host-location.js diff --git a/src/backend/migrations/20190215115310_customlocations.js b/src/backend/migrations/20190215115310_customlocations.js new file mode 100644 index 000000000..395e2bc55 --- /dev/null +++ b/src/backend/migrations/20190215115310_customlocations.js @@ -0,0 +1,37 @@ +'use strict'; + +const migrate_name = 'custom_locations'; +const logger = require('../logger').migrate; + +/** + * Migrate + * Extends proxy_host table with locations field + * + * @see http://knexjs.org/#Schema + * + * @param {Object} knex + * @param {Promise} Promise + * @returns {Promise} + */ +exports.up = function (knex/*, Promise*/) { + logger.info('[' + migrate_name + '] Migrating Up...'); + + return knex.schema.table('proxy_host', function (proxy_host) { + proxy_host.text('locations'); + }) + .then(() => { + logger.info('[' + migrate_name + '] proxy_host Table altered'); + }) +}; + +/** + * Undo Migrate + * + * @param {Object} knex + * @param {Promise} Promise + * @returns {Promise} + */ +exports.down = function (knex, Promise) { + logger.warn('[' + migrate_name + '] You can\'t migrate down this one.'); + return Promise.resolve(true); +}; diff --git a/src/backend/models/proxy_host.js b/src/backend/models/proxy_host.js index a12172363..cc7fb3705 100644 --- a/src/backend/models/proxy_host.js +++ b/src/backend/models/proxy_host.js @@ -26,6 +26,9 @@ class ProxyHost extends Model { this.meta = {}; } + // Serialize custom locations + this.locations = JSON.stringify(this.locations); + this.domain_names.sort(); } @@ -47,7 +50,7 @@ class ProxyHost extends Model { } static get jsonAttributes () { - return ['domain_names', 'meta']; + return ['domain_names', 'meta', 'locations']; } static get relationMappings () { diff --git a/src/backend/schema/endpoints/proxy-hosts.json b/src/backend/schema/endpoints/proxy-hosts.json index 9e033da23..460bb39fe 100644 --- a/src/backend/schema/endpoints/proxy-hosts.json +++ b/src/backend/schema/endpoints/proxy-hosts.json @@ -63,6 +63,41 @@ }, "meta": { "type": "object" + }, + "locations": { + "type": "array", + "minItems": 0, + "items": { + "type": "object", + "required": [ + "forward_scheme", + "forward_host", + "forward_port", + "path" + ], + "additionalProperties": false, + "properties": { + "id": { + "type": ["integer", "null"] + }, + "path": { + "type": "string", + "minLength": 1 + }, + "forward_scheme": { + "$ref": "#/definitions/forward_scheme" + }, + "forward_host": { + "$ref": "#/definitions/forward_host" + }, + "forward_port": { + "$ref": "#/definitions/forward_port" + }, + "advanced_config": { + "type": "string" + } + } + } } }, "properties": { @@ -116,6 +151,9 @@ }, "meta": { "$ref": "#/definitions/meta" + }, + "locations": { + "$ref": "#/definitions/locations" } }, "links": [ @@ -197,6 +235,9 @@ }, "meta": { "$ref": "#/definitions/meta" + }, + "locations": { + "$ref": "#/definitions/locations" } } }, @@ -261,6 +302,9 @@ }, "meta": { "$ref": "#/definitions/meta" + }, + "locations": { + "$ref": "#/definitions/locations" } } }, diff --git a/src/frontend/js/app/nginx/proxy/form.ejs b/src/frontend/js/app/nginx/proxy/form.ejs index 1cc13b5e4..8f2d358bc 100644 --- a/src/frontend/js/app/nginx/proxy/form.ejs +++ b/src/frontend/js/app/nginx/proxy/form.ejs @@ -7,10 +7,22 @@
+ + +
+
+
+ +
+
+
+
+
diff --git a/src/frontend/js/app/nginx/proxy/form.js b/src/frontend/js/app/nginx/proxy/form.js index 19cf27910..0af08b890 100644 --- a/src/frontend/js/app/nginx/proxy/form.js +++ b/src/frontend/js/app/nginx/proxy/form.js @@ -3,18 +3,71 @@ const Mn = require('backbone.marionette'); const App = require('../../main'); const ProxyHostModel = require('../../../models/proxy-host'); +const ProxyLocationModel = require('../../../models/proxy-host-location'); const template = require('./form.ejs'); const certListItemTemplate = require('../certificates-list-item.ejs'); +const locationItemTemplate = require('./location-item.ejs'); const accessListItemTemplate = require('./access-list-item.ejs'); const Helpers = require('../../../lib/helpers'); + require('jquery-serializejson'); require('selectize'); +const LocationView = Mn.View.extend({ + template: locationItemTemplate, + className: 'location_block', + + ui: { + toggle: 'input[type="checkbox"]', + config: '.config', + delete: '.location-delete' + }, + + events: { + 'change @ui.toggle': function(el) { + if (el.target.checked) { + this.ui.config.show(); + } else { + this.ui.config.hide(); + } + }, + + 'change .model': function (e) { + console.log(e); + const map = {}; + map[e.target.name] = e.target.value; + this.model.set(map); + }, + + 'click @ui.delete': function () { + this.model.destroy(); + } + }, + + onRender: function() { + $(this.ui.config).hide(); + }, + + templateContext: function() { + return { + i18n: App.i18n, + advanced_config: '' + } + } +}); + +const LocationCollectionView = Mn.CollectionView.extend({ + className: 'locations_container', + childView: LocationView +}); + module.exports = Mn.View.extend({ template: template, className: 'modal-dialog', + locationsCollection: new ProxyLocationModel.Collection(), + ui: { form: 'form', domain_names: 'input[name="domain_names"]', @@ -22,6 +75,8 @@ module.exports = Mn.View.extend({ buttons: '.modal-footer button', cancel: 'button.cancel', save: 'button.save', + add_location_btn: 'button.add_location', + locations_container:'.locations_container', certificate_select: 'select[name="certificate_id"]', access_list_select: 'select[name="access_list_id"]', ssl_forced: 'input[name="ssl_forced"]', @@ -30,6 +85,10 @@ module.exports = Mn.View.extend({ letsencrypt: '.letsencrypt' }, + regions: { + locations_regions: '@ui.locations_container' + }, + events: { 'change @ui.certificate_select': function () { let id = this.ui.certificate_select.val(); @@ -46,6 +105,13 @@ module.exports = Mn.View.extend({ .css('opacity', enabled ? 1 : 0.5); }, + 'click @ui.add_location_btn': function (e) { + e.preventDefault(); + + const model = new ProxyLocationModel.Model(); + this.locationsCollection.add(model); + }, + 'click @ui.save': function (e) { e.preventDefault(); @@ -57,6 +123,17 @@ module.exports = Mn.View.extend({ let view = this; let data = this.ui.form.serializeJSON(); + console.log('FORM', data); + // Add locations + data.locations = []; + this.locationsCollection.models.forEach((location) => { + data.locations.push(location.toJSON()); + }); + + // Serialize collects path from custom locations + // This field must be removed from root object + delete data.path; + // Manipulate data.forward_port = parseInt(data.forward_port, 10); data.block_exploits = !!data.block_exploits; @@ -211,5 +288,18 @@ module.exports = Mn.View.extend({ if (typeof options.model === 'undefined' || !options.model) { this.model = new ProxyHostModel.Model(); } + + // Custom locations + this.showChildView('locations_regions', new LocationCollectionView({ + collection: this.locationsCollection + })); + + // Check wether there are any location defined + if (Array.isArray(options.model.attributes.locations)) { + options.model.attributes.locations.forEach((location) => { + let m = new ProxyLocationModel.Model(location); + this.locationsCollection.add(m); + }); + } } }); diff --git a/src/frontend/js/app/nginx/proxy/location-item.ejs b/src/frontend/js/app/nginx/proxy/location-item.ejs new file mode 100644 index 000000000..0e854c966 --- /dev/null +++ b/src/frontend/js/app/nginx/proxy/location-item.ejs @@ -0,0 +1,63 @@ +
+
+
+
+
+ +
+
+
+ + location + + +
+
+
+
+ +
+
+
+
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+
+
+ +
+
+
+ + + delete + +
+
\ No newline at end of file diff --git a/src/frontend/js/models/proxy-host-location.js b/src/frontend/js/models/proxy-host-location.js new file mode 100644 index 000000000..08459138e --- /dev/null +++ b/src/frontend/js/models/proxy-host-location.js @@ -0,0 +1,37 @@ +'use strict'; + +const Backbone = require('backbone'); + +const model = Backbone.Model.extend({ + idAttribute: 'id', + + defaults: function() { + return { + opened: false, + path: '', + advanced_config: '', + forward_scheme: 'http', + forward_host: '', + forward_port: '80' + } + }, + + toJSON() { + const r = Object.assign({}, this.attributes); + delete r.opened; + return r; + }, + + toggleVisibility: function () { + this.save({ + opened: !this.get('opened') + }); + } +}) + +module.exports = { + Model: model, + Collection: Backbone.Collection.extend({ + model + }) +} \ No newline at end of file From 9734b3d5c4a5966d6c46fd3afb0c8aa74e4af07b Mon Sep 17 00:00:00 2001 From: Laszlo Ancsin Date: Mon, 18 Feb 2019 22:08:02 +0100 Subject: [PATCH 2/8] Custom locations: exteding config generator --- src/backend/internal/nginx.js | 63 ++++++++++++++++++++------- src/backend/templates/proxy_host.conf | 2 + 2 files changed, 50 insertions(+), 15 deletions(-) diff --git a/src/backend/internal/nginx.js b/src/backend/internal/nginx.js index a0d84998f..6167a2d4f 100644 --- a/src/backend/internal/nginx.js +++ b/src/backend/internal/nginx.js @@ -127,6 +127,27 @@ const internalNginx = { return '/data/nginx/' + host_type + '/' + host_id + '.conf'; }, + renderLocations: (host) => { + return new Promise((resolve, reject) => { + const tpl = ` + location {{ path }} { + proxy_pass {{ forward_scheme }}://{{ forward_host }}:{{ forward_port: }}; + {{ advanced_config }} + } + `; + let renderer = new Liquid(); + let renderedLocations = ''; + + const locationRendering = async () => { + for (let i = 0; i < host.locations.length; i++) { + renderedLocations += await renderer.parseAndRender(tpl, host.locations[i]); + } + } + + locationRendering().then(() => resolve(renderedLocations)); + }); + }, + /** * @param {String} host_type * @param {Object} host @@ -153,24 +174,36 @@ const internalNginx = { return; } - renderEngine - .parseAndRender(template, host) - .then(config_text => { - fs.writeFileSync(filename, config_text, {encoding: 'utf8'}); + let locationsPromise; - if (debug_mode) { - logger.success('Wrote config:', filename, config_text); - } + if (host.locations) { + locationsPromise = internalNginx.renderLocations(host).then((renderedLocations) => { + host.locations = renderedLocations; + }); + } else { + locationsPromise = Promise.resolve(); + } - resolve(true); - }) - .catch(err => { - if (debug_mode) { - logger.warn('Could not write ' + filename + ':', err.message); - } + locationsPromise.then(() => { + renderEngine + .parseAndRender(template, host) + .then(config_text => { + fs.writeFileSync(filename, config_text, {encoding: 'utf8'}); - reject(new error.ConfigurationError(err.message)); - }); + if (debug_mode) { + logger.success('Wrote config:', filename, config_text); + } + + resolve(true); + }) + .catch(err => { + if (debug_mode) { + logger.warn('Could not write ' + filename + ':', err.message); + } + + reject(new error.ConfigurationError(err.message)); + }); + }); }); }, diff --git a/src/backend/templates/proxy_host.conf b/src/backend/templates/proxy_host.conf index 3f3b80bbf..a9cf13b7c 100644 --- a/src/backend/templates/proxy_host.conf +++ b/src/backend/templates/proxy_host.conf @@ -15,6 +15,8 @@ server { {{ advanced_config }} +{{ locations }} + location / { {%- if access_list_id > 0 -%} # Access List From 920fddd96163ea25f7b9ac9318fd01d6c9614647 Mon Sep 17 00:00:00 2001 From: Laszlo Ancsin Date: Mon, 18 Feb 2019 22:08:32 +0100 Subject: [PATCH 3/8] Custom locations: refactoring --- src/frontend/js/app/nginx/proxy/form.js | 55 ++------------------- src/frontend/js/app/nginx/proxy/location.js | 55 +++++++++++++++++++++ 2 files changed, 58 insertions(+), 52 deletions(-) create mode 100644 src/frontend/js/app/nginx/proxy/location.js diff --git a/src/frontend/js/app/nginx/proxy/form.js b/src/frontend/js/app/nginx/proxy/form.js index 0af08b890..ebfb7e892 100644 --- a/src/frontend/js/app/nginx/proxy/form.js +++ b/src/frontend/js/app/nginx/proxy/form.js @@ -6,62 +6,14 @@ const ProxyHostModel = require('../../../models/proxy-host'); const ProxyLocationModel = require('../../../models/proxy-host-location'); const template = require('./form.ejs'); const certListItemTemplate = require('../certificates-list-item.ejs'); -const locationItemTemplate = require('./location-item.ejs'); const accessListItemTemplate = require('./access-list-item.ejs'); +const CustomLocation = require('./location'); const Helpers = require('../../../lib/helpers'); require('jquery-serializejson'); require('selectize'); -const LocationView = Mn.View.extend({ - template: locationItemTemplate, - className: 'location_block', - - ui: { - toggle: 'input[type="checkbox"]', - config: '.config', - delete: '.location-delete' - }, - - events: { - 'change @ui.toggle': function(el) { - if (el.target.checked) { - this.ui.config.show(); - } else { - this.ui.config.hide(); - } - }, - - 'change .model': function (e) { - console.log(e); - const map = {}; - map[e.target.name] = e.target.value; - this.model.set(map); - }, - - 'click @ui.delete': function () { - this.model.destroy(); - } - }, - - onRender: function() { - $(this.ui.config).hide(); - }, - - templateContext: function() { - return { - i18n: App.i18n, - advanced_config: '' - } - } -}); - -const LocationCollectionView = Mn.CollectionView.extend({ - className: 'locations_container', - childView: LocationView -}); - module.exports = Mn.View.extend({ template: template, className: 'modal-dialog', @@ -123,7 +75,6 @@ module.exports = Mn.View.extend({ let view = this; let data = this.ui.form.serializeJSON(); - console.log('FORM', data); // Add locations data.locations = []; this.locationsCollection.models.forEach((location) => { @@ -290,12 +241,12 @@ module.exports = Mn.View.extend({ } // Custom locations - this.showChildView('locations_regions', new LocationCollectionView({ + this.showChildView('locations_regions', new CustomLocation.LocationCollectionView({ collection: this.locationsCollection })); // Check wether there are any location defined - if (Array.isArray(options.model.attributes.locations)) { + if (options.model && Array.isArray(options.model.attributes.locations)) { options.model.attributes.locations.forEach((location) => { let m = new ProxyLocationModel.Model(location); this.locationsCollection.add(m); diff --git a/src/frontend/js/app/nginx/proxy/location.js b/src/frontend/js/app/nginx/proxy/location.js new file mode 100644 index 000000000..52c06d08e --- /dev/null +++ b/src/frontend/js/app/nginx/proxy/location.js @@ -0,0 +1,55 @@ +const locationItemTemplate = require('./location-item.ejs'); +const Mn = require('backbone.marionette'); +const App = require('../../main'); + +const LocationView = Mn.View.extend({ + template: locationItemTemplate, + className: 'location_block', + + ui: { + toggle: 'input[type="checkbox"]', + config: '.config', + delete: '.location-delete' + }, + + events: { + 'change @ui.toggle': function(el) { + if (el.target.checked) { + this.ui.config.show(); + } else { + this.ui.config.hide(); + } + }, + + 'change .model': function (e) { + const map = {}; + map[e.target.name] = e.target.value; + this.model.set(map); + }, + + 'click @ui.delete': function () { + this.model.destroy(); + } + }, + + onRender: function() { + $(this.ui.config).hide(); + }, + + templateContext: function() { + return { + i18n: App.i18n, + advanced_config: '' + } + } +}); + +const LocationCollectionView = Mn.CollectionView.extend({ + className: 'locations_container', + childView: LocationView +}); + +module.exports = { + LocationCollectionView, + LocationView +} \ No newline at end of file From 51e56c1251b1bd53bfac321993eeedeb8932f072 Mon Sep 17 00:00:00 2001 From: Laszlo Ancsin Date: Mon, 18 Feb 2019 22:09:01 +0100 Subject: [PATCH 4/8] Fixing proxy_host table on small screens --- src/frontend/js/app/nginx/proxy/main.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/js/app/nginx/proxy/main.ejs b/src/frontend/js/app/nginx/proxy/main.ejs index a5114de61..b01e0dc46 100644 --- a/src/frontend/js/app/nginx/proxy/main.ejs +++ b/src/frontend/js/app/nginx/proxy/main.ejs @@ -12,7 +12,7 @@
-
+
From b04e9fa04d557dac9af2f39bd25b30130e59e2ff Mon Sep 17 00:00:00 2001 From: Laszlo Ancsin Date: Mon, 18 Feb 2019 22:34:22 +0100 Subject: [PATCH 5/8] Custom locations: translations --- src/frontend/js/app/nginx/proxy/location-item.ejs | 6 +++--- src/frontend/js/i18n/messages.json | 9 ++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/frontend/js/app/nginx/proxy/location-item.ejs b/src/frontend/js/app/nginx/proxy/location-item.ejs index 0e854c966..24c900890 100644 --- a/src/frontend/js/app/nginx/proxy/location-item.ejs +++ b/src/frontend/js/app/nginx/proxy/location-item.ejs @@ -3,14 +3,14 @@
- +
\ No newline at end of file diff --git a/src/frontend/js/i18n/messages.json b/src/frontend/js/i18n/messages.json index dffcec527..dd8ca4975 100644 --- a/src/frontend/js/i18n/messages.json +++ b/src/frontend/js/i18n/messages.json @@ -79,7 +79,14 @@ "no-ssl": "This host will not use HTTPS", "advanced": "Advanced", "advanced-warning": "Enter your custom Nginx configuration here at your own risk!", - "advanced-config": "Custom Nginx Configuration" + "advanced-config": "Custom Nginx Configuration", + "locations": "Custom locations" + }, + "locations": { + "new_location": "Add location", + "path": "/path", + "location_label": "Define location", + "delete": "Delete" }, "ssl": { "letsencrypt": "Let's Encrypt", From f44f635e5c5075bc2ecefb238e1afb79f0c603a4 Mon Sep 17 00:00:00 2001 From: Laszlo Ancsin Date: Tue, 19 Feb 2019 13:14:48 +0100 Subject: [PATCH 6/8] Custom locations bugfix --- src/backend/internal/nginx.js | 27 ++++++++++++++++++------ src/backend/models/proxy_host.js | 3 --- src/backend/templates/_location.conf | 8 +++++++ src/frontend/js/app/nginx/proxy/form.ejs | 2 +- src/frontend/js/app/nginx/proxy/form.js | 2 ++ 5 files changed, 31 insertions(+), 11 deletions(-) create mode 100644 src/backend/templates/_location.conf diff --git a/src/backend/internal/nginx.js b/src/backend/internal/nginx.js index 6167a2d4f..dfbb84131 100644 --- a/src/backend/internal/nginx.js +++ b/src/backend/internal/nginx.js @@ -127,20 +127,28 @@ const internalNginx = { return '/data/nginx/' + host_type + '/' + host_id + '.conf'; }, + /** + * Generates custom locations + * @param {Object} host + * @returns {Promise} + */ renderLocations: (host) => { return new Promise((resolve, reject) => { - const tpl = ` - location {{ path }} { - proxy_pass {{ forward_scheme }}://{{ forward_host }}:{{ forward_port: }}; - {{ advanced_config }} - } - `; + let template; + + try { + template = fs.readFileSync(__dirname + '/../templates/_location.conf', {encoding: 'utf8'}); + } catch (err) { + reject(new error.ConfigurationError(err.message)); + return; + } + let renderer = new Liquid(); let renderedLocations = ''; const locationRendering = async () => { for (let i = 0; i < host.locations.length; i++) { - renderedLocations += await renderer.parseAndRender(tpl, host.locations[i]); + renderedLocations += await renderer.parseAndRender(template, host.locations[i]); } } @@ -175,8 +183,10 @@ const internalNginx = { } let locationsPromise; + let origLocations; if (host.locations) { + origLocations = [].concat(host.locations); locationsPromise = internalNginx.renderLocations(host).then((renderedLocations) => { host.locations = renderedLocations; }); @@ -194,6 +204,9 @@ const internalNginx = { logger.success('Wrote config:', filename, config_text); } + // Restore locations array + host.locations = origLocations; + resolve(true); }) .catch(err => { diff --git a/src/backend/models/proxy_host.js b/src/backend/models/proxy_host.js index cc7fb3705..faa5d0685 100644 --- a/src/backend/models/proxy_host.js +++ b/src/backend/models/proxy_host.js @@ -26,9 +26,6 @@ class ProxyHost extends Model { this.meta = {}; } - // Serialize custom locations - this.locations = JSON.stringify(this.locations); - this.domain_names.sort(); } diff --git a/src/backend/templates/_location.conf b/src/backend/templates/_location.conf new file mode 100644 index 000000000..af471be1c --- /dev/null +++ b/src/backend/templates/_location.conf @@ -0,0 +1,8 @@ + location {{ path }} { + proxy_set_header Host $host; + proxy_set_header X-Forwarded-Scheme $scheme; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_pass {{ forward_scheme }}://{{ forward_host }}:{{ forward_port: }}; + {{ advanced_config }} + } \ No newline at end of file diff --git a/src/frontend/js/app/nginx/proxy/form.ejs b/src/frontend/js/app/nginx/proxy/form.ejs index 8f2d358bc..6c2330a0d 100644 --- a/src/frontend/js/app/nginx/proxy/form.ejs +++ b/src/frontend/js/app/nginx/proxy/form.ejs @@ -17,7 +17,7 @@
- +
diff --git a/src/frontend/js/app/nginx/proxy/form.js b/src/frontend/js/app/nginx/proxy/form.js index ebfb7e892..11347600b 100644 --- a/src/frontend/js/app/nginx/proxy/form.js +++ b/src/frontend/js/app/nginx/proxy/form.js @@ -240,6 +240,8 @@ module.exports = Mn.View.extend({ this.model = new ProxyHostModel.Model(); } + this.locationsCollection = new ProxyLocationModel.Collection(); + // Custom locations this.showChildView('locations_regions', new CustomLocation.LocationCollectionView({ collection: this.locationsCollection From c394ca61fc62c544d7bfd4d4f1672f083e6fbfe6 Mon Sep 17 00:00:00 2001 From: Laszlo Ancsin Date: Tue, 19 Feb 2019 13:35:45 +0100 Subject: [PATCH 7/8] Custom locations bugfix --- src/frontend/js/app/nginx/proxy/location.js | 3 +-- src/frontend/js/app/nginx/proxy/main.ejs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/frontend/js/app/nginx/proxy/location.js b/src/frontend/js/app/nginx/proxy/location.js index 52c06d08e..e9513a480 100644 --- a/src/frontend/js/app/nginx/proxy/location.js +++ b/src/frontend/js/app/nginx/proxy/location.js @@ -38,8 +38,7 @@ const LocationView = Mn.View.extend({ templateContext: function() { return { - i18n: App.i18n, - advanced_config: '' + i18n: App.i18n } } }); diff --git a/src/frontend/js/app/nginx/proxy/main.ejs b/src/frontend/js/app/nginx/proxy/main.ejs index b01e0dc46..a5114de61 100644 --- a/src/frontend/js/app/nginx/proxy/main.ejs +++ b/src/frontend/js/app/nginx/proxy/main.ejs @@ -12,7 +12,7 @@
-
+
From eb939485e0b991696cda1a07b5f5c9507f64d699 Mon Sep 17 00:00:00 2001 From: kolbii Date: Mon, 4 Mar 2019 20:21:08 +0100 Subject: [PATCH 8/8] PR #74 fixes --- src/backend/migrations/20190215115310_customlocations.js | 2 +- src/backend/templates/_location.conf | 2 +- src/frontend/js/app/nginx/proxy/location-item.ejs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backend/migrations/20190215115310_customlocations.js b/src/backend/migrations/20190215115310_customlocations.js index 395e2bc55..5b55dd5e5 100644 --- a/src/backend/migrations/20190215115310_customlocations.js +++ b/src/backend/migrations/20190215115310_customlocations.js @@ -17,7 +17,7 @@ exports.up = function (knex/*, Promise*/) { logger.info('[' + migrate_name + '] Migrating Up...'); return knex.schema.table('proxy_host', function (proxy_host) { - proxy_host.text('locations'); + proxy_host.json('locations'); }) .then(() => { logger.info('[' + migrate_name + '] proxy_host Table altered'); diff --git a/src/backend/templates/_location.conf b/src/backend/templates/_location.conf index af471be1c..d31befe8d 100644 --- a/src/backend/templates/_location.conf +++ b/src/backend/templates/_location.conf @@ -3,6 +3,6 @@ proxy_set_header X-Forwarded-Scheme $scheme; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $remote_addr; - proxy_pass {{ forward_scheme }}://{{ forward_host }}:{{ forward_port: }}; + proxy_pass {{ forward_scheme }}://{{ forward_host }}:{{ forward_port }}; {{ advanced_config }} } \ No newline at end of file diff --git a/src/frontend/js/app/nginx/proxy/location-item.ejs b/src/frontend/js/app/nginx/proxy/location-item.ejs index 24c900890..66e97c4cb 100644 --- a/src/frontend/js/app/nginx/proxy/location-item.ejs +++ b/src/frontend/js/app/nginx/proxy/location-item.ejs @@ -18,7 +18,7 @@