From 3ce2e4514df8216502a9cac9d227ab4db68e8a54 Mon Sep 17 00:00:00 2001 From: alban Date: Sat, 23 May 2020 22:06:24 +0200 Subject: [PATCH] [fix] tweaks --- dbInit/index.js | 6 +++--- public/css/site.css | 9 ++++++++- public/js/app.js | 24 ++++++++++++++---------- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/dbInit/index.js b/dbInit/index.js index 7db0768..afa258a 100644 --- a/dbInit/index.js +++ b/dbInit/index.js @@ -6,17 +6,17 @@ const dbInit = {}; const bulkData = [ { "index" : { "_index" : "changelog" } }, - { "author" : "John Ripper ", "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 ", "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 ", "content":"* nginx: add package\n```apt install nginx-full```", "server": "server.example.com", "created_at":"2020-05-23T16:50:33.397Z"} diff --git a/public/css/site.css b/public/css/site.css index 85e1947..10f4a7c 100644 --- a/public/css/site.css +++ b/public/css/site.css @@ -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; +} + diff --git a/public/js/app.js b/public/js/app.js index 0631fbe..5a1a728 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -21,20 +21,24 @@ escape = function(string) { }; var urlRegex = /(\S+): (https?://[^\s]+)/g; url = function(string){ - return ''+string.replace(urlRegex, '$1') -} + return ''+string.replace(urlRegex, '$1'); +}; var titleRegex = /^(.*\n)/; title = function(string){ return ''+string.replace(titleRegex, '$1'); -} -var cmdRegex = /```([^`]*?)```/g +}; +var cmdRegex = /```([^`]*?)```/g; cmd = function(string) { return ''+string.replace(cmdRegex, '$1'); -} -date = function(date){ - var D = new Date(date); +}; +date = function(string){ + var D = new Date(string); return D.toLocaleDateString()+" "+D.toLocaleTimeString(); -} +}; +mailRegexp = /(.*) <(.+@.+)>/; +mail = function( string ){ + return ''+string.replace(mailRegexp, '$1'); +}; function updatePage(data){ var content = ""; @@ -51,13 +55,13 @@ function updatePage(data){ content += `
-
+

${escape(item.server)}

${date(escape(item.created_at))}
-

${escape(item.author)}

+

${mail(escape(item.author))}

Actions