[fix] tweaks

This commit is contained in:
alban 2020-05-23 22:06:24 +02:00
parent 5bedb0c2a9
commit 3ce2e4514d
3 changed files with 25 additions and 14 deletions

View File

@ -6,17 +6,17 @@ const dbInit = {};
const bulkData = [
{ "index" : { "_index" : "changelog" } },
{ "author" : "John Ripper <john@theripper.com",
{ "author" : "John Ripper <john@theripper.com>",
"content":"* machines: Installed the server\n```debootstrap -t foobar```",
"server": "server.example.com",
"created_at":"2020-05-23T09:50:33.397Z"},
{ "index" : { "_index" : "changelog" } },
{ "author" : "John Ripper <john@theripper.com",
{ "author" : "John Ripper <john@theripper.com>",
"content":"* db: Installed mysql\n```apt install mariadb-server```",
"server": "server.example.com",
"created_at":"2020-05-23T10:50:33.397Z"},
{ "index" : { "_index" : "changelog" } },
{ "author" : "John Ripper <john@theripper.com",
{ "author" : "John Ripper <john@theripper.com>",
"content":"* nginx: add package\n```apt install nginx-full```",
"server": "server.example.com",
"created_at":"2020-05-23T16:50:33.397Z"}

View File

@ -13,6 +13,8 @@
font-size: .875rem;
color: #888;
line-height:1.2em;
text-align: right;
}
.log .meta p {
@ -41,6 +43,11 @@
}
.log pre .cmd {
background: #eee;
color: #003e80;
color: #333f4d;
padding: 3px 8px;
}
@media (max-width: 991.98px){
.log .meta {
text-align: left;
}

View File

@ -21,20 +21,24 @@ escape = function(string) {
};
var urlRegex = /(\S+): (https?:&#x2F;&#x2F;[^\s]+)/g;
url = function(string){
return ''+string.replace(urlRegex, '<a target="_blank" href="$2">$1</a>')
}
return ''+string.replace(urlRegex, '<a target="_blank" href="$2">$1</a>');
};
var titleRegex = /^(.*\n)/;
title = function(string){
return ''+string.replace(titleRegex, '<b>$1</b>');
}
var cmdRegex = /```([^`]*?)```/g
};
var cmdRegex = /```([^`]*?)```/g;
cmd = function(string) {
return ''+string.replace(cmdRegex, '<span class="cmd">$1</span>');
}
date = function(date){
var D = new Date(date);
};
date = function(string){
var D = new Date(string);
return D.toLocaleDateString()+" "+D.toLocaleTimeString();
}
};
mailRegexp = /(.*) &lt;(.+@.+)&gt;/;
mail = function( string ){
return ''+string.replace(mailRegexp, '<a href="mailto:$2">$1</a>');
};
function updatePage(data){
var content = "";
@ -51,13 +55,13 @@ function updatePage(data){
content += `
<div class="log row">
<div class="meta col-lg-2 text-right">
<div class="meta col-lg-2 ">
<p class="server"> ${escape(item.server)} </p>
<a href="/log/${id}">
${date(escape(item.created_at))} <br/>
</a>
<div class="d-none d-lg-block">
<p class="author"> ${escape(item.author)} </p>
<p class="author"> ${mail(escape(item.author))} </p>
<p>
<a class="actions-toggle btn-link btn-sm">Actions</a>
</p>