* Fix wrapping when too many hosts are shown (#207)

* Update npm packages, fixes CVE-2019-10757

* Revert some breaking packages

* Major overhaul

- Docker buildx support in CI
- Cypress API Testing in CI
- Restructured folder layout (insert clean face meme)
- Added Swagger documentation and validate API against that (to be completed)
- Use common base image for all supported archs, which includes updated nginx with ipv6 support
- Updated certbot and changes required for it
- Large amount of Hosts names will wrap in UI
- Updated packages for frontend
- Version bump 2.1.0

* Updated documentation

* Fix JWT expire time going crazy. Now set to 1day

* Backend JS formatting rules

* Remove v1 importer, I doubt anyone is using v1 anymore

* Added backend formatting rules and enforce them
in Jenkins builds

* Fix CI, doesn't need a tty

* Thanks bcrypt. Why can't you just be normal.

* Cleanup after syntax check

Co-authored-by: Marcelo Castagna <margaale@users.noreply.github.com>
This commit is contained in:
jc21
2020-02-19 15:55:06 +11:00
committed by GitHub
parent bf036cbb88
commit bb0f4bfa62
517 changed files with 26256 additions and 11724 deletions

View File

@ -0,0 +1,80 @@
<td class="text-center">
<div class="avatar d-block" style="background-image: url(<%- user.avatar || '/images/default-avatar.jpg' %>)">
<span class="avatar-status <%- user.is_disabled ? 'bg-red' : 'bg-green' %>"></span>
</div>
</td>
<td>
<div>
<% if (user.is_deleted) {
%>
<span class="mdi-format-strikethrough" title="Deleted"><%- user.name %></span>
<%
} else {
%>
<%- user.name %>
<%
}
%>
</div>
</td>
<td>
<div>
<%
var items = [];
switch (object_type) {
case 'proxy-host':
%> <span class="text-success"><i class="fe fe-zap"></i></span> <%
items = meta.domain_names;
break;
case 'redirection-host':
%> <span class="text-yellow"><i class="fe fe-shuffle"></i></span> <%
items = meta.domain_names;
break;
case 'stream':
%> <span class="text-blue"><i class="fe fe-radio"></i></span> <%
items.push(meta.incoming_port);
break;
case 'dead-host':
%> <span class="text-danger"><i class="fe fe-zap-off"></i></span> <%
items = meta.domain_names;
break;
case 'access-list':
%> <span class="text-teal"><i class="fe fe-lock"></i></span> <%
items.push(meta.name);
break;
case 'user':
%> <span class="text-teal"><i class="fe fe-user"></i></span> <%
items.push(meta.name);
break;
case 'certificate':
%> <span class="text-pink"><i class="fe fe-shield"></i></span> <%
if (meta.provider === 'letsencrypt') {
items = meta.domain_names;
} else {
items.push(meta.nice_name);
}
break;
}
%>&nbsp;<%- i18n('audit-log', action, {name: i18n('audit-log', object_type)}) %>
&mdash;
<%
if (items && items.length) {
items.map(function(item) {
%>
<span class="tag"><%- item %></span>
<%
});
} else {
%>
#<%- object_id %>
<%
}
%>
</div>
<div class="small text-muted">
<%- formatDbDate(created_on, 'Do MMMM YYYY, h:mm a') %>
</div>
</td>
<td class="text-right">
<a href="#" class="meta btn btn-secondary btn-sm"><%- i18n('audit-log', 'view-meta') %></a>
</td>

View File

@ -0,0 +1,32 @@
const Mn = require('backbone.marionette');
const Controller = require('../../controller');
const template = require('./item.ejs');
module.exports = Mn.View.extend({
template: template,
tagName: 'tr',
ui: {
meta: 'a.meta'
},
events: {
'click @ui.meta': function (e) {
e.preventDefault();
Controller.showAuditMeta(this.model);
}
},
templateContext: {
more: function() {
switch (this.object_type) {
case 'redirection-host':
case 'stream':
case 'proxy-host':
return this.meta.domain_names.join(', ');
}
return '#' + (this.object_id || '?');
}
}
});

View File

@ -0,0 +1,9 @@
<thead>
<th width="30">&nbsp;</th>
<th>User</th>
<th>Event</th>
<th>&nbsp;</th>
</thead>
<tbody>
<!-- items -->
</tbody>

View File

@ -0,0 +1,27 @@
const Mn = require('backbone.marionette');
const ItemView = require('./item');
const template = require('./main.ejs');
const TableBody = Mn.CollectionView.extend({
tagName: 'tbody',
childView: ItemView
});
module.exports = Mn.View.extend({
tagName: 'table',
className: 'table table-hover table-outline table-vcenter card-table',
template: template,
regions: {
body: {
el: 'tbody',
replaceElement: true
}
},
onRender: function () {
this.showChildView('body', new TableBody({
collection: this.collection
}));
}
});

View File

@ -0,0 +1,15 @@
<div class="card">
<div class="card-status bg-teal"></div>
<div class="card-header">
<h3 class="card-title"><%- i18n('audit-log', 'title') %></h3>
</div>
<div class="card-body no-padding min-100">
<div class="dimmer active">
<div class="loader"></div>
<div class="dimmer-content list-region">
<!-- List Region -->
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,53 @@
const Mn = require('backbone.marionette');
const App = require('../main');
const AuditLogModel = require('../../models/audit-log');
const ListView = require('./list/main');
const template = require('./main.ejs');
const ErrorView = require('../error/main');
const EmptyView = require('../empty/main');
module.exports = Mn.View.extend({
id: 'audit-log',
template: template,
ui: {
list_region: '.list-region',
dimmer: '.dimmer'
},
regions: {
list_region: '@ui.list_region'
},
onRender: function () {
let view = this;
App.Api.AuditLog.getAll(['user'])
.then(response => {
if (!view.isDestroyed() && response && response.length) {
view.showChildView('list_region', new ListView({
collection: new AuditLogModel.Collection(response)
}));
} else {
view.showChildView('list_region', new EmptyView({
title: App.i18n('audit-log', 'empty'),
subtitle: App.i18n('audit-log', 'empty-subtitle')
}));
}
})
.catch(err => {
view.showChildView('list_region', new ErrorView({
code: err.code,
message: err.message,
retry: function () {
App.Controller.showAuditLog();
}
}));
console.error(err);
})
.then(() => {
view.ui.dimmer.removeClass('active');
});
}
});

View File

@ -0,0 +1,27 @@
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title"><%- i18n('audit-log', 'meta-title') %></h5>
<button type="button" class="close cancel" aria-label="Close" data-dismiss="modal">&nbsp;</button>
</div>
<div class="modal-body">
<div class="mb-2">
<div class="tag tag-dark">
<%- i18n('audit-log', action, {name: i18n('audit-log', object_type)}) %>
<span class="tag-addon tag-orange">#<%- object_id %></span>
</div>
<div class="tag tag-dark">
<%- i18n('audit-log', 'user') %>
<span class="tag-addon tag-teal"><%- user.name %></span>
</div>
<div class="tag tag-dark">
<%- i18n('audit-log', 'date') %>
<span class="tag-addon tag-primary"><%- formatDbDate(created_on, 'Do MMMM YYYY, h:mm a') %></span>
</div>
</div>
<pre><%- JSON.stringify(meta, null, 2) %></pre>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary cancel" data-dismiss="modal"><%- i18n('str', 'close') %></button>
</div>
</div>

View File

@ -0,0 +1,7 @@
const Mn = require('backbone.marionette');
const template = require('./meta.ejs');
module.exports = Mn.View.extend({
template: template,
className: 'modal-dialog wide'
});