mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-06-18 18:16:26 +00:00
Initial commit
This commit is contained in:
23
manager/src/frontend/js/app/host/advanced.ejs
Normal file
23
manager/src/frontend/js/app/host/advanced.ejs
Normal file
@ -0,0 +1,23 @@
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<form class="form">
|
||||
<div class="modal-header text-left">
|
||||
<h4 class="modal-title">Advanced Configuration for <%- hostname %></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>This section is for advanced users only! If you don't know Nginx configuration backwards, you should abort now.
|
||||
You might typically use this for configuring additional location sections, ip restrictions or websocket proxying.</p>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="advanced-input">Additional Nginx Configuration (inside server block)</label>
|
||||
<textarea class="form-control" rows="10" name="advanced" id="advanced-input"><%- advanced %></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" class="btn btn-danger save">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
39
manager/src/frontend/js/app/host/advanced.js
Normal file
39
manager/src/frontend/js/app/host/advanced.js
Normal file
@ -0,0 +1,39 @@
|
||||
'use strict';
|
||||
|
||||
import Mn from 'backbone.marionette';
|
||||
|
||||
const template = require('./advanced.ejs');
|
||||
const Controller = require('../controller');
|
||||
const Api = require('../api');
|
||||
const App = require('../main');
|
||||
|
||||
require('jquery-serializejson');
|
||||
|
||||
module.exports = Mn.View.extend({
|
||||
template: template,
|
||||
|
||||
ui: {
|
||||
form: 'form',
|
||||
buttons: 'form button'
|
||||
},
|
||||
|
||||
events: {
|
||||
'submit @ui.form': function (e) {
|
||||
e.preventDefault();
|
||||
let data = this.ui.form.serializeJSON();
|
||||
data._id = this.model.get('_id');
|
||||
|
||||
this.ui.buttons.prop('disabled', true).addClass('btn-disabled');
|
||||
|
||||
Api.Hosts.update(data)
|
||||
.then((/*result*/) => {
|
||||
App.UI.closeModal();
|
||||
Controller.showDashboard();
|
||||
})
|
||||
.catch((err) => {
|
||||
alert(err.message);
|
||||
this.ui.buttons.prop('disabled', false).removeClass('btn-disabled');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
16
manager/src/frontend/js/app/host/delete.ejs
Normal file
16
manager/src/frontend/js/app/host/delete.ejs
Normal file
@ -0,0 +1,16 @@
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<form class="form-horizontal">
|
||||
<div class="modal-header text-left">
|
||||
<h4 class="modal-title">Delete Host</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Are you sure? You cannot undo this.</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" class="btn btn-danger delete">Yes I'm Sure</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
35
manager/src/frontend/js/app/host/delete.js
Normal file
35
manager/src/frontend/js/app/host/delete.js
Normal file
@ -0,0 +1,35 @@
|
||||
'use strict';
|
||||
|
||||
import Mn from 'backbone.marionette';
|
||||
|
||||
const template = require('./delete.ejs');
|
||||
const Controller = require('../controller');
|
||||
const Api = require('../api');
|
||||
const App = require('../main');
|
||||
|
||||
module.exports = Mn.View.extend({
|
||||
template: template,
|
||||
|
||||
ui: {
|
||||
buttons: 'form button',
|
||||
delete: 'button.delete'
|
||||
},
|
||||
|
||||
events: {
|
||||
'click @ui.delete': function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
this.ui.buttons.prop('disabled', true).addClass('btn-disabled');
|
||||
|
||||
Api.Hosts.delete(this.model.get('_id'))
|
||||
.then((/*result*/) => {
|
||||
App.UI.closeModal();
|
||||
Controller.showDashboard();
|
||||
})
|
||||
.catch(err => {
|
||||
alert(err.message);
|
||||
this.ui.buttons.prop('disabled', false).removeClass('btn-disabled');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
84
manager/src/frontend/js/app/host/form.ejs
Normal file
84
manager/src/frontend/js/app/host/form.ejs
Normal file
@ -0,0 +1,84 @@
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<form class="form-horizontal">
|
||||
<div class="modal-header text-left">
|
||||
<h4 class="modal-title"><% if (typeof _id !== 'undefined') { %>Edit<% } else { %>Create<% } %> Host</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label">Hostname</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" placeholder="myhost.example.com" name="hostname" value="<%- hostname %>" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label">Forwarding IP</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" placeholder="192.168.0.1" name="forward_server" value="<%- forward_server %>" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label">Forwarding Port</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="number" minimum="1" maximum="65535" class="form-control" placeholder="" name="forward_port" value="<%- forward_port %>" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label">Access List</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control" name="access_list_id">
|
||||
<option value="">Loading...</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-4 col-sm-8">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="asset_caching" value="true"<%- asset_caching ? ' checked' : '' %>> Enable Asset Caching
|
||||
</label>
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="block_exploits" value="true"<%- block_exploits ? ' checked' : '' %>> Block Common Exploits
|
||||
</label>
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="ssl" value="true"<%- ssl ? ' checked' : '' %>> Enable SSL with Letsencrypt
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ssl_options"<%= ssl ? '' : ' style="display: none;"' %>>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label">Letsencrypt Email</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="email" class="form-control" placeholder="" name="letsencrypt_email" value="<%- letsencrypt_email %>"<%- ssl ? ' required' : '' %>>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-4 col-sm-8">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="accept_tos" value="true"<%- accept_tos ? ' checked' : '' %><%- ssl ? ' required' : '' %>> I accept the <a href="https://letsencrypt.org/repository/" target="_blank">Letsencrypt Terms of Service</a>
|
||||
</label>
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="force_ssl" value="true"<%- force_ssl ? ' checked' : '' %>> Redirect HTTP to HTTPS
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" class="btn btn-success save">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
106
manager/src/frontend/js/app/host/form.js
Normal file
106
manager/src/frontend/js/app/host/form.js
Normal file
@ -0,0 +1,106 @@
|
||||
'use strict';
|
||||
|
||||
import Mn from 'backbone.marionette';
|
||||
|
||||
const _ = require('lodash');
|
||||
const template = require('./form.ejs');
|
||||
const Controller = require('../controller');
|
||||
const Api = require('../api');
|
||||
const App = require('../main');
|
||||
|
||||
require('jquery-serializejson');
|
||||
|
||||
module.exports = Mn.View.extend({
|
||||
template: template,
|
||||
|
||||
ui: {
|
||||
form: 'form',
|
||||
buttons: 'form button',
|
||||
ssl_options: '.ssl_options',
|
||||
ssl: 'input[name="ssl"]',
|
||||
letsencrypt_email: 'input[name="letsencrypt_email"]',
|
||||
accept_tos: 'input[name="accept_tos"]',
|
||||
access_list_id: 'select[name="access_list_id"]'
|
||||
},
|
||||
|
||||
events: {
|
||||
'change @ui.ssl': function (e) {
|
||||
let inputs = this.ui.letsencrypt_email.add(this.ui.accept_tos);
|
||||
if (this.ui.ssl.prop('checked')) {
|
||||
this.ui.ssl_options.show();
|
||||
inputs.prop('required', true);
|
||||
} else {
|
||||
this.ui.ssl_options.hide();
|
||||
inputs.prop('required', false);
|
||||
}
|
||||
},
|
||||
|
||||
'submit @ui.form': function (e) {
|
||||
e.preventDefault();
|
||||
let data = _.extend({}, this.ui.form.serializeJSON());
|
||||
|
||||
// Change text true's to bools
|
||||
_.map(data, function (val, key) {
|
||||
if (val === 'true') {
|
||||
data[key] = true;
|
||||
}
|
||||
});
|
||||
|
||||
// Port is integer
|
||||
data.forward_port = parseInt(data.forward_port, 10);
|
||||
|
||||
// accept_tos is not required for backend
|
||||
delete data.accept_tos;
|
||||
delete data.access_list;
|
||||
|
||||
if (!data.ssl) {
|
||||
delete data.letsencrypt_email;
|
||||
delete data.force_ssl;
|
||||
}
|
||||
|
||||
this.ui.buttons.prop('disabled', true).addClass('btn-disabled');
|
||||
let method = Api.Hosts.create;
|
||||
|
||||
if (this.model.get('_id')) {
|
||||
// edit
|
||||
method = Api.Hosts.update;
|
||||
data._id = this.model.get('_id');
|
||||
}
|
||||
|
||||
method(data)
|
||||
.then((/*result*/) => {
|
||||
App.UI.closeModal();
|
||||
Controller.showDashboard();
|
||||
})
|
||||
.catch((err) => {
|
||||
alert(err.message);
|
||||
this.ui.buttons.prop('disabled', false).removeClass('btn-disabled');
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
let view = this;
|
||||
|
||||
Api.Access.getAll()
|
||||
.then(response => {
|
||||
if (!view.isDestroyed()) {
|
||||
view.ui.access_list_id.empty().append($('<option>').val('').text('None (Publicly Accessible)'));
|
||||
|
||||
if (response && response.length) {
|
||||
_.map(response, access => {
|
||||
view.ui.access_list_id.append($('<option>').val(access._id).text(access.name));
|
||||
});
|
||||
}
|
||||
|
||||
if (this.model.get('access_list_id')) {
|
||||
view.ui.access_list_id.val(this.model.get('access_list_id'));
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
alert("Error loading Access Lists!\n\n" + err.message);
|
||||
App.UI.closeModal();
|
||||
});
|
||||
}
|
||||
});
|
17
manager/src/frontend/js/app/host/reconfigure.ejs
Normal file
17
manager/src/frontend/js/app/host/reconfigure.ejs
Normal file
@ -0,0 +1,17 @@
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<form class="form-horizontal">
|
||||
<div class="modal-header text-left">
|
||||
<h4 class="modal-title">Reconfigure Host</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>This will simply re-create the Nginx config based on it's settings. You shouldn't need to do this under normal circumstances
|
||||
but if your host isn't working as expected, this may fix it.</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" class="btn btn-success reconfigure">Reconfigure</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
33
manager/src/frontend/js/app/host/reconfigure.js
Normal file
33
manager/src/frontend/js/app/host/reconfigure.js
Normal file
@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
|
||||
import Mn from 'backbone.marionette';
|
||||
|
||||
const template = require('./reconfigure.ejs');
|
||||
const Api = require('../api');
|
||||
const App = require('../main');
|
||||
|
||||
module.exports = Mn.View.extend({
|
||||
template: template,
|
||||
|
||||
ui: {
|
||||
buttons: 'form button',
|
||||
reconfigure: 'button.reconfigure'
|
||||
},
|
||||
|
||||
events: {
|
||||
'click @ui.reconfigure': function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
this.ui.buttons.prop('disabled', true).addClass('btn-disabled');
|
||||
|
||||
Api.Hosts.reconfigure(this.model.get('_id'))
|
||||
.then((/*result*/) => {
|
||||
App.UI.closeModal();
|
||||
})
|
||||
.catch(err => {
|
||||
alert(err.message);
|
||||
this.ui.buttons.prop('disabled', false).removeClass('btn-disabled');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
17
manager/src/frontend/js/app/host/renew.ejs
Normal file
17
manager/src/frontend/js/app/host/renew.ejs
Normal file
@ -0,0 +1,17 @@
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<form class="form-horizontal">
|
||||
<div class="modal-header text-left">
|
||||
<h4 class="modal-title">Renew SSL Certificates</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>This will renew the SSL Certificates for the host. This normally happens automatically however if you notice
|
||||
SSL working incorrectly, this may fix it.</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" class="btn btn-success renew">Renew SSL</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
33
manager/src/frontend/js/app/host/renew.js
Normal file
33
manager/src/frontend/js/app/host/renew.js
Normal file
@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
|
||||
import Mn from 'backbone.marionette';
|
||||
|
||||
const template = require('./renew.ejs');
|
||||
const Api = require('../api');
|
||||
const App = require('../main');
|
||||
|
||||
module.exports = Mn.View.extend({
|
||||
template: template,
|
||||
|
||||
ui: {
|
||||
buttons: 'form button',
|
||||
renew: 'button.renew'
|
||||
},
|
||||
|
||||
events: {
|
||||
'click @ui.renew': function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
this.ui.buttons.prop('disabled', true).addClass('btn-disabled');
|
||||
|
||||
Api.Hosts.renew(this.model.get('_id'))
|
||||
.then((/*result*/) => {
|
||||
App.UI.closeModal();
|
||||
})
|
||||
.catch(err => {
|
||||
alert(err.message);
|
||||
this.ui.buttons.prop('disabled', false).removeClass('btn-disabled');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user