Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
server-ts: Address self-review
Elian Doran99d50957ddbf
diff --git a/docker_healthcheck.js b/docker_healthcheck.jsindex 15145a44c7..9761aebe2e 100755--- a/docker_healthcheck.js+++ b/docker_healthcheck.js@@ -10,7 +10,7 @@ if (config.Network.https) {process.exit(0);}-const port = require('./src/services/port.ts');+const port = require('./src/services/port');const host = require('./src/services/host');const options = { timeout: 2000 };diff --git a/src/services/entity_changes_interface.ts b/src/services/entity_changes_interface.tsindex a0e6bb4bce..0276e24a01 100644--- a/src/services/entity_changes_interface.ts+++ b/src/services/entity_changes_interface.ts@@ -20,6 +20,6 @@ export interface EntityRow {}export interface EntityChangeRecord {- entityChange: EntityChange;- entity?: EntityRow;+ entityChange: EntityChange;+ entity?: EntityRow;}diff --git a/src/services/search/expressions/order_by_and_limit.ts b/src/services/search/expressions/order_by_and_limit.tsindex 5159920a5a..a3a37496f6 100644--- a/src/services/search/expressions/order_by_and_limit.ts+++ b/src/services/search/expressions/order_by_and_limit.ts@@ -25,7 +25,7 @@ class OrderByAndLimitExp extends Expression {constructor(orderDefinitions: Pick<OrderDefinition, "direction" | "valueExtractor">[], limit?: number) {super();- this.orderDefinitions = orderDefinitions as unknown as OrderDefinition[];+ this.orderDefinitions = orderDefinitions as OrderDefinition[];for (const od of this.orderDefinitions) {od.smaller = od.direction === "asc" ? -1 : 1;diff --git a/src/www.js b/src/www.jsindex 456bc940bf..2059a3a7cb 100644--- a/src/www.js+++ b/src/www.js@@ -45,7 +45,7 @@ function startTrilium() {* instead of the new one. This is complicated by the fact that it is possible to run multiple instances of Trilium* if port and data dir are configured separately. This complication is the source of the following weird usage.*- * The line below makes sure that the "second-instance" (process in window) is fired. Normally it returns a boolean+ * The line below makes sure that the "second-instance" (process in window.ts) is fired. Normally it returns a boolean* indicating whether another instance is running or not, but we ignore that and kill the app only based on the port conflict.** A bit weird is that "second-instance" is triggered also on the valid usecases (different port/data dir) and@@ -126,26 +126,26 @@ function startHttpServer() {}httpServer.on('error', error => {- if (!listenOnTcp || error.syscall !== 'listen') {+ if (!listenOnTcp || error.syscall !== 'listen') {+ throw error;+ }++ // handle specific listen errors with friendly messages+ switch (error.code) {+ case 'EACCES':+ console.error(`Port ${port} requires elevated privileges. It's recommended to use port above 1024.`);+ process.exit(1);+ break;++ case 'EADDRINUSE':+ console.error(`Port ${port} is already in use. Most likely, another Trilium process is already running. You might try to find it, kill it, and try again.`);+ process.exit(1);+ break;++ default:throw error;- }-- // handle specific listen errors with friendly messages- switch (error.code) {- case 'EACCES':- console.error(`Port ${port} requires elevated privileges. It's recommended to use port above 1024.`);- process.exit(1);- break;-- case 'EADDRINUSE':- console.error(`Port ${port} is already in use. Most likely, another Trilium process is already running. You might try to find it, kill it, and try again.`);- process.exit(1);- break;-- default:- throw error;- }}+ })httpServer.on('listening', () => {