From c485b6159df60510bad497148570776e5392693d Mon Sep 17 00:00:00 2001 From: FliegendeWurst <2012gdwu@web.de> Date: Tue, 2 Mar 2021 14:28:21 +0100 Subject: [PATCH 1/2] trilium: 0.43.4 -> 0.45.10 --- ...sole-logger-instead-of-rolling-files.patch | 98 +++++++++---------- pkgs/applications/office/trilium/default.nix | 16 ++- 2 files changed, 56 insertions(+), 58 deletions(-) diff --git a/pkgs/applications/office/trilium/0001-Use-console-logger-instead-of-rolling-files.patch b/pkgs/applications/office/trilium/0001-Use-console-logger-instead-of-rolling-files.patch index 1a4350ca71a..21b6b1c579c 100644 --- a/pkgs/applications/office/trilium/0001-Use-console-logger-instead-of-rolling-files.patch +++ b/pkgs/applications/office/trilium/0001-Use-console-logger-instead-of-rolling-files.patch @@ -1,17 +1,8 @@ -From 5be803a1171855f976a5b607970fa3949db72181 Mon Sep 17 00:00:00 2001 -From: Christian Kampka -Date: Mon, 9 Dec 2019 19:40:27 +0100 -Subject: [PATCH] Use console logger instead of rolling files - ---- - src/services/log.js | 26 +++----------------------- - 1 file changed, 3 insertions(+), 23 deletions(-) - diff --git a/src/services/log.js b/src/services/log.js -index 1514c209..456c3749 100644 +index b4c39e99..4c249154 100644 --- a/src/services/log.js +++ b/src/services/log.js -@@ -1,35 +1,15 @@ +@@ -1,14 +1,5 @@ "use strict"; -const fs = require('fs'); @@ -21,49 +12,50 @@ index 1514c209..456c3749 100644 - fs.mkdirSync(dataDir.LOG_DIR, 0o700); -} - --const logger = require('simple-node-logger').createRollingFileLogger({ -- errorEventName: 'error', -- logDirectory: dataDir.LOG_DIR, -- fileNamePattern: 'trilium-.log', -- dateFormat:'YYYY-MM-DD' --}); +-let logFile = null; - - function info(message) { - // info messages are logged asynchronously - setTimeout(() => { - console.log(message); + const SECOND = 1000; + const MINUTE = 60 * SECOND; + const HOUR = 60 * MINUTE; +@@ -16,41 +7,7 @@ const DAY = 24 * HOUR; + + const NEW_LINE = process.platform === "win32" ? '\r\n' : '\n'; + +-let todaysMidnight = null; - -- logger.info(message); - }, 0); +-initLogFile(); +- +-function getTodaysMidnight() { +- const now = new Date(); +- +- return new Date(now.getFullYear(), now.getMonth(), now.getDate()); +-} +- +-function initLogFile() { +- todaysMidnight = getTodaysMidnight(); +- +- const path = dataDir.LOG_DIR + '/trilium-' + formatDate() + '.log'; +- +- if (logFile) { +- logFile.end(); +- } +- +- logFile = fs.createWriteStream(path, {flags: 'a'}); +-} +- +-function checkDate(millisSinceMidnight) { +- if (millisSinceMidnight >= DAY) { +- initLogFile(); +- } +-} +- + function log(str) { +- const millisSinceMidnight = Date.now() - todaysMidnight.getTime(); +- +- checkDate(millisSinceMidnight); +- +- logFile.write(formatTime(millisSinceMidnight) + ' ' + str + NEW_LINE); +- + console.log(str); } - function error(message) { - message = "ERROR: " + message; - -- // we're using .info() instead of .error() because simple-node-logger emits weird error for showError() -- // errors are logged synchronously to make sure it doesn't get lost in case of crash -- logger.info(message); -- - console.trace(message); - } - -@@ -45,12 +25,12 @@ function request(req) { - if (req.url.includes(".js.map") || req.url.includes(".css.map")) { - return; - } -- -- logger.info(req.method + " " + req.url); -+ if(process.env.DEBUG) -+ console.log(req.method + " " + req.url); - } - - module.exports = { - info, - error, - request --}; -\ No newline at end of file -+}; --- -2.23.0 - diff --git a/pkgs/applications/office/trilium/default.nix b/pkgs/applications/office/trilium/default.nix index cb0781f74e1..32e9ee4cd4b 100644 --- a/pkgs/applications/office/trilium/default.nix +++ b/pkgs/applications/office/trilium/default.nix @@ -14,21 +14,21 @@ let meta = with lib; { inherit description; homepage = "https://github.com/zadam/trilium"; - license = licenses.agpl3; + license = licenses.agpl3Plus; platforms = [ "x86_64-linux" ]; maintainers = with maintainers; [ emmanuelrosa dtzWill ]; }; - version = "0.43.4"; + version = "0.45.10"; desktopSource = { url = "https://github.com/zadam/trilium/releases/download/v${version}/trilium-linux-x64-${version}.tar.xz"; - sha256 = "0kjysam5alsmnj93fcqq1ivawnra42gn7dch99rrfmvbkxp7hhr8"; + sha256 = "06ykgcak7l3q812c4xrp720db3yq0v2lkrzkmwchlwp5rpwhqpck"; }; serverSource = { url = "https://github.com/zadam/trilium/releases/download/v${version}/trilium-linux-x64-server-${version}.tar.xz"; - sha256 = "128mvmp15mjpb5ipkmr0yn7ahby26shbix3f8q094f4zpxjp83zx"; + sha256 = "1252zgyb23vfvy63cqd8jdjbm4w9ddwnp32z5vf1fqvd2rrz6lz9"; }; in { @@ -95,12 +95,18 @@ in { libxkbfile ]; - patches = [ ./0001-Use-console-logger-instead-of-rolling-files.patch ] ; + patches = [ + # patch logger to use console instead of rolling files + ./0001-Use-console-logger-instead-of-rolling-files.patch + ]; + installPhase = '' + runHook preInstall mkdir -p $out/bin mkdir -p $out/share/trilium-server cp -r ./* $out/share/trilium-server + runHook postInstall ''; postFixup = '' From 69f1362deb1780f984fbca332686972faa37262c Mon Sep 17 00:00:00 2001 From: FliegendeWurst <2012gdwu@web.de> Date: Tue, 2 Mar 2021 14:38:21 +0100 Subject: [PATCH 2/2] maintainers: add fliegendewurst --- maintainers/maintainer-list.nix | 6 ++++++ pkgs/applications/office/trilium/default.nix | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index d3a35283b78..b74c7d669ac 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -3151,6 +3151,12 @@ githubId = 19961516; name = "Felix Weilbach"; }; + fliegendewurst = { + email = "arne.keller@posteo.de"; + github = "FliegendeWurst"; + githubId = 12560461; + name = "Arne Keller"; + }; flokli = { email = "flokli@flokli.de"; github = "flokli"; diff --git a/pkgs/applications/office/trilium/default.nix b/pkgs/applications/office/trilium/default.nix index 32e9ee4cd4b..0b191f58041 100644 --- a/pkgs/applications/office/trilium/default.nix +++ b/pkgs/applications/office/trilium/default.nix @@ -16,7 +16,7 @@ let homepage = "https://github.com/zadam/trilium"; license = licenses.agpl3Plus; platforms = [ "x86_64-linux" ]; - maintainers = with maintainers; [ emmanuelrosa dtzWill ]; + maintainers = with maintainers; [ fliegendewurst ]; }; version = "0.45.10";