summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--maintainers/maintainer-list.nix6
-rw-r--r--pkgs/applications/office/trilium/0001-Use-console-logger-instead-of-rolling-files.patch92
-rw-r--r--pkgs/applications/office/trilium/default.nix18
3 files changed, 60 insertions, 56 deletions
diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix
index 4c23685d5a6..dfed0146d0e 100644
--- a/maintainers/maintainer-list.nix
+++ b/maintainers/maintainer-list.nix
@@ -3193,6 +3193,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/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 <christian@kampka.net>
-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-<DATE>.log',
--    dateFormat:'YYYY-MM-DD'
--});
+-let logFile = null;
 -
- function info(message) {
-     // info messages are logged asynchronously
-     setTimeout(() => {
-         console.log(message);
--
--        logger.info(message);
-     }, 0);
- }
+ const SECOND = 1000;
+ const MINUTE = 60 * SECOND;
+ const HOUR = 60 * MINUTE;
+@@ -16,41 +7,7 @@ const DAY = 24 * HOUR;
  
- function error(message) {
-     message = "ERROR: " + message;
+ const NEW_LINE = process.platform === "win32" ? '\r\n' : '\n';
  
--    // 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);
+-let todaysMidnight = null;
 -
-     console.trace(message);
- }
- 
-@@ -45,12 +25,12 @@ function request(req) {
-     if (req.url.includes(".js.map") || req.url.includes(".css.map")) {
-         return;
-     }
+-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);
 -
--    logger.info(req.method + " " + req.url);
-+    if(process.env.DEBUG)
-+        console.log(req.method + " " + req.url);
+     console.log(str);
  }
  
- 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..0b191f58041 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 ];
+    maintainers = with maintainers; [ fliegendewurst ];
   };
 
-  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 = ''