#65 custom config of location / on proxy host pane
This commit is contained in:
parent
2a3d792591
commit
a0f5dd7bdc
7 changed files with 94 additions and 3 deletions
37
src/backend/migrations/20190219223711_root_config.js
Normal file
37
src/backend/migrations/20190219223711_root_config.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
'use strict';
|
||||
|
||||
const migrate_name = 'rootpath_config';
|
||||
const logger = require('../logger').migrate;
|
||||
|
||||
/**
|
||||
* Migrate
|
||||
*
|
||||
* @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('advanced_rootconfig').notNull().defaultTo('');
|
||||
proxy_host.integer('enabled_rootconfig').notNull().unsigned().defaultTo(0);
|
||||
})
|
||||
.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);
|
||||
};
|
|
@ -69,6 +69,12 @@
|
|||
},
|
||||
"meta": {
|
||||
"type": "object"
|
||||
},
|
||||
"advanced_rootconfig": {
|
||||
"type": "string"
|
||||
},
|
||||
"enabled_rootconfig": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
|
@ -128,6 +134,12 @@
|
|||
},
|
||||
"meta": {
|
||||
"$ref": "#/definitions/meta"
|
||||
},
|
||||
"advanced_rootconfig": {
|
||||
"$ref": "#/definitions/advanced_rootconfig"
|
||||
},
|
||||
"enabled_rootconfig": {
|
||||
"$ref": "#/definitions/enabled_rootconfig"
|
||||
}
|
||||
},
|
||||
"links": [
|
||||
|
@ -215,6 +227,12 @@
|
|||
},
|
||||
"meta": {
|
||||
"$ref": "#/definitions/meta"
|
||||
},
|
||||
"advanced_rootconfig": {
|
||||
"$ref": "#/definitions/advanced_rootconfig"
|
||||
},
|
||||
"enabled_rootconfig": {
|
||||
"$ref": "#/definitions/enabled_rootconfig"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -285,6 +303,12 @@
|
|||
},
|
||||
"meta": {
|
||||
"$ref": "#/definitions/meta"
|
||||
},
|
||||
"advanced_rootconfig": {
|
||||
"$ref": "#/definitions/advanced_rootconfig"
|
||||
},
|
||||
"enabled_rootconfig": {
|
||||
"$ref": "#/definitions/enabled_rootconfig"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -34,6 +34,8 @@ server {
|
|||
|
||||
# Proxy!
|
||||
include conf.d/include/proxy.conf;
|
||||
|
||||
{{advanced_rootconfig}}
|
||||
}
|
||||
}
|
||||
{% endif %}
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12">
|
||||
<div class="col-sm-6 col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="custom-switch">
|
||||
<input type="checkbox" class="custom-switch-input" name="allow_websocket_upgrade" value="1"<%- allow_websocket_upgrade ? ' checked' : '' %>>
|
||||
|
@ -68,7 +68,21 @@
|
|||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6 col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="custom-switch">
|
||||
<input type="checkbox" class="custom-switch-input" name="enabled_rootconfig" value="1"<%- enabled_rootconfig ? ' checked' : '' %>>
|
||||
<span class="custom-switch-indicator"></span>
|
||||
<span class="custom-switch-description"><%- i18n('proxy-hosts', 'advanced-config-root') %></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<div class="form-group">
|
||||
<label class="form-label"><%- i18n('proxy-hosts', 'advanced-config-root') %></label>
|
||||
<textarea name="advanced_rootconfig" rows="8" class="form-control text-monospace" placeholder="# <%- i18n('all-hosts', 'advanced-warning') %>"><%- advanced_rootconfig %></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12">
|
||||
<div class="form-group">
|
||||
<label class="form-label"><%- i18n('proxy-hosts', 'access-list') %></label>
|
||||
|
|
|
@ -27,12 +27,21 @@ module.exports = Mn.View.extend({
|
|||
ssl_forced: 'input[name="ssl_forced"]',
|
||||
hsts_enabled: 'input[name="hsts_enabled"]',
|
||||
hsts_subdomains: 'input[name="hsts_subdomains"]',
|
||||
enable_rootpath: 'input[name="enabled_rootconfig"]',
|
||||
config_rootpath: 'textarea[name="advanced_rootconfig"]',
|
||||
http2_support: 'input[name="http2_support"]',
|
||||
forward_scheme: 'select[name="forward_scheme"]',
|
||||
letsencrypt: '.letsencrypt'
|
||||
},
|
||||
|
||||
events: {
|
||||
'change @ui.enable_rootpath': function(e) {
|
||||
if (e.target.checked) {
|
||||
this.ui.config_rootpath.parent().show();
|
||||
} else {
|
||||
this.ui.config_rootpath.parent().hide();
|
||||
}
|
||||
},
|
||||
'change @ui.certificate_select': function () {
|
||||
let id = this.ui.certificate_select.val();
|
||||
if (id === 'new') {
|
||||
|
@ -102,6 +111,7 @@ module.exports = Mn.View.extend({
|
|||
data.hsts_enabled = !!data.hsts_enabled;
|
||||
data.hsts_subdomains = !!data.hsts_subdomains;
|
||||
data.ssl_forced = !!data.ssl_forced;
|
||||
data.enabled_rootconfig = !!data.enabled_rootconfig;
|
||||
|
||||
if (typeof data.domain_names === 'string' && data.domain_names) {
|
||||
data.domain_names = data.domain_names.split(',');
|
||||
|
@ -162,6 +172,7 @@ module.exports = Mn.View.extend({
|
|||
|
||||
onRender: function () {
|
||||
let view = this;
|
||||
this.ui.enable_rootpath.trigger('change');
|
||||
|
||||
this.ui.ssl_forced.trigger('change');
|
||||
this.ui.hsts_enabled.trigger('change');
|
||||
|
|
|
@ -106,7 +106,8 @@
|
|||
"help-content": "A Proxy Host is the incoming endpoint for a web service that you want to forward.\nIt provides optional SSL termination for your service that might not have SSL support built in.\nProxy Hosts are the most common use for the Nginx Proxy Manager.",
|
||||
"access-list": "Access List",
|
||||
"allow-websocket-upgrade": "Websockets Support",
|
||||
"ignore-invalid-upstream-ssl": "Ignore Invalid SSL"
|
||||
"ignore-invalid-upstream-ssl": "Ignore Invalid SSL",
|
||||
"advanced-config-root": "Custom config of /"
|
||||
},
|
||||
"redirection-hosts": {
|
||||
"title": "Redirection Hosts",
|
||||
|
|
|
@ -26,6 +26,8 @@ const model = Backbone.Model.extend({
|
|||
advanced_config: '',
|
||||
enabled: true,
|
||||
meta: {},
|
||||
enabled_rootconfig: false,
|
||||
advanced_rootconfig: null,
|
||||
// The following are expansions:
|
||||
owner: null,
|
||||
access_list: null,
|
||||
|
|
Loading…
Reference in a new issue