Skip to content

Build your personal knowledge base with Trilium Notes

chore(server): fix references to becca service

Elian Doran9391159413e0
diff --git a/apps/server/src/routes/api/autocomplete.ts b/apps/server/src/routes/api/autocomplete.ts
index 6d3deb33a6..8b75dd7a6a 100644
--- a/apps/server/src/routes/api/autocomplete.ts
+++ b/apps/server/src/routes/api/autocomplete.ts
@@ -1,8 +1,7 @@
-import { ValidationError } from "@triliumnext/core";
+import { becca_service, ValidationError } from "@triliumnext/core";
import type { Request } from "express";
import becca from "../../becca/becca.js";
-import beccaService from "../../becca/becca_service.js";
import cls from "../../services/cls.js";
import log from "../../services/log.js";
import searchService from "../../services/search/services/search.js";
@@ -67,8 +66,8 @@ function getRecentNotes(activeNoteId: string) {
return recentNotes.map((rn) => {
const notePathArray = rn.notePath.split("/");
- const { title, icon } = beccaService.getNoteTitleAndIcon(notePathArray[notePathArray.length - 1]);
- const notePathTitle = beccaService.getNoteTitleForPath(notePathArray);
+ const { title, icon } = becca_service.getNoteTitleAndIcon(notePathArray[notePathArray.length - 1]);
+ const notePathTitle = becca_service.getNoteTitleForPath(notePathArray);
return {
notePath: rn.notePath,
diff --git a/apps/server/src/routes/api/revisions.ts b/apps/server/src/routes/api/revisions.ts
index 9700e7f782..6505a32c7f 100644
--- a/apps/server/src/routes/api/revisions.ts
+++ b/apps/server/src/routes/api/revisions.ts
@@ -1,18 +1,19 @@
-"use strict";
-import beccaService from "../../becca/becca_service.js";
-import utils from "../../services/utils.js";
-import sql from "../../services/sql.js";
-import cls from "../../services/cls.js";
+
+import { EditedNotesResponse, RevisionItem, RevisionPojo, RevisionRow } from "@triliumnext/commons";
+import { becca_service } from "@triliumnext/core";
+import type { Request, Response } from "express";
import path from "path";
+
import becca from "../../becca/becca.js";
+import type { NotePojo } from "../../becca/becca-interface.js";
+import type BNote from "../../becca/entities/bnote.js";
+import type BRevision from "../../becca/entities/brevision.js";
import blobService from "../../services/blob.js";
+import cls from "../../services/cls.js";
import eraseService from "../../services/erase.js";
-import type { Request, Response } from "express";
-import type BRevision from "../../becca/entities/brevision.js";
-import type BNote from "../../becca/entities/bnote.js";
-import type { NotePojo } from "../../becca/becca-interface.js";
-import { EditedNotesResponse, RevisionItem, RevisionPojo, RevisionRow } from "@triliumnext/commons";
+import sql from "../../services/sql.js";
+import utils from "../../services/utils.js";
interface NotePath {
noteId: string;
@@ -166,7 +167,7 @@ function getEditedNotesOnDate(req: Request) {
)
ORDER BY isDeleted
LIMIT 50`,
- { date: `${req.params.date}%` }
+ { date: `${req.params.date}%` }
);
let notes = becca.getNotes(noteIds, true);
@@ -191,7 +192,7 @@ function getNotePathData(note: BNote): NotePath | undefined {
const retPath = note.getBestNotePath();
if (retPath) {
- const noteTitle = beccaService.getNoteTitleForPath(retPath);
+ const noteTitle = becca_service.getNoteTitleForPath(retPath);
let branchId;
@@ -204,7 +205,7 @@ function getNotePathData(note: BNote): NotePath | undefined {
return {
noteId: note.noteId,
- branchId: branchId,
+ branchId,
title: noteTitle,
notePath: retPath,
path: retPath.join("/")
diff --git a/apps/server/src/routes/api/search.ts b/apps/server/src/routes/api/search.ts
index fa2f8a2595..d406524ed5 100644
--- a/apps/server/src/routes/api/search.ts
+++ b/apps/server/src/routes/api/search.ts
@@ -1,8 +1,7 @@
-import { ValidationError } from "@triliumnext/core";
+import { becca_service,ValidationError } from "@triliumnext/core";
import type { Request } from "express";
import becca from "../../becca/becca.js";
-import beccaService from "../../becca/becca_service.js";
import attributeFormatter from "../../services/attribute_formatter.js";
import bulkActionService from "../../services/bulk_actions.js";
import cls from "../../services/cls.js";
@@ -70,7 +69,7 @@ function quickSearch(req: Request) {
// Map to API format
const searchResults = trimmed.map((result) => {
- const { title, icon } = beccaService.getNoteTitleAndIcon(result.noteId);
+ const { title, icon } = becca_service.getNoteTitleAndIcon(result.noteId);
return {
notePath: result.notePath,
noteTitle: title,
diff --git a/apps/server/src/services/search/expressions/note_flat_text.ts b/apps/server/src/services/search/expressions/note_flat_text.ts
index b9ad19c36c..18bb0944d8 100644
--- a/apps/server/src/services/search/expressions/note_flat_text.ts
+++ b/apps/server/src/services/search/expressions/note_flat_text.ts
@@ -1,14 +1,12 @@
-"use strict";
+import { becca_service } from "@triliumnext/core";
+import becca from "../../../becca/becca.js";
import type BNote from "../../../becca/entities/bnote.js";
+import { normalize } from "../../utils.js";
+import NoteSet from "../note_set.js";
import type SearchContext from "../search_context.js";
-
+import { fuzzyMatchWord, fuzzyMatchWordWithResult,normalizeSearchText } from "../utils/text_utils.js";
import Expression from "./expression.js";
-import NoteSet from "../note_set.js";
-import becca from "../../../becca/becca.js";
-import { normalize } from "../../utils.js";
-import { normalizeSearchText, fuzzyMatchWord, fuzzyMatchWordWithResult } from "../utils/text_utils.js";
-import beccaService from "../../../becca/becca_service.js";
class NoteFlatTextExp extends Expression {
tokens: string[];
@@ -60,7 +58,7 @@ class NoteFlatTextExp extends Expression {
// Add defensive checks for undefined properties
const typeMatches = note.type && note.type.includes(token);
const mimeMatches = note.mime && note.mime.includes(token);
-
+
if (typeMatches || mimeMatches) {
foundAttrTokens.push(token);
}
@@ -78,7 +76,7 @@ class NoteFlatTextExp extends Expression {
}
for (const parentNote of note.parents) {
- const title = normalizeSearchText(beccaService.getNoteTitle(note.noteId, parentNote.noteId));
+ const title = normalizeSearchText(becca_service.getNoteTitle(note.noteId, parentNote.noteId));
const foundTokens: string[] = foundAttrTokens.slice();
for (const token of remainingTokens) {
@@ -112,7 +110,7 @@ class NoteFlatTextExp extends Expression {
// Add defensive checks for undefined properties
const typeMatches = note.type && note.type.includes(token);
const mimeMatches = note.mime && note.mime.includes(token);
-
+
if (typeMatches || mimeMatches) {
foundAttrTokens.push(token);
}
@@ -125,7 +123,7 @@ class NoteFlatTextExp extends Expression {
}
for (const parentNote of note.parents) {
- const title = normalizeSearchText(beccaService.getNoteTitle(note.noteId, parentNote.noteId));
+ const title = normalizeSearchText(becca_service.getNoteTitle(note.noteId, parentNote.noteId));
const foundTokens = foundAttrTokens.slice();
for (const token of this.tokens) {
@@ -190,7 +188,7 @@ class NoteFlatTextExp extends Expression {
if (text.includes(token)) {
return true;
}
-
+
// Fuzzy fallback only if enabled and for tokens >= 4 characters
if (searchContext?.enableFuzzyMatching && token.length >= 4) {
const matchedWord = fuzzyMatchWordWithResult(token, text);
@@ -202,7 +200,7 @@ class NoteFlatTextExp extends Expression {
return true;
}
}
-
+
return false;
}
}
diff --git a/apps/server/src/services/search/search_result.ts b/apps/server/src/services/search/search_result.ts
index bf8a33524b..984a6d97a8 100644
--- a/apps/server/src/services/search/search_result.ts
+++ b/apps/server/src/services/search/search_result.ts
@@ -1,12 +1,10 @@
-"use strict";
+import { becca_service } from "@triliumnext/core";
-import beccaService from "../../becca/becca_service.js";
import becca from "../../becca/becca.js";
-import {
- normalizeSearchText,
- calculateOptimizedEditDistance,
- FUZZY_SEARCH_CONFIG
-} from "./utils/text_utils.js";
+import {
+ calculateOptimizedEditDistance,
+ FUZZY_SEARCH_CONFIG,
+ normalizeSearchText} from "./utils/text_utils.js";
// Scoring constants for better maintainability
const SCORE_WEIGHTS = {
@@ -41,7 +39,7 @@ class SearchResult {
constructor(notePathArray: string[]) {
this.notePathArray = notePathArray;
- this.notePathTitle = beccaService.getNoteTitleForPath(notePathArray);
+ this.notePathTitle = becca_service.getNoteTitleForPath(notePathArray);
this.score = 0;
this.fuzzyScore = 0;
}
@@ -98,7 +96,7 @@ class SearchResult {
for (const chunk of chunks) {
for (const token of tokens) {
const normalizedToken = normalizeSearchText(token.toLowerCase());
-
+
if (chunk === normalizedToken) {
tokenScore += SCORE_WEIGHTS.TOKEN_EXACT_MATCH * token.length * factor;
} else if (chunk.startsWith(normalizedToken)) {
@@ -108,10 +106,10 @@ class SearchResult {
} else {
// Try fuzzy matching for individual tokens with caps applied
const editDistance = calculateOptimizedEditDistance(chunk, normalizedToken, FUZZY_SEARCH_CONFIG.MAX_EDIT_DISTANCE);
- if (editDistance <= FUZZY_SEARCH_CONFIG.MAX_EDIT_DISTANCE &&
+ if (editDistance <= FUZZY_SEARCH_CONFIG.MAX_EDIT_DISTANCE &&
normalizedToken.length >= FUZZY_SEARCH_CONFIG.MIN_FUZZY_TOKEN_LENGTH &&
this.fuzzyScore < SCORE_WEIGHTS.MAX_TOTAL_FUZZY_SCORE) {
-
+
const fuzzyWeight = SCORE_WEIGHTS.TOKEN_FUZZY_MATCH * (1 - editDistance / FUZZY_SEARCH_CONFIG.MAX_EDIT_DISTANCE);
// Apply caps: limit token length multiplier and per-token contribution
const cappedTokenLength = Math.min(token.length, SCORE_WEIGHTS.MAX_FUZZY_TOKEN_LENGTH_MULTIPLIER);
@@ -119,7 +117,7 @@ class SearchResult {
fuzzyWeight * cappedTokenLength * factor,
SCORE_WEIGHTS.MAX_FUZZY_SCORE_PER_TOKEN
);
-
+
tokenScore += fuzzyTokenScore;
this.fuzzyScore += fuzzyTokenScore;
}
@@ -134,8 +132,8 @@ class SearchResult {
* Checks if the query matches as a complete word in the text
*/
private isWordMatch(text: string, query: string): boolean {
- return text.includes(` ${query} `) ||
- text.startsWith(`${query} `) ||
+ return text.includes(` ${query} `) ||
+ text.startsWith(`${query} `) ||
text.endsWith(` ${query}`);
}
@@ -147,21 +145,21 @@ class SearchResult {
if (this.fuzzyScore >= SCORE_WEIGHTS.MAX_TOTAL_FUZZY_SCORE) {
return 0;
}
-
+
const editDistance = calculateOptimizedEditDistance(title, query, FUZZY_SEARCH_CONFIG.MAX_EDIT_DISTANCE);
const maxLen = Math.max(title.length, query.length);
-
+
// Only apply fuzzy matching if the query is reasonably long and edit distance is small
- if (query.length >= FUZZY_SEARCH_CONFIG.MIN_FUZZY_TOKEN_LENGTH &&
- editDistance <= FUZZY_SEARCH_CONFIG.MAX_EDIT_DISTANCE &&
+ if (query.length >= FUZZY_SEARCH_CONFIG.MIN_FUZZY_TOKEN_LENGTH &&
+ editDistance <= FUZZY_SEARCH_CONFIG.MAX_EDIT_DISTANCE &&
editDistance / maxLen <= 0.3) {
const similarity = 1 - (editDistance / maxLen);
const baseFuzzyScore = SCORE_WEIGHTS.TITLE_WORD_MATCH * similarity * 0.7; // Reduced weight for fuzzy matches
-
+
// Apply cap to ensure fuzzy title matches don't exceed reasonable bounds
return Math.min(baseFuzzyScore, SCORE_WEIGHTS.MAX_TOTAL_FUZZY_SCORE * 0.3);
}
-
+
return 0;
}
diff --git a/apps/server/src/services/search/services/search.ts b/apps/server/src/services/search/services/search.ts
index 5ca4bda4a1..16eeb70ccd 100644
--- a/apps/server/src/services/search/services/search.ts
+++ b/apps/server/src/services/search/services/search.ts
@@ -1,24 +1,22 @@
-"use strict";
-
+import { becca_service } from "@triliumnext/core";
import normalizeString from "normalize-strings";
-import lex from "./lex.js";
-import handleParens from "./handle_parens.js";
-import parse from "./parse.js";
-import SearchResult from "../search_result.js";
-import SearchContext from "../search_context.js";
+import striptags from "striptags";
+
import becca from "../../../becca/becca.js";
-import beccaService from "../../../becca/becca_service.js";
-import { normalize, escapeHtml, escapeRegExp } from "../../utils.js";
-import log from "../../log.js";
-import hoistedNoteService from "../../hoisted_note.js";
import type BNote from "../../../becca/entities/bnote.js";
-import type BAttribute from "../../../becca/entities/battribute.js";
-import type { SearchParams, TokenStructure } from "./types.js";
-import type Expression from "../expressions/expression.js";
-import sql from "../../sql.js";
-import scriptService from "../../script.js";
-import striptags from "striptags";
+import hoistedNoteService from "../../hoisted_note.js";
+import log from "../../log.js";
import protectedSessionService from "../../protected_session.js";
+import scriptService from "../../script.js";
+import sql from "../../sql.js";
+import { escapeHtml, escapeRegExp } from "../../utils.js";
+import type Expression from "../expressions/expression.js";
+import SearchContext from "../search_context.js";
+import SearchResult from "../search_result.js";
+import handleParens from "./handle_parens.js";
+import lex from "./lex.js";
+import parse from "./parse.js";
+import type { SearchParams, TokenStructure } from "./types.js";
export interface SearchNoteResult {
searchResultNoteIds: string[];
@@ -67,7 +65,7 @@ function searchFromNote(note: BNote): SearchNoteResult {
return {
searchResultNoteIds: searchResultNoteIds.filter((resultNoteId) => !["root", note.noteId].includes(resultNoteId)),
highlightedTokens,
- error: error
+ error
};
}
@@ -252,21 +250,21 @@ function findResultsWithExpression(expression: Expression, searchContext: Search
// Phase 1: Try exact matches first (without fuzzy matching)
const exactResults = performSearch(expression, searchContext, false);
-
+
// Check if we have sufficient high-quality results
const minResultThreshold = 5;
const minScoreForQuality = 10; // Minimum score to consider a result "high quality"
-
+
const highQualityResults = exactResults.filter(result => result.score >= minScoreForQuality);
-
+
// If we have enough high-quality exact matches, return them
if (highQualityResults.length >= minResultThreshold) {
return exactResults;
}
-
+
// Phase 2: Add fuzzy matching as fallback when exact matches are insufficient
const fuzzyResults = performSearch(expression, searchContext, true);
-
+
// Merge results, ensuring exact matches always rank higher than fuzzy matches
return mergeExactAndFuzzyResults(exactResults, fuzzyResults);
}
@@ -326,10 +324,10 @@ function performSearch(expression: Expression, searchContext: SearchContext, ena
function mergeExactAndFuzzyResults(exactResults: SearchResult[], fuzzyResults: SearchResult[]): SearchResult[] {
// Create a map of exact result note IDs for deduplication
const exactNoteIds = new Set(exactResults.map(result => result.noteId));
-
+
// Add fuzzy results that aren't already in exact results
const additionalFuzzyResults = fuzzyResults.filter(result => !exactNoteIds.has(result.noteId));
-
+
// Sort exact results by score (best exact matches first)
exactResults.sort((a, b) => {
if (a.score > b.score) {
@@ -345,7 +343,7 @@ function mergeExactAndFuzzyResults(exactResults: SearchResult[], fuzzyResults: S
return a.notePathArray.length < b.notePathArray.length ? -1 : 1;
});
-
+
// Sort fuzzy results by score (best fuzzy matches first)
additionalFuzzyResults.sort((a, b) => {
if (a.score > b.score) {
@@ -361,7 +359,7 @@ function mergeExactAndFuzzyResults(exactResults: SearchResult[], fuzzyResults: S
return a.notePathArray.length < b.notePathArray.length ? -1 : 1;
});
-
+
// CRITICAL: Always put exact matches before fuzzy matches, regardless of scores
return [...exactResults, ...additionalFuzzyResults];
}
@@ -417,10 +415,10 @@ function findResultsWithQuery(query: string, searchContext: SearchContext): Sear
}
// If the query starts with '#', it's a pure expression query.
- // Don't use progressive search for these as they may have complex
+ // Don't use progressive search for these as they may have complex
// ordering or other logic that shouldn't be interfered with.
const isPureExpressionQuery = query.trim().startsWith('#');
-
+
if (isPureExpressionQuery) {
// For pure expression queries, use standard search without progressive phases
return performSearch(expression, searchContext, searchContext.enableFuzzyMatching);
@@ -448,7 +446,7 @@ function extractContentSnippet(noteId: string, searchTokens: string[], maxLength
try {
let content = note.getContent();
-
+
if (!content || typeof content !== "string") {
return "";
}
@@ -489,7 +487,7 @@ function extractContentSnippet(noteId: string, searchTokens: string[], maxLength
for (const token of searchTokens) {
const normalizedToken = normalizeString(token.toLowerCase());
const matchIndex = normalizedContent.indexOf(normalizedToken);
-
+
if (matchIndex !== -1) {
// Center the snippet around the match
snippetStart = Math.max(0, matchIndex - maxLength / 2);
@@ -528,7 +526,7 @@ function extractContentSnippet(noteId: string, searchTokens: string[], maxLength
snippet = lines.slice(0, 4).join('\n');
}
// Add ellipsis if we truncated lines
- snippet = snippet + "...";
+ snippet = `${snippet }...`;
} else if (lines.length > 1) {
// For multi-line snippets that are 4 or fewer lines, keep them as-is
// No need to truncate
@@ -540,15 +538,15 @@ function extractContentSnippet(noteId: string, searchTokens: string[], maxLength
if (firstSpace > 0 && firstSpace < 20) {
snippet = snippet.substring(firstSpace + 1);
}
- snippet = "..." + snippet;
+ snippet = `...${ snippet}`;
}
-
+
if (snippetStart + maxLength < content.length) {
const lastSpace = snippet.search(/\s[^\s]*$/);
if (lastSpace > snippet.length - 20 && lastSpace > 0) {
snippet = snippet.substring(0, lastSpace);
}
- snippet = snippet + "...";
+ snippet = `${snippet }...`;
}
}
@@ -572,20 +570,20 @@ function extractAttributeSnippet(noteId: string, searchTokens: string[], maxLeng
return "";
}
- let matchingAttributes: Array<{name: string, value: string, type: string}> = [];
-
+ const matchingAttributes: Array<{name: string, value: string, type: string}> = [];
+
// Look for attributes that match the search tokens
for (const attr of attributes) {
const attrName = attr.name?.toLowerCase() || "";
const attrValue = attr.value?.toLowerCase() || "";
const attrType = attr.type || "";
-
+
// Check if any search token matches the attribute name or value
const hasMatch = searchTokens.some(token => {
const normalizedToken = normalizeString(token.toLowerCase());
return attrName.includes(normalizedToken) || attrValue.includes(normalizedToken);
});
-
+
if (hasMatch) {
matchingAttributes.push({
name: attr.name || "",
@@ -611,20 +609,20 @@ function extractAttributeSnippet(noteId: string, searchTokens: string[], maxLeng
const targetTitle = targetNote ? targetNote.title : attr.value;
line = `~${attr.name}="${targetTitle}"`;
}
-
+
if (line) {
lines.push(line);
}
}
let snippet = lines.join('\n');
-
+
// Apply length limit while preserving line structure
if (snippet.length > maxLength) {
// Try to truncate at word boundaries but keep lines intact
const truncated = snippet.substring(0, maxLength);
const lastNewline = truncated.lastIndexOf('\n');
-
+
if (lastNewline > maxLength / 2) {
// If we can keep most content by truncating to last complete line
snippet = truncated.substring(0, lastNewline);
@@ -632,7 +630,7 @@ function extractAttributeSnippet(noteId: string, searchTokens: string[], maxLeng
// Otherwise just truncate and add ellipsis
const lastSpace = truncated.lastIndexOf(' ');
snippet = truncated.substring(0, lastSpace > maxLength / 2 ? lastSpace : maxLength - 3);
- snippet = snippet + "...";
+ snippet = `${snippet }...`;
}
}
@@ -645,7 +643,7 @@ function extractAttributeSnippet(noteId: string, searchTokens: string[], maxLeng
function searchNotesForAutocomplete(query: string, fastSearch: boolean = true) {
const searchContext = new SearchContext({
- fastSearch: fastSearch,
+ fastSearch,
includeArchivedNotes: false,
includeHiddenNotes: true,
fuzzyAttributeSearch: true,
@@ -666,7 +664,7 @@ function searchNotesForAutocomplete(query: string, fastSearch: boolean = true) {
highlightSearchResults(trimmed, searchContext.highlightedTokens, searchContext.ignoreInternalAttributes);
return trimmed.map((result) => {
- const { title, icon } = beccaService.getNoteTitleAndIcon(result.noteId);
+ const { title, icon } = becca_service.getNoteTitleAndIcon(result.noteId);
return {
notePath: result.notePath,
noteTitle: title,
@@ -698,7 +696,7 @@ function highlightSearchResults(searchResults: SearchResult[], highlightedTokens
for (const result of searchResults) {
result.highlightedNotePathTitle = result.notePathTitle.replace(/[<{}]/g, "");
-
+
// Initialize highlighted content snippet
if (result.contentSnippet) {
// Escape HTML but preserve newlines for later conversion to <br>
@@ -706,7 +704,7 @@ function highlightSearchResults(searchResults: SearchResult[], highlightedTokens
// Remove any stray < { } that might interfere with our highlighting markers
result.highlightedContentSnippet = result.highlightedContentSnippet.replace(/[<{}]/g, "");
}
-
+
// Initialize highlighted attribute snippet
if (result.attributeSnippet) {
// Escape HTML but preserve newlines for later conversion to <br>
@@ -767,14 +765,14 @@ function highlightSearchResults(searchResults: SearchResult[], highlightedTokens
if (result.highlightedNotePathTitle) {
result.highlightedNotePathTitle = result.highlightedNotePathTitle.replace(/{/g, "<b>").replace(/}/g, "</b>");
}
-
+
if (result.highlightedContentSnippet) {
// Replace highlighting markers with HTML tags
result.highlightedContentSnippet = result.highlightedContentSnippet.replace(/{/g, "<b>").replace(/}/g, "</b>");
// Convert newlines to <br> tags for HTML display
result.highlightedContentSnippet = result.highlightedContentSnippet.replace(/\n/g, "<br>");
}
-
+
if (result.highlightedAttributeSnippet) {
// Replace highlighting markers with HTML tags
result.highlightedAttributeSnippet = result.highlightedAttributeSnippet.replace(/{/g, "<b>").replace(/}/g, "</b>");
diff --git a/apps/server/src/services/tray.ts b/apps/server/src/services/tray.ts
index 504e81b21e..95d158fa3a 100644
--- a/apps/server/src/services/tray.ts
+++ b/apps/server/src/services/tray.ts
@@ -1,15 +1,15 @@
-import electron from "electron";
+import type { KeyboardActionNames } from "@triliumnext/commons";
+import { becca_service } from "@triliumnext/core";
import type { BrowserWindow, Tray } from "electron";
+import electron from "electron";
import { default as i18next, t } from "i18next";
import path from "path";
import becca from "../becca/becca.js";
-import becca_service from "../becca/becca_service.js";
import type BNote from "../becca/entities/bnote.js";
import type BRecentNote from "../becca/entities/brecent_note.js";
import cls from "./cls.js";
import date_notes from "./date_notes.js";
-import type { KeyboardActionNames } from "@triliumnext/commons";
import optionService from "./options.js";
import { getResourceDir, isDev, isMac } from "./utils.js";
import windowService from "./window.js";
@@ -31,9 +31,9 @@ function getTrayIconPath() {
if (process.env.NODE_ENV === "development") {
return path.join(__dirname, "../../../desktop/src/assets/images/tray", `${name}.png`);
- } else {
- return path.resolve(path.join(getResourceDir(), "assets", "images", "tray", `${name}.png`));
- }
+ }
+ return path.resolve(path.join(getResourceDir(), "assets", "images", "tray", `${name}.png`));
+
}
function getIconPath(name: string) {
@@ -41,9 +41,9 @@ function getIconPath(name: string) {
if (process.env.NODE_ENV === "development") {
return path.join(__dirname, "../../../desktop/src/assets/images/tray", `${name}Template${suffix}.png`);
- } else {
- return path.resolve(path.join(getResourceDir(), "assets", "images", "tray", `${name}Template${suffix}.png`));
- }
+ }
+ return path.resolve(path.join(getResourceDir(), "assets", "images", "tray", `${name}Template${suffix}.png`));
+
}
function registerVisibilityListener(window: BrowserWindow) {
@@ -74,7 +74,7 @@ function getWindowTitle(window: BrowserWindow | null) {
// Limit title maximum length to 17
if (titleWithoutAppName.length > 20) {
- return titleWithoutAppName.substring(0, 17) + '...';
+ return `${titleWithoutAppName.substring(0, 17) }...`;
}
return titleWithoutAppName;
diff --git a/packages/trilium-core/src/index.ts b/packages/trilium-core/src/index.ts
index c5b9fa3173..67dde2bfa5 100644
--- a/packages/trilium-core/src/index.ts
+++ b/packages/trilium-core/src/index.ts
@@ -17,6 +17,7 @@ export type { CryptoProvider } from "./services/encryption/crypto";
export { default as becca } from "./becca/becca";
export { default as becca_loader } from "./becca/becca_loader";
+export { default as becca_service } from "./becca/becca_service";
export { default as BAttachment } from "./becca/entities/battachment";
export { default as BAttribute } from "./becca/entities/battribute";
export { default as BBlob } from "./becca/entities/bblob";