diff --git a/src/backend/importer.js b/src/backend/importer.js index b6699e32..8e47ea4e 100644 --- a/src/backend/importer.js +++ b/src/backend/importer.js @@ -354,7 +354,7 @@ module.exports = function () { .insertAndFetch({ owner_user_id: 1, domain_names: [host.hostname], - forward_ip: host.forward_server, + forward_host: host.forward_server, forward_port: host.forward_port, access_list_id: access_list_id, certificate_id: certificate_id, diff --git a/src/backend/migrations/20181019052346_forward_host.js b/src/backend/migrations/20181019052346_forward_host.js new file mode 100644 index 00000000..1ca4d0fc --- /dev/null +++ b/src/backend/migrations/20181019052346_forward_host.js @@ -0,0 +1,36 @@ +'use strict'; + +const migrate_name = 'forward_host'; +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.renameColumn('forward_ip', 'forward_host'); + }) + .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); +}; \ No newline at end of file diff --git a/src/backend/schema/endpoints/proxy-hosts.json b/src/backend/schema/endpoints/proxy-hosts.json index 11155f09..a7e3e30e 100644 --- a/src/backend/schema/endpoints/proxy-hosts.json +++ b/src/backend/schema/endpoints/proxy-hosts.json @@ -18,9 +18,10 @@ "domain_names": { "$ref": "../definitions.json#/definitions/domain_names" }, - "forward_ip": { + "forward_host": { "type": "string", - "format": "ipv4" + "minLength": 1, + "maxLength": 50 }, "forward_port": { "type": "integer", @@ -67,8 +68,8 @@ "domain_names": { "$ref": "#/definitions/domain_names" }, - "forward_ip": { - "$ref": "#/definitions/forward_ip" + "forward_host": { + "$ref": "#/definitions/forward_host" }, "forward_port": { "$ref": "#/definitions/forward_port" @@ -131,15 +132,15 @@ "additionalProperties": false, "required": [ "domain_names", - "forward_ip", + "forward_host", "forward_port" ], "properties": { "domain_names": { "$ref": "#/definitions/domain_names" }, - "forward_ip": { - "$ref": "#/definitions/forward_ip" + "forward_host": { + "$ref": "#/definitions/forward_host" }, "forward_port": { "$ref": "#/definitions/forward_port" @@ -193,8 +194,8 @@ "domain_names": { "$ref": "#/definitions/domain_names" }, - "forward_ip": { - "$ref": "#/definitions/forward_ip" + "forward_host": { + "$ref": "#/definitions/forward_host" }, "forward_port": { "$ref": "#/definitions/forward_port" diff --git a/src/backend/templates/proxy_host.conf b/src/backend/templates/proxy_host.conf index da4dfdc3..b8a301d7 100644 --- a/src/backend/templates/proxy_host.conf +++ b/src/backend/templates/proxy_host.conf @@ -1,7 +1,7 @@ {% include "_header_comment.conf" %} server { - set $server {{ forward_ip }}; + set $server "{{ forward_host }}"; set $port {{ forward_port }}; {% include "_listen.conf" %} diff --git a/src/frontend/js/app/nginx/proxy/form.ejs b/src/frontend/js/app/nginx/proxy/form.ejs index 5a85cd8f..31828846 100644 --- a/src/frontend/js/app/nginx/proxy/form.ejs +++ b/src/frontend/js/app/nginx/proxy/form.ejs @@ -22,8 +22,8 @@
- - + +
diff --git a/src/frontend/js/app/nginx/proxy/form.js b/src/frontend/js/app/nginx/proxy/form.js index 5b682169..f9f8b4f2 100644 --- a/src/frontend/js/app/nginx/proxy/form.js +++ b/src/frontend/js/app/nginx/proxy/form.js @@ -9,7 +9,6 @@ const accessListItemTemplate = require('./access-list-item.ejs'); const Helpers = require('../../../lib/helpers'); require('jquery-serializejson'); -require('jquery-mask-plugin'); require('selectize'); module.exports = Mn.View.extend({ @@ -19,7 +18,7 @@ module.exports = Mn.View.extend({ ui: { form: 'form', domain_names: 'input[name="domain_names"]', - forward_ip: 'input[name="forward_ip"]', + forward_host: 'input[name="forward_host"]', buttons: '.modal-footer button', cancel: 'button.cancel', save: 'button.save', @@ -123,12 +122,6 @@ module.exports = Mn.View.extend({ onRender: function () { let view = this; - // IP Address - this.ui.forward_ip.mask('099.099.099.099', { - clearIfNotMatch: true, - placeholder: '000.000.000.000' - }); - // Domain names this.ui.domain_names.selectize({ delimiter: ',', diff --git a/src/frontend/js/app/nginx/proxy/list/item.ejs b/src/frontend/js/app/nginx/proxy/list/item.ejs index f68f93ec..a2e9a648 100644 --- a/src/frontend/js/app/nginx/proxy/list/item.ejs +++ b/src/frontend/js/app/nginx/proxy/list/item.ejs @@ -17,7 +17,7 @@
-
<%- forward_ip %>:<%- forward_port %>
+
<%- forward_host %>:<%- forward_port %>
<%- certificate && certificate_id ? i18n('ssl', certificate.provider) : i18n('ssl', 'none') %>
diff --git a/src/frontend/js/i18n/messages.json b/src/frontend/js/i18n/messages.json index 8c69fa0c..e849c580 100644 --- a/src/frontend/js/i18n/messages.json +++ b/src/frontend/js/i18n/messages.json @@ -92,7 +92,7 @@ "empty": "There are no Proxy Hosts", "add": "Add Proxy Host", "form-title": "{id, select, undefined{New} other{Edit}} Proxy Host", - "forward-ip": "Forward IP", + "forward-host": "Forward Hostname / IP", "forward-port": "Forward Port", "delete": "Delete Proxy Host", "delete-confirm": "Are you sure you want to delete the Proxy host for: {domains}?", diff --git a/src/frontend/js/models/proxy-host.js b/src/frontend/js/models/proxy-host.js index bf75f36f..742c6e2d 100644 --- a/src/frontend/js/models/proxy-host.js +++ b/src/frontend/js/models/proxy-host.js @@ -11,7 +11,7 @@ const model = Backbone.Model.extend({ created_on: null, modified_on: null, domain_names: [], - forward_ip: '', + forward_host: '', forward_port: null, access_list_id: 0, certificate_id: 0,