diff --git a/LICENSE b/LICENSE
index dbbe35581..4d3c3b627 100644
--- a/LICENSE
+++ b/LICENSE
@@ -643,7 +643,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see .
+ along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
@@ -658,4 +658,4 @@ specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
-.
+.
diff --git a/bin/create-anonymization-script.js b/bin/create-anonymization-script.js
index 4c71d6071..b16a038de 100755
--- a/bin/create-anonymization-script.js
+++ b/bin/create-anonymization-script.js
@@ -1,6 +1,6 @@
#!/usr/bin/env node
-const anonymizationService = require('../src/services/anonymization');
+const anonymizationService = require('../src/services/anonymization.js');
const fs = require('fs');
const path = require('path');
diff --git a/db/migrations/0216__move_content_into_blobs.js b/db/migrations/0216__move_content_into_blobs.js
index 77ab76dfe..d2f7a9f2d 100644
--- a/db/migrations/0216__move_content_into_blobs.js
+++ b/db/migrations/0216__move_content_into_blobs.js
@@ -1,6 +1,6 @@
module.exports = () => {
- const sql = require("../../src/services/sql");
- const utils = require("../../src/services/utils");
+ const sql = require('../../src/services/sql.js');
+ const utils = require('../../src/services/utils.js');
const existingBlobIds = new Set();
diff --git a/db/migrations/0220__migrate_images_to_attachments.js b/db/migrations/0220__migrate_images_to_attachments.js
index 1815a5d46..74e743613 100644
--- a/db/migrations/0220__migrate_images_to_attachments.js
+++ b/db/migrations/0220__migrate_images_to_attachments.js
@@ -1,9 +1,9 @@
module.exports = () => {
- const beccaLoader = require("../../src/becca/becca_loader");
- const becca = require("../../src/becca/becca");
- const cls = require("../../src/services/cls");
- const log = require("../../src/services/log");
- const sql = require("../../src/services/sql");
+ const beccaLoader = require('../../src/becca/becca_loader.js');
+ const becca = require('../../src/becca/becca.js');
+ const cls = require('../../src/services/cls.js');
+ const log = require('../../src/services/log.js');
+ const sql = require('../../src/services/sql.js');
cls.init(() => {
// emergency disabling of image compression since it appears to make problems in migration to 0.61
diff --git a/docker_healthcheck.js b/docker_healthcheck.js
index 586b3a700..f483d7a87 100755
--- a/docker_healthcheck.js
+++ b/docker_healthcheck.js
@@ -1,7 +1,7 @@
const http = require("http");
const ini = require("ini");
const fs = require("fs");
-const dataDir = require("./src/services/data_dir");
+const dataDir = require('./src/services/data_dir.js');
const config = ini.parse(fs.readFileSync(dataDir.CONFIG_INI_PATH, 'utf-8'));
if (config.Network.https) {
@@ -10,8 +10,8 @@ if (config.Network.https) {
process.exit(0);
}
-const port = require('./src/services/port');
-const host = require('./src/services/host');
+const port = require('./src/services/port.js');
+const host = require('./src/services/host.js');
const options = { timeout: 2000 };
diff --git a/dump-db/dump-db.js b/dump-db/dump-db.js
index 2e37486c0..3f9316d06 100755
--- a/dump-db/dump-db.js
+++ b/dump-db/dump-db.js
@@ -2,7 +2,7 @@
const yargs = require('yargs/yargs')
const { hideBin } = require('yargs/helpers')
-const dumpService = require("./inc/dump");
+const dumpService = require('./inc/dump.js');
yargs(hideBin(process.argv))
.command('$0 ', 'dump the contents of document.db into the target directory', (yargs) => {
diff --git a/dump-db/inc/data_key.js b/dump-db/inc/data_key.js
index fe47ddd6f..58d3dd850 100644
--- a/dump-db/inc/data_key.js
+++ b/dump-db/inc/data_key.js
@@ -1,6 +1,6 @@
const crypto = require("crypto");
-const sql = require("./sql");
-const decryptService = require("./decrypt");
+const sql = require('./sql.js');
+const decryptService = require('./decrypt.js');
function getDataKey(password) {
if (!password) {
diff --git a/dump-db/inc/dump.js b/dump-db/inc/dump.js
index 2188a3b58..96fa60f94 100644
--- a/dump-db/inc/dump.js
+++ b/dump-db/inc/dump.js
@@ -1,9 +1,9 @@
const fs = require("fs");
const sanitize = require("sanitize-filename");
-const sql = require("./sql");
-const decryptService = require("./decrypt");
-const dataKeyService = require("./data_key");
-const extensionService = require("./extension");
+const sql = require('./sql.js');
+const decryptService = require('./decrypt.js');
+const dataKeyService = require('./data_key.js');
+const extensionService = require('./extension.js');
function dumpDocument(documentPath, targetPath, options) {
const stats = {
diff --git a/electron.js b/electron.js
index 2de1425a4..7cd04cfb2 100644
--- a/electron.js
+++ b/electron.js
@@ -1,10 +1,10 @@
'use strict';
const {app, globalShortcut, BrowserWindow} = require('electron');
-const sqlInit = require('./src/services/sql_init');
-const appIconService = require('./src/services/app_icon');
-const windowService = require('./src/services/window');
-const tray = require('./src/services/tray');
+const sqlInit = require('./src/services/sql_init.js');
+const appIconService = require('./src/services/app_icon.js');
+const windowService = require('./src/services/window.js');
+const tray = require('./src/services/tray.js');
// Adds debug features like hotkeys for triggering dev tools and reload
require('electron-debug')();
@@ -59,4 +59,4 @@ app.on('will-quit', () => {
// this is to disable electron warning spam in the dev console (local development only)
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true';
-require('./src/www');
+require('./src/www.js');
diff --git a/package-lock.json b/package-lock.json
index aacf5d057..780660fce 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "trilium",
- "version": "0.62.1-beta",
+ "version": "0.62.2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "trilium",
- "version": "0.62.1-beta",
+ "version": "0.62.2",
"hasInstallScript": true,
"license": "AGPL-3.0-only",
"dependencies": {
diff --git a/package.json b/package.json
index 00384c537..8657c2dc9 100644
--- a/package.json
+++ b/package.json
@@ -6,20 +6,20 @@
"license": "AGPL-3.0-only",
"main": "electron.js",
"bin": {
- "trilium": "./src/www"
+ "trilium": "src/www.js"
},
"repository": {
"type": "git",
"url": "https://github.com/zadam/trilium.git"
},
"scripts": {
- "start-server": "cross-env TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 nodemon ./src/www",
- "start-server-no-dir": "cross-env TRILIUM_SAFE_MODE=1 TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 nodemon ./src/www",
- "qstart-server": "npm run qswitch-server && TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 nodemon ./src/www",
+ "start-server": "cross-env TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 nodemon src/www.js",
+ "start-server-no-dir": "cross-env TRILIUM_SAFE_MODE=1 TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 nodemon src/www.js",
+ "qstart-server": "npm run qswitch-server && TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 nodemon src/www.js",
"start-electron": "cross-env TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 TRILIUM_ENV=dev electron --inspect=5858 .",
"start-electron-no-dir": "cross-env TRILIUM_SAFE_MODE=1 TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 electron --inspect=5858 .",
"qstart-electron": "npm run qswitch-electron && TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 TRILIUM_ENV=dev electron --inspect=5858 .",
- "start-test-server": "npm run qswitch-server; rm -rf ./data-test; cross-env TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data-test TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 TRILIUM_ENV=dev TRILIUM_PORT=9999 node ./src/www",
+ "start-test-server": "npm run qswitch-server; rm -rf ./data-test; cross-env TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data-test TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 TRILIUM_ENV=dev TRILIUM_PORT=9999 node src/www.js",
"switch-server": "rm -rf ./node_modules/better-sqlite3 && npm install",
"switch-electron": "./node_modules/.bin/electron-rebuild",
"qswitch-server": "rm -rf ./node_modules/better-sqlite3/bin ; mkdir -p ./node_modules/better-sqlite3/build ; cp ./bin/better-sqlite3/linux-server-better_sqlite3.node ./node_modules/better-sqlite3/build/better_sqlite3.node",
diff --git a/spec/etapi/app_info.js b/spec/etapi/app_info.js
index dff253a5b..fa82fd4dd 100644
--- a/spec/etapi/app_info.js
+++ b/spec/etapi/app_info.js
@@ -1,7 +1,7 @@
const {
describeEtapi, postEtapi,
putEtapiContent
-} = require("../support/etapi");
+} = require('../support/etapi.js');
const {getEtapi} = require("../support/etapi.js");
describeEtapi("app_info", () => {
diff --git a/spec/etapi/backup.js b/spec/etapi/backup.js
index d22625b56..085d0b63e 100644
--- a/spec/etapi/backup.js
+++ b/spec/etapi/backup.js
@@ -1,7 +1,7 @@
const {
describeEtapi, postEtapi,
getEtapi,
-} = require("../support/etapi");
+} = require('../support/etapi.js');
const {putEtapiContent} = require("../support/etapi.js");
describeEtapi("backup", () => {
diff --git a/spec/etapi/import.js b/spec/etapi/import.js
index 45db2890b..82f0e001d 100644
--- a/spec/etapi/import.js
+++ b/spec/etapi/import.js
@@ -1,7 +1,7 @@
const {
describeEtapi, postEtapi,
postEtapiContent,
-} = require("../support/etapi");
+} = require('../support/etapi.js');
const fs = require("fs");
const path = require("path");
const {getEtapiContent} = require("../support/etapi.js");
diff --git a/spec/etapi/notes.js b/spec/etapi/notes.js
index f63acee0a..c15033ca8 100644
--- a/spec/etapi/notes.js
+++ b/spec/etapi/notes.js
@@ -7,7 +7,7 @@ const {
getEtapiContent,
patchEtapi, putEtapi,
putEtapiContent
-} = require("../support/etapi");
+} = require('../support/etapi.js');
describeEtapi("notes", () => {
it("create", async () => {
diff --git a/spec/search/becca_mocking.js b/spec/search/becca_mocking.js
index 867e22ac6..428db5bbd 100644
--- a/spec/search/becca_mocking.js
+++ b/spec/search/becca_mocking.js
@@ -1,7 +1,7 @@
-const BNote = require('../../src/becca/entities/bnote');
-const BBranch = require('../../src/becca/entities/bbranch');
-const BAttribute = require('../../src/becca/entities/battribute');
-const becca = require('../../src/becca/becca');
+const BNote = require('../../src/becca/entities/bnote.js');
+const BBranch = require('../../src/becca/entities/bbranch.js');
+const BAttribute = require('../../src/becca/entities/battribute.js');
+const becca = require('../../src/becca/becca.js');
const randtoken = require('rand-token').generator({source: 'crypto'});
/** @returns {BNote} */
diff --git a/spec/search/lexer.spec.js b/spec/search/lexer.spec.js
index 1533bf56a..20221e9a0 100644
--- a/spec/search/lexer.spec.js
+++ b/spec/search/lexer.spec.js
@@ -1,4 +1,4 @@
-const lex = require('../../src/services/search/services/lex');
+const lex = require('../../src/services/search/services/lex.js');
describe("Lexer fulltext", () => {
it("simple lexing", () => {
diff --git a/spec/search/parens.spec.js b/spec/search/parens.spec.js
index ae1ac5b2f..d79cfd6ea 100644
--- a/spec/search/parens.spec.js
+++ b/spec/search/parens.spec.js
@@ -1,4 +1,4 @@
-const handleParens = require('../../src/services/search/services/handle_parens');
+const handleParens = require('../../src/services/search/services/handle_parens.js');
describe("Parens handler", () => {
it("handles parens", () => {
diff --git a/spec/search/parser.spec.js b/spec/search/parser.spec.js
index fd1e66437..000948d47 100644
--- a/spec/search/parser.spec.js
+++ b/spec/search/parser.spec.js
@@ -1,5 +1,5 @@
-const SearchContext = require("../../src/services/search/search_context");
-const parse = require('../../src/services/search/services/parse');
+const SearchContext = require('../../src/services/search/search_context.js');
+const parse = require('../../src/services/search/services/parse.js');
function tokens(toks, cur = 0) {
return toks.map(arg => {
diff --git a/spec/search/search.spec.js b/spec/search/search.spec.js
index b4ff76c3a..97b607afd 100644
--- a/spec/search/search.spec.js
+++ b/spec/search/search.spec.js
@@ -1,10 +1,10 @@
-const searchService = require('../../src/services/search/services/search');
-const BNote = require('../../src/becca/entities/bnote');
-const BBranch = require('../../src/becca/entities/bbranch');
-const SearchContext = require('../../src/services/search/search_context');
-const dateUtils = require('../../src/services/date_utils');
-const becca = require('../../src/becca/becca');
-const {NoteBuilder, findNoteByTitle, note} = require('./becca_mocking');
+const searchService = require('../../src/services/search/services/search.js');
+const BNote = require('../../src/becca/entities/bnote.js');
+const BBranch = require('../../src/becca/entities/bbranch.js');
+const SearchContext = require('../../src/services/search/search_context.js');
+const dateUtils = require('../../src/services/date_utils.js');
+const becca = require('../../src/becca/becca.js');
+const {NoteBuilder, findNoteByTitle, note} = require('./becca_mocking.js');
describe("Search", () => {
let rootNote;
diff --git a/spec/search/value_extractor.spec.js b/spec/search/value_extractor.spec.js
index 04fe3c303..4e05380c2 100644
--- a/spec/search/value_extractor.spec.js
+++ b/spec/search/value_extractor.spec.js
@@ -1,7 +1,7 @@
-const {note} = require('./becca_mocking');
-const ValueExtractor = require('../../src/services/search/value_extractor');
-const becca = require('../../src/becca/becca');
-const SearchContext = require("../../src/services/search/search_context");
+const {note} = require('./becca_mocking.js');
+const ValueExtractor = require('../../src/services/search/value_extractor.js');
+const becca = require('../../src/becca/becca.js');
+const SearchContext = require('../../src/services/search/search_context.js');
const dsc = new SearchContext();
diff --git a/src/anonymize.js b/src/anonymize.js
index 0fa00cda1..5099b32b0 100644
--- a/src/anonymize.js
+++ b/src/anonymize.js
@@ -1,6 +1,6 @@
-const anonymizationService = require('./services/anonymization');
-const sqlInit = require('./services/sql_init');
-require('./becca/entity_constructor');
+const anonymizationService = require('./services/anonymization.js');
+const sqlInit = require('./services/sql_init.js');
+require('./becca/entity_constructor.js');
sqlInit.dbReady.then(async () => {
try {
diff --git a/src/app.js b/src/app.js
index dc3adb7e8..45451f0cc 100644
--- a/src/app.js
+++ b/src/app.js
@@ -4,11 +4,11 @@ const favicon = require('serve-favicon');
const cookieParser = require('cookie-parser');
const helmet = require('helmet');
const compression = require('compression');
-const sessionParser = require('./routes/session_parser');
-const utils = require('./services/utils');
+const sessionParser = require('./routes/session_parser.js');
+const utils = require('./services/utils.js');
-require('./services/handlers');
-require('./becca/becca_loader');
+require('./services/handlers.js');
+require('./becca/becca_loader.js');
const app = express();
@@ -37,21 +37,21 @@ app.use(`/robots.txt`, express.static(path.join(__dirname, 'public/robots.txt'))
app.use(sessionParser);
app.use(favicon(`${__dirname}/../images/app-icons/win/icon.ico`));
-require('./routes/assets').register(app);
-require('./routes/routes').register(app);
-require('./routes/custom').register(app);
-require('./routes/error_handlers').register(app);
+require('./routes/assets.js').register(app);
+require('./routes/routes.js').register(app);
+require('./routes/custom.js').register(app);
+require('./routes/error_handlers.js').register(app);
// triggers sync timer
-require('./services/sync');
+require('./services/sync.js');
// triggers backup timer
-require('./services/backup');
+require('./services/backup.js');
// trigger consistency checks timer
-require('./services/consistency_checks');
+require('./services/consistency_checks.js');
-require('./services/scheduler');
+require('./services/scheduler.js');
if (utils.isElectron()) {
require('@electron/remote/main').initialize();
diff --git a/src/becca/becca.js b/src/becca/becca.js
index 4b08b7706..d1e7c333e 100644
--- a/src/becca/becca.js
+++ b/src/becca/becca.js
@@ -1,8 +1,8 @@
"use strict";
-const sql = require("../services/sql");
-const NoteSet = require("../services/search/note_set");
-const NotFoundError = require("../errors/not_found_error");
+const sql = require('../services/sql.js');
+const NoteSet = require('../services/search/note_set.js');
+const NotFoundError = require('../errors/not_found_error.js');
/**
* Becca is a backend cache of all notes, branches, and attributes.
@@ -148,7 +148,7 @@ class Becca {
getRevision(revisionId) {
const row = sql.getRow("SELECT * FROM revisions WHERE revisionId = ?", [revisionId]);
- const BRevision = require("./entities/brevision"); // avoiding circular dependency problems
+ const BRevision = require('./entities/brevision.js'); // avoiding circular dependency problems
return row ? new BRevision(row) : null;
}
@@ -163,7 +163,7 @@ class Becca {
WHERE attachmentId = ? AND isDeleted = 0`
: `SELECT * FROM attachments WHERE attachmentId = ? AND isDeleted = 0`;
- const BAttachment = require("./entities/battachment"); // avoiding circular dependency problems
+ const BAttachment = require('./entities/battachment.js'); // avoiding circular dependency problems
return sql.getRows(query, [attachmentId])
.map(row => new BAttachment(row))[0];
@@ -180,7 +180,7 @@ class Becca {
/** @returns {BAttachment[]} */
getAttachments(attachmentIds) {
- const BAttachment = require("./entities/battachment"); // avoiding circular dependency problems
+ const BAttachment = require('./entities/battachment.js'); // avoiding circular dependency problems
return sql.getManyRows("SELECT * FROM attachments WHERE attachmentId IN (???) AND isDeleted = 0", attachmentIds)
.map(row => new BAttachment(row));
}
@@ -189,7 +189,7 @@ class Becca {
getBlob(entity) {
const row = sql.getRow("SELECT *, LENGTH(content) AS contentLength FROM blobs WHERE blobId = ?", [entity.blobId]);
- const BBlob = require("./entities/bblob"); // avoiding circular dependency problems
+ const BBlob = require('./entities/bblob.js'); // avoiding circular dependency problems
return row ? new BBlob(row) : null;
}
@@ -238,7 +238,7 @@ class Becca {
getRecentNotesFromQuery(query, params = []) {
const rows = sql.getRows(query, params);
- const BRecentNote = require("./entities/brecent_note"); // avoiding circular dependency problems
+ const BRecentNote = require('./entities/brecent_note.js'); // avoiding circular dependency problems
return rows.map(row => new BRecentNote(row));
}
@@ -246,7 +246,7 @@ class Becca {
getRevisionsFromQuery(query, params = []) {
const rows = sql.getRows(query, params);
- const BRevision = require("./entities/brevision"); // avoiding circular dependency problems
+ const BRevision = require('./entities/brevision.js'); // avoiding circular dependency problems
return rows.map(row => new BRevision(row));
}
diff --git a/src/becca/becca_loader.js b/src/becca/becca_loader.js
index 5c5ae8eb4..5d6ce6f06 100644
--- a/src/becca/becca_loader.js
+++ b/src/becca/becca_loader.js
@@ -1,24 +1,24 @@
"use strict";
-const sql = require('../services/sql');
-const eventService = require('../services/events');
-const becca = require('./becca');
-const sqlInit = require('../services/sql_init');
-const log = require('../services/log');
-const BNote = require('./entities/bnote');
-const BBranch = require('./entities/bbranch');
-const BAttribute = require('./entities/battribute');
-const BOption = require('./entities/boption');
-const BEtapiToken = require("./entities/betapi_token");
-const cls = require("../services/cls");
-const entityConstructor = require("../becca/entity_constructor");
+const sql = require('../services/sql.js');
+const eventService = require('../services/events.js');
+const becca = require('./becca.js');
+const sqlInit = require('../services/sql_init.js');
+const log = require('../services/log.js');
+const BNote = require('./entities/bnote.js');
+const BBranch = require('./entities/bbranch.js');
+const BAttribute = require('./entities/battribute.js');
+const BOption = require('./entities/boption.js');
+const BEtapiToken = require('./entities/betapi_token.js');
+const cls = require('../services/cls.js');
+const entityConstructor = require('../becca/entity_constructor.js');
const beccaLoaded = new Promise((res, rej) => {
sqlInit.dbReady.then(() => {
cls.init(() => {
load();
- require('../services/options_init').initStartupOptions();
+ require('../services/options_init.js').initStartupOptions();
res();
});
@@ -71,7 +71,7 @@ function load() {
function reload(reason) {
load();
- require('../services/ws').reloadFrontend(reason || "becca reloaded");
+ require('../services/ws.js').reloadFrontend(reason || "becca reloaded");
}
eventService.subscribeBeccaLoader([eventService.ENTITY_CHANGE_SYNCED], ({entityName, entityRow}) => {
diff --git a/src/becca/becca_service.js b/src/becca/becca_service.js
index 15a1c07cc..0ac5c2591 100644
--- a/src/becca/becca_service.js
+++ b/src/becca/becca_service.js
@@ -1,8 +1,8 @@
"use strict";
-const becca = require('./becca');
-const cls = require('../services/cls');
-const log = require('../services/log');
+const becca = require('./becca.js');
+const cls = require('../services/cls.js');
+const log = require('../services/log.js');
function isNotePathArchived(notePath) {
const noteId = notePath[notePath.length - 1];
diff --git a/src/becca/entities/abstract_becca_entity.js b/src/becca/entities/abstract_becca_entity.js
index 037f935d6..3b2e6331b 100644
--- a/src/becca/entities/abstract_becca_entity.js
+++ b/src/becca/entities/abstract_becca_entity.js
@@ -1,14 +1,14 @@
"use strict";
-const utils = require('../../services/utils');
-const sql = require('../../services/sql');
-const entityChangesService = require('../../services/entity_changes');
-const eventService = require("../../services/events");
-const dateUtils = require("../../services/date_utils");
-const cls = require("../../services/cls");
-const log = require("../../services/log");
-const protectedSessionService = require("../../services/protected_session");
-const blobService = require("../../services/blob");
+const utils = require('../../services/utils.js');
+const sql = require('../../services/sql.js');
+const entityChangesService = require('../../services/entity_changes.js');
+const eventService = require('../../services/events.js');
+const dateUtils = require('../../services/date_utils.js');
+const cls = require('../../services/cls.js');
+const log = require('../../services/log.js');
+const protectedSessionService = require('../../services/protected_session.js');
+const blobService = require('../../services/blob.js');
let becca = null;
@@ -34,7 +34,7 @@ class AbstractBeccaEntity {
*/
get becca() {
if (!becca) {
- becca = require('../becca');
+ becca = require('../becca.js');
}
return becca;
diff --git a/src/becca/entities/battachment.js b/src/becca/entities/battachment.js
index 6e6e2efca..e3e77974d 100644
--- a/src/becca/entities/battachment.js
+++ b/src/becca/entities/battachment.js
@@ -1,11 +1,11 @@
"use strict";
-const utils = require('../../services/utils');
-const dateUtils = require('../../services/date_utils');
-const AbstractBeccaEntity = require("./abstract_becca_entity");
-const sql = require("../../services/sql");
-const protectedSessionService = require("../../services/protected_session");
-const log = require("../../services/log");
+const utils = require('../../services/utils.js');
+const dateUtils = require('../../services/date_utils.js');
+const AbstractBeccaEntity = require('./abstract_becca_entity.js');
+const sql = require('../../services/sql.js');
+const protectedSessionService = require('../../services/protected_session.js');
+const log = require('../../services/log.js');
const attachmentRoleToNoteTypeMapping = {
'image': 'image'
@@ -37,7 +37,7 @@ class BAttachment extends AbstractBeccaEntity {
/** @type {string} */
this.attachmentId = row.attachmentId;
- /**
+ /**
* either noteId or revisionId to which this attachment belongs
* @type {string}
*/
@@ -153,7 +153,7 @@ class BAttachment extends AbstractBeccaEntity {
throw new Error(`Cannot convert protected attachment outside of protected session`);
}
- const noteService = require('../../services/notes');
+ const noteService = require('../../services/notes.js');
const { note, branch } = noteService.createNewNote({
parentNoteId: this.ownerId,
diff --git a/src/becca/entities/battribute.js b/src/becca/entities/battribute.js
index d09020269..55e7db66d 100644
--- a/src/becca/entities/battribute.js
+++ b/src/becca/entities/battribute.js
@@ -1,11 +1,11 @@
"use strict";
-const BNote = require('./bnote');
-const AbstractBeccaEntity = require("./abstract_becca_entity");
-const sql = require("../../services/sql");
-const dateUtils = require("../../services/date_utils");
-const promotedAttributeDefinitionParser = require("../../services/promoted_attribute_definition_parser");
-const {sanitizeAttributeName} = require("../../services/sanitize_attribute_name");
+const BNote = require('./bnote.js');
+const AbstractBeccaEntity = require('./abstract_becca_entity.js');
+const sql = require('../../services/sql.js');
+const dateUtils = require('../../services/date_utils.js');
+const promotedAttributeDefinitionParser = require('../../services/promoted_attribute_definition_parser.js');
+const {sanitizeAttributeName} = require('../../services/sanitize_attribute_name.js');
/**
diff --git a/src/becca/entities/bbranch.js b/src/becca/entities/bbranch.js
index 24d2cea79..94cc1b802 100644
--- a/src/becca/entities/bbranch.js
+++ b/src/becca/entities/bbranch.js
@@ -1,12 +1,12 @@
"use strict";
-const BNote = require('./bnote');
-const AbstractBeccaEntity = require("./abstract_becca_entity");
-const dateUtils = require("../../services/date_utils");
-const utils = require("../../services/utils");
-const TaskContext = require("../../services/task_context");
-const cls = require("../../services/cls");
-const log = require("../../services/log");
+const BNote = require('./bnote.js');
+const AbstractBeccaEntity = require('./abstract_becca_entity.js');
+const dateUtils = require('../../services/date_utils.js');
+const utils = require('../../services/utils.js');
+const TaskContext = require('../../services/task_context.js');
+const cls = require('../../services/cls.js');
+const log = require('../../services/log.js');
/**
* Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple
@@ -161,7 +161,7 @@ class BBranch extends AbstractBeccaEntity {
if (parentBranches.length === 1 && parentBranches[0] === this) {
// needs to be run before branches and attributes are deleted and thus attached relations disappear
- const handlers = require("../../services/handlers");
+ const handlers = require('../../services/handlers.js');
handlers.runAttachedRelations(note, 'runOnNoteDeletion', note);
}
}
diff --git a/src/becca/entities/betapi_token.js b/src/becca/entities/betapi_token.js
index 05aae9c92..0fded9e63 100644
--- a/src/becca/entities/betapi_token.js
+++ b/src/becca/entities/betapi_token.js
@@ -1,7 +1,7 @@
"use strict";
-const dateUtils = require('../../services/date_utils');
-const AbstractBeccaEntity = require("./abstract_becca_entity");
+const dateUtils = require('../../services/date_utils.js');
+const AbstractBeccaEntity = require('./abstract_becca_entity.js');
/**
* EtapiToken is an entity representing token used to authenticate against Trilium REST API from client applications.
diff --git a/src/becca/entities/bnote.js b/src/becca/entities/bnote.js
index 6886a170d..36f8ed3d4 100644
--- a/src/becca/entities/bnote.js
+++ b/src/becca/entities/bnote.js
@@ -1,17 +1,17 @@
"use strict";
-const protectedSessionService = require('../../services/protected_session');
-const log = require('../../services/log');
-const sql = require('../../services/sql');
-const utils = require('../../services/utils');
-const dateUtils = require('../../services/date_utils');
-const AbstractBeccaEntity = require("./abstract_becca_entity");
-const BRevision = require("./brevision");
-const BAttachment = require("./battachment");
-const TaskContext = require("../../services/task_context");
+const protectedSessionService = require('../../services/protected_session.js');
+const log = require('../../services/log.js');
+const sql = require('../../services/sql.js');
+const utils = require('../../services/utils.js');
+const dateUtils = require('../../services/date_utils.js');
+const AbstractBeccaEntity = require('./abstract_becca_entity.js');
+const BRevision = require('./brevision.js');
+const BAttachment = require('./battachment.js');
+const TaskContext = require('../../services/task_context.js');
const dayjs = require("dayjs");
const utc = require('dayjs/plugin/utc');
-const eventService = require("../../services/events");
+const eventService = require('../../services/events.js');
dayjs.extend(utc);
const LABEL = 'label';
@@ -903,7 +903,7 @@ class BNote extends AbstractBeccaEntity {
}
try {
- const searchService = require("../../services/search/services/search");
+ const searchService = require('../../services/search/services/search.js');
const {searchResultNoteIds} = searchService.searchFromNote(this);
const becca = this.becca;
@@ -1303,7 +1303,7 @@ class BNote extends AbstractBeccaEntity {
}
}
else {
- const BAttribute = require("./battribute");
+ const BAttribute = require('./battribute.js');
new BAttribute({
noteId: this.noteId,
@@ -1343,7 +1343,7 @@ class BNote extends AbstractBeccaEntity {
* @returns {BAttribute}
*/
addAttribute(type, name, value = "", isInheritable = false, position = null) {
- const BAttribute = require("./battribute");
+ const BAttribute = require('./battribute.js');
return new BAttribute({
noteId: this.noteId,
@@ -1448,7 +1448,7 @@ class BNote extends AbstractBeccaEntity {
removeRelation(name, value) { return this.removeAttribute(RELATION, name, value); }
searchNotesInSubtree(searchString) {
- const searchService = require("../../services/search/services/search");
+ const searchService = require('../../services/search/services/search.js');
return searchService.searchNotes(searchString);
}
@@ -1462,7 +1462,7 @@ class BNote extends AbstractBeccaEntity {
* @returns {{success: boolean, message: string, branchId: string, notePath: string}}
*/
cloneTo(parentNoteId) {
- const cloningService = require("../../services/cloning");
+ const cloningService = require('../../services/cloning.js');
const branch = this.becca.getNote(parentNoteId).getParentBranches()[0];
@@ -1537,7 +1537,7 @@ class BNote extends AbstractBeccaEntity {
parentNote.setContent(fixedContent);
- const noteService = require("../../services/notes");
+ const noteService = require('../../services/notes.js');
noteService.asyncPostProcessContent(parentNote, fixedContent); // to mark an unused attachment for deletion
this.deleteNote();
@@ -1565,7 +1565,7 @@ class BNote extends AbstractBeccaEntity {
}
// needs to be run before branches and attributes are deleted and thus attached relations disappear
- const handlers = require("../../services/handlers");
+ const handlers = require('../../services/handlers.js');
handlers.runAttachedRelations(this, 'runOnNoteDeletion', this);
taskContext.noteDeletionHandlerTriggered = true;
diff --git a/src/becca/entities/boption.js b/src/becca/entities/boption.js
index 1d876e6a2..6c2c3edab 100644
--- a/src/becca/entities/boption.js
+++ b/src/becca/entities/boption.js
@@ -1,7 +1,7 @@
"use strict";
-const dateUtils = require('../../services/date_utils');
-const AbstractBeccaEntity = require("./abstract_becca_entity");
+const dateUtils = require('../../services/date_utils.js');
+const AbstractBeccaEntity = require('./abstract_becca_entity.js');
/**
* Option represents a name-value pair, either directly configurable by the user or some system property.
diff --git a/src/becca/entities/brecent_note.js b/src/becca/entities/brecent_note.js
index b2e1c3ba4..300945b9a 100644
--- a/src/becca/entities/brecent_note.js
+++ b/src/becca/entities/brecent_note.js
@@ -1,7 +1,7 @@
"use strict";
-const dateUtils = require('../../services/date_utils');
-const AbstractBeccaEntity = require("./abstract_becca_entity");
+const dateUtils = require('../../services/date_utils.js');
+const AbstractBeccaEntity = require('./abstract_becca_entity.js');
/**
* RecentNote represents recently visited note.
diff --git a/src/becca/entities/brevision.js b/src/becca/entities/brevision.js
index de9bfbd82..841ecaaee 100644
--- a/src/becca/entities/brevision.js
+++ b/src/becca/entities/brevision.js
@@ -1,12 +1,12 @@
"use strict";
-const protectedSessionService = require('../../services/protected_session');
-const utils = require('../../services/utils');
-const dateUtils = require('../../services/date_utils');
-const becca = require('../becca');
-const AbstractBeccaEntity = require("./abstract_becca_entity");
-const sql = require("../../services/sql");
-const BAttachment = require("./battachment");
+const protectedSessionService = require('../../services/protected_session.js');
+const utils = require('../../services/utils.js');
+const dateUtils = require('../../services/date_utils.js');
+const becca = require('../becca.js');
+const AbstractBeccaEntity = require('./abstract_becca_entity.js');
+const sql = require('../../services/sql.js');
+const BAttachment = require('./battachment.js');
/**
* Revision represents a snapshot of note's title and content at some point in the past.
diff --git a/src/becca/entity_constructor.js b/src/becca/entity_constructor.js
index 287a5fd81..3d66ed4da 100644
--- a/src/becca/entity_constructor.js
+++ b/src/becca/entity_constructor.js
@@ -1,12 +1,12 @@
-const BAttachment = require("./entities/battachment");
-const BAttribute = require('./entities/battribute');
-const BBlob = require("./entities/bblob");
-const BBranch = require('./entities/bbranch');
-const BEtapiToken = require('./entities/betapi_token');
-const BNote = require('./entities/bnote');
-const BOption = require('./entities/boption');
-const BRecentNote = require('./entities/brecent_note');
-const BRevision = require('./entities/brevision');
+const BAttachment = require('./entities/battachment.js');
+const BAttribute = require('./entities/battribute.js');
+const BBlob = require('./entities/bblob.js');
+const BBranch = require('./entities/bbranch.js');
+const BEtapiToken = require('./entities/betapi_token.js');
+const BNote = require('./entities/bnote.js');
+const BOption = require('./entities/boption.js');
+const BRecentNote = require('./entities/brecent_note.js');
+const BRevision = require('./entities/brevision.js');
const ENTITY_NAME_TO_ENTITY = {
"attachments": BAttachment,
diff --git a/src/becca/similarity.js b/src/becca/similarity.js
index b0ed39e13..5be56804d 100644
--- a/src/becca/similarity.js
+++ b/src/becca/similarity.js
@@ -1,7 +1,7 @@
-const becca = require('./becca');
-const log = require('../services/log');
-const beccaService = require('./becca_service');
-const dateUtils = require('../services/date_utils');
+const becca = require('./becca.js');
+const log = require('../services/log.js');
+const beccaService = require('./becca_service.js');
+const dateUtils = require('../services/date_utils.js');
const {JSDOM} = require("jsdom");
const DEBUG = false;
@@ -35,7 +35,7 @@ const IGNORED_ATTR_NAMES = [
function filterUrlValue(value) {
return value
.replace(/https?:\/\//ig, "")
- .replace(/www\./ig, "")
+ .replace(/www.js\./ig, "")
.replace(/(\.net|\.com|\.org|\.info|\.edu)/ig, "");
}
diff --git a/src/etapi/app_info.js b/src/etapi/app_info.js
index 3dc4481ac..f82287170 100644
--- a/src/etapi/app_info.js
+++ b/src/etapi/app_info.js
@@ -1,5 +1,5 @@
-const appInfo = require('../services/app_info');
-const eu = require("./etapi_utils");
+const appInfo = require('../services/app_info.js');
+const eu = require('./etapi_utils.js');
function register(router) {
eu.route(router, 'get', '/etapi/app-info', (req, res, next) => {
diff --git a/src/etapi/attachments.js b/src/etapi/attachments.js
index 64fbb9964..586da7a21 100644
--- a/src/etapi/attachments.js
+++ b/src/etapi/attachments.js
@@ -1,8 +1,8 @@
-const becca = require("../becca/becca");
-const eu = require("./etapi_utils");
-const mappers = require("./mappers");
-const v = require("./validators");
-const utils = require("../services/utils");
+const becca = require('../becca/becca.js');
+const eu = require('./etapi_utils.js');
+const mappers = require('./mappers.js');
+const v = require('./validators.js');
+const utils = require('../services/utils.js');
function register(router) {
const ALLOWED_PROPERTIES_FOR_CREATE_ATTACHMENT = {
diff --git a/src/etapi/attributes.js b/src/etapi/attributes.js
index 1ecd42888..131e85ae8 100644
--- a/src/etapi/attributes.js
+++ b/src/etapi/attributes.js
@@ -1,8 +1,8 @@
-const becca = require("../becca/becca");
-const eu = require("./etapi_utils");
-const mappers = require("./mappers");
-const attributeService = require("../services/attributes");
-const v = require("./validators");
+const becca = require('../becca/becca.js');
+const eu = require('./etapi_utils.js');
+const mappers = require('./mappers.js');
+const attributeService = require('../services/attributes.js');
+const v = require('./validators.js');
function register(router) {
eu.route(router, 'get', '/etapi/attributes/:attributeId', (req, res, next) => {
diff --git a/src/etapi/auth.js b/src/etapi/auth.js
index 7f25bbe46..96e4e2fa0 100644
--- a/src/etapi/auth.js
+++ b/src/etapi/auth.js
@@ -1,7 +1,7 @@
-const becca = require("../becca/becca");
-const eu = require("./etapi_utils");
-const passwordEncryptionService = require("../services/encryption/password_encryption");
-const etapiTokenService = require("../services/etapi_tokens");
+const becca = require('../becca/becca.js');
+const eu = require('./etapi_utils.js');
+const passwordEncryptionService = require('../services/encryption/password_encryption.js');
+const etapiTokenService = require('../services/etapi_tokens.js');
function register(router, loginMiddleware) {
eu.NOT_AUTHENTICATED_ROUTE(router, 'post', '/etapi/auth/login', loginMiddleware, (req, res, next) => {
diff --git a/src/etapi/backup.js b/src/etapi/backup.js
index 8dc7f8ed1..b9ca75204 100644
--- a/src/etapi/backup.js
+++ b/src/etapi/backup.js
@@ -1,5 +1,5 @@
-const eu = require("./etapi_utils");
-const backupService = require("../services/backup");
+const eu = require('./etapi_utils.js');
+const backupService = require('../services/backup.js');
function register(router) {
eu.route(router, 'put', '/etapi/backup/:backupName', async (req, res, next) => {
diff --git a/src/etapi/branches.js b/src/etapi/branches.js
index a0141bd40..1d11144f9 100644
--- a/src/etapi/branches.js
+++ b/src/etapi/branches.js
@@ -1,9 +1,9 @@
-const becca = require("../becca/becca");
-const eu = require("./etapi_utils");
-const mappers = require("./mappers");
-const BBranch = require("../becca/entities/bbranch");
-const entityChangesService = require("../services/entity_changes");
-const v = require("./validators");
+const becca = require('../becca/becca.js');
+const eu = require('./etapi_utils.js');
+const mappers = require('./mappers.js');
+const BBranch = require('../becca/entities/bbranch.js');
+const entityChangesService = require('../services/entity_changes.js');
+const v = require('./validators.js');
function register(router) {
eu.route(router, 'get', '/etapi/branches/:branchId', (req, res, next) => {
diff --git a/src/etapi/etapi_utils.js b/src/etapi/etapi_utils.js
index 64dc77191..d3699b664 100644
--- a/src/etapi/etapi_utils.js
+++ b/src/etapi/etapi_utils.js
@@ -1,9 +1,9 @@
-const cls = require("../services/cls");
-const sql = require("../services/sql");
-const log = require("../services/log");
-const becca = require("../becca/becca");
-const etapiTokenService = require("../services/etapi_tokens");
-const config = require("../services/config");
+const cls = require('../services/cls.js');
+const sql = require('../services/sql.js');
+const log = require('../services/log.js');
+const becca = require('../becca/becca.js');
+const etapiTokenService = require('../services/etapi_tokens.js');
+const config = require('../services/config.js');
const GENERIC_CODE = "GENERIC";
const noAuthentication = config.General && config.General.noAuthentication === true;
diff --git a/src/etapi/notes.js b/src/etapi/notes.js
index dcd0c6504..69c00e795 100644
--- a/src/etapi/notes.js
+++ b/src/etapi/notes.js
@@ -1,14 +1,14 @@
-const becca = require("../becca/becca");
-const utils = require("../services/utils");
-const eu = require("./etapi_utils");
-const mappers = require("./mappers");
-const noteService = require("../services/notes");
-const TaskContext = require("../services/task_context");
-const v = require("./validators");
-const searchService = require("../services/search/services/search");
-const SearchContext = require("../services/search/search_context");
-const zipExportService = require("../services/export/zip");
-const zipImportService = require("../services/import/zip");
+const becca = require('../becca/becca.js');
+const utils = require('../services/utils.js');
+const eu = require('./etapi_utils.js');
+const mappers = require('./mappers.js');
+const noteService = require('../services/notes.js');
+const TaskContext = require('../services/task_context.js');
+const v = require('./validators.js');
+const searchService = require('../services/search/services/search.js');
+const SearchContext = require('../services/search/search_context.js');
+const zipExportService = require('../services/export/zip.js');
+const zipImportService = require('../services/import/zip.js');
function register(router) {
eu.route(router, 'get', '/etapi/notes', (req, res, next) => {
diff --git a/src/etapi/special_notes.js b/src/etapi/special_notes.js
index 7e1e2a6f5..64f97d07b 100644
--- a/src/etapi/special_notes.js
+++ b/src/etapi/special_notes.js
@@ -1,7 +1,7 @@
-const specialNotesService = require("../services/special_notes");
-const dateNotesService = require("../services/date_notes");
-const eu = require("./etapi_utils");
-const mappers = require("./mappers");
+const specialNotesService = require('../services/special_notes.js');
+const dateNotesService = require('../services/date_notes.js');
+const eu = require('./etapi_utils.js');
+const mappers = require('./mappers.js');
const getDateInvalidError = date => new eu.EtapiError(400, "DATE_INVALID", `Date "${date}" is not valid.`);
const getMonthInvalidError = month => new eu.EtapiError(400, "MONTH_INVALID", `Month "${month}" is not valid.`);
@@ -74,4 +74,4 @@ function register(router) {
module.exports = {
register
-};
\ No newline at end of file
+};
diff --git a/src/etapi/validators.js b/src/etapi/validators.js
index 343812600..44128b812 100644
--- a/src/etapi/validators.js
+++ b/src/etapi/validators.js
@@ -1,5 +1,5 @@
-const noteTypeService = require("../services/note_types");
-const dateUtils = require("../services/date_utils");
+const noteTypeService = require('../services/note_types.js');
+const dateUtils = require('../services/date_utils.js');
function mandatory(obj) {
if (obj === undefined ) {
@@ -64,7 +64,7 @@ function isNoteId(obj) {
return;
}
- const becca = require('../becca/becca');
+ const becca = require('../becca/becca.js');
if (typeof obj !== 'string') {
return `'${obj}' is not a valid noteId`;
diff --git a/src/routes/api/app_info.js b/src/routes/api/app_info.js
index aec592909..cb1996656 100644
--- a/src/routes/api/app_info.js
+++ b/src/routes/api/app_info.js
@@ -1,6 +1,6 @@
"use strict";
-const appInfo = require('../../services/app_info');
+const appInfo = require('../../services/app_info.js');
function getAppInfo() {
return appInfo;
diff --git a/src/routes/api/attachments.js b/src/routes/api/attachments.js
index 0e3b6056d..7862534a7 100644
--- a/src/routes/api/attachments.js
+++ b/src/routes/api/attachments.js
@@ -1,6 +1,6 @@
-const becca = require("../../becca/becca");
-const blobService = require("../../services/blob");
-const ValidationError = require("../../errors/validation_error");
+const becca = require('../../becca/becca.js');
+const blobService = require('../../services/blob.js');
+const ValidationError = require('../../errors/validation_error.js');
const imageService = require("../../services/image.js");
function getAttachmentBlob(req) {
diff --git a/src/routes/api/attributes.js b/src/routes/api/attributes.js
index 978cec67a..0d9b541f1 100644
--- a/src/routes/api/attributes.js
+++ b/src/routes/api/attributes.js
@@ -1,11 +1,11 @@
"use strict";
-const sql = require('../../services/sql');
-const log = require('../../services/log');
-const attributeService = require('../../services/attributes');
-const BAttribute = require('../../becca/entities/battribute');
-const becca = require("../../becca/becca");
-const ValidationError = require("../../errors/validation_error");
+const sql = require('../../services/sql.js');
+const log = require('../../services/log.js');
+const attributeService = require('../../services/attributes.js');
+const BAttribute = require('../../becca/entities/battribute.js');
+const becca = require('../../becca/becca.js');
+const ValidationError = require('../../errors/validation_error.js');
function getEffectiveNoteAttributes(req) {
const note = becca.getNote(req.params.noteId);
diff --git a/src/routes/api/autocomplete.js b/src/routes/api/autocomplete.js
index 31da671b3..4fe35a564 100644
--- a/src/routes/api/autocomplete.js
+++ b/src/routes/api/autocomplete.js
@@ -1,11 +1,11 @@
"use strict";
-const beccaService = require('../../becca/becca_service');
-const searchService = require('../../services/search/services/search');
-const log = require('../../services/log');
-const utils = require('../../services/utils');
-const cls = require('../../services/cls');
-const becca = require("../../becca/becca");
+const beccaService = require('../../becca/becca_service.js');
+const searchService = require('../../services/search/services/search.js');
+const log = require('../../services/log.js');
+const utils = require('../../services/utils.js');
+const cls = require('../../services/cls.js');
+const becca = require('../../becca/becca.js');
function getAutocomplete(req) {
const query = req.query.query.trim();
diff --git a/src/routes/api/backend_log.js b/src/routes/api/backend_log.js
index 4a07a219e..51d0cc6a6 100644
--- a/src/routes/api/backend_log.js
+++ b/src/routes/api/backend_log.js
@@ -1,8 +1,8 @@
"use strict";
const fs = require('fs');
-const dateUtils = require('../../services/date_utils');
-const {LOG_DIR} = require('../../services/data_dir');
+const dateUtils = require('../../services/date_utils.js');
+const {LOG_DIR} = require('../../services/data_dir.js');
function getBackendLog() {
const file = `${LOG_DIR}/trilium-${dateUtils.localNowDate()}.log`;
diff --git a/src/routes/api/branches.js b/src/routes/api/branches.js
index 3e9ed60b0..17f11cd01 100644
--- a/src/routes/api/branches.js
+++ b/src/routes/api/branches.js
@@ -1,15 +1,15 @@
"use strict";
-const sql = require('../../services/sql');
-const utils = require('../../services/utils');
-const entityChangesService = require('../../services/entity_changes');
-const treeService = require('../../services/tree');
-const eraseService = require('../../services/erase');
-const becca = require('../../becca/becca');
-const TaskContext = require('../../services/task_context');
-const branchService = require("../../services/branches");
-const log = require("../../services/log");
-const ValidationError = require("../../errors/validation_error");
+const sql = require('../../services/sql.js');
+const utils = require('../../services/utils.js');
+const entityChangesService = require('../../services/entity_changes.js');
+const treeService = require('../../services/tree.js');
+const eraseService = require('../../services/erase.js');
+const becca = require('../../becca/becca.js');
+const TaskContext = require('../../services/task_context.js');
+const branchService = require('../../services/branches.js');
+const log = require('../../services/log.js');
+const ValidationError = require('../../errors/validation_error.js');
const eventService = require("../../services/events.js");
/**
diff --git a/src/routes/api/bulk_action.js b/src/routes/api/bulk_action.js
index 78ab1082b..08f59df49 100644
--- a/src/routes/api/bulk_action.js
+++ b/src/routes/api/bulk_action.js
@@ -1,5 +1,5 @@
-const becca = require("../../becca/becca");
-const bulkActionService = require("../../services/bulk_actions");
+const becca = require('../../becca/becca.js');
+const bulkActionService = require('../../services/bulk_actions.js');
function execute(req) {
const {noteIds, includeDescendants} = req.body;
diff --git a/src/routes/api/clipper.js b/src/routes/api/clipper.js
index a1eaba3b4..8574dc6d0 100644
--- a/src/routes/api/clipper.js
+++ b/src/routes/api/clipper.js
@@ -1,18 +1,18 @@
"use strict";
-const attributeService = require("../../services/attributes");
-const cloneService = require("../../services/cloning");
-const noteService = require('../../services/notes');
-const dateNoteService = require('../../services/date_notes');
-const dateUtils = require('../../services/date_utils');
-const imageService = require('../../services/image');
-const appInfo = require('../../services/app_info');
-const ws = require('../../services/ws');
-const log = require('../../services/log');
-const utils = require('../../services/utils');
+const attributeService = require('../../services/attributes.js');
+const cloneService = require('../../services/cloning.js');
+const noteService = require('../../services/notes.js');
+const dateNoteService = require('../../services/date_notes.js');
+const dateUtils = require('../../services/date_utils.js');
+const imageService = require('../../services/image.js');
+const appInfo = require('../../services/app_info.js');
+const ws = require('../../services/ws.js');
+const log = require('../../services/log.js');
+const utils = require('../../services/utils.js');
const path = require('path');
-const htmlSanitizer = require('../../services/html_sanitizer');
-const {formatAttrForSearch} = require("../../services/attribute_formatter");
+const htmlSanitizer = require('../../services/html_sanitizer.js');
+const {formatAttrForSearch} = require('../../services/attribute_formatter.js');
const jsdom = require("jsdom");
const { JSDOM } = jsdom;
diff --git a/src/routes/api/cloning.js b/src/routes/api/cloning.js
index 75a42e675..384e76990 100644
--- a/src/routes/api/cloning.js
+++ b/src/routes/api/cloning.js
@@ -1,6 +1,6 @@
"use strict";
-const cloningService = require('../../services/cloning');
+const cloningService = require('../../services/cloning.js');
function cloneNoteToBranch(req) {
const {noteId, parentBranchId} = req.params;
diff --git a/src/routes/api/database.js b/src/routes/api/database.js
index d8d8cfa9a..5b6b4739d 100644
--- a/src/routes/api/database.js
+++ b/src/routes/api/database.js
@@ -1,10 +1,10 @@
"use strict";
-const sql = require('../../services/sql');
-const log = require('../../services/log');
-const backupService = require('../../services/backup');
-const anonymizationService = require('../../services/anonymization');
-const consistencyChecksService = require('../../services/consistency_checks');
+const sql = require('../../services/sql.js');
+const log = require('../../services/log.js');
+const backupService = require('../../services/backup.js');
+const anonymizationService = require('../../services/anonymization.js');
+const consistencyChecksService = require('../../services/consistency_checks.js');
function getExistingBackups() {
return backupService.getExistingBackups();
diff --git a/src/routes/api/etapi_tokens.js b/src/routes/api/etapi_tokens.js
index 565ebc53c..2c334643a 100644
--- a/src/routes/api/etapi_tokens.js
+++ b/src/routes/api/etapi_tokens.js
@@ -1,4 +1,4 @@
-const etapiTokenService = require("../../services/etapi_tokens");
+const etapiTokenService = require('../../services/etapi_tokens.js');
function getTokens() {
const tokens = etapiTokenService.getTokens();
diff --git a/src/routes/api/export.js b/src/routes/api/export.js
index 6294f2f25..514fdf861 100644
--- a/src/routes/api/export.js
+++ b/src/routes/api/export.js
@@ -1,12 +1,12 @@
"use strict";
-const zipExportService = require('../../services/export/zip');
-const singleExportService = require('../../services/export/single');
-const opmlExportService = require('../../services/export/opml');
-const becca = require('../../becca/becca');
-const TaskContext = require("../../services/task_context");
-const log = require("../../services/log");
-const NotFoundError = require("../../errors/not_found_error");
+const zipExportService = require('../../services/export/zip.js');
+const singleExportService = require('../../services/export/single.js');
+const opmlExportService = require('../../services/export/opml.js');
+const becca = require('../../becca/becca.js');
+const TaskContext = require('../../services/task_context.js');
+const log = require('../../services/log.js');
+const NotFoundError = require('../../errors/not_found_error.js');
function exportBranch(req, res) {
const {branchId, type, format, version, taskId} = req.params;
diff --git a/src/routes/api/files.js b/src/routes/api/files.js
index 8cb8c1d08..72bd0ee11 100644
--- a/src/routes/api/files.js
+++ b/src/routes/api/files.js
@@ -1,16 +1,16 @@
"use strict";
-const protectedSessionService = require('../../services/protected_session');
-const utils = require('../../services/utils');
-const log = require('../../services/log');
-const noteService = require('../../services/notes');
+const protectedSessionService = require('../../services/protected_session.js');
+const utils = require('../../services/utils.js');
+const log = require('../../services/log.js');
+const noteService = require('../../services/notes.js');
const tmp = require('tmp');
const fs = require('fs');
const { Readable } = require('stream');
const chokidar = require('chokidar');
-const ws = require('../../services/ws');
-const becca = require("../../becca/becca");
-const ValidationError = require("../../errors/validation_error");
+const ws = require('../../services/ws.js');
+const becca = require('../../becca/becca.js');
+const ValidationError = require('../../errors/validation_error.js');
function updateFile(req) {
const note = becca.getNoteOrThrow(req.params.noteId);
diff --git a/src/routes/api/fonts.js b/src/routes/api/fonts.js
index d21db07c8..6e7cce87f 100644
--- a/src/routes/api/fonts.js
+++ b/src/routes/api/fonts.js
@@ -1,4 +1,4 @@
-const optionService = require('../../services/options');
+const optionService = require('../../services/options.js');
function getFontCss(req, res) {
res.setHeader('Content-Type', 'text/css');
diff --git a/src/routes/api/image.js b/src/routes/api/image.js
index 32bce601b..14b034119 100644
--- a/src/routes/api/image.js
+++ b/src/routes/api/image.js
@@ -1,8 +1,8 @@
"use strict";
-const imageService = require('../../services/image');
-const becca = require('../../becca/becca');
-const RESOURCE_DIR = require('../../services/resource_dir').RESOURCE_DIR;
+const imageService = require('../../services/image.js');
+const becca = require('../../becca/becca.js');
+const RESOURCE_DIR = require('../../services/resource_dir.js').RESOURCE_DIR;
const fs = require('fs');
function returnImageFromNote(req, res) {
diff --git a/src/routes/api/import.js b/src/routes/api/import.js
index eccc745f0..0e27ed515 100644
--- a/src/routes/api/import.js
+++ b/src/routes/api/import.js
@@ -1,16 +1,16 @@
"use strict";
-const enexImportService = require('../../services/import/enex');
-const opmlImportService = require('../../services/import/opml');
-const zipImportService = require('../../services/import/zip');
-const singleImportService = require('../../services/import/single');
-const cls = require('../../services/cls');
+const enexImportService = require('../../services/import/enex.js');
+const opmlImportService = require('../../services/import/opml.js');
+const zipImportService = require('../../services/import/zip.js');
+const singleImportService = require('../../services/import/single.js');
+const cls = require('../../services/cls.js');
const path = require('path');
-const becca = require('../../becca/becca');
-const beccaLoader = require('../../becca/becca_loader');
-const log = require('../../services/log');
-const TaskContext = require('../../services/task_context');
-const ValidationError = require("../../errors/validation_error");
+const becca = require('../../becca/becca.js');
+const beccaLoader = require('../../becca/becca_loader.js');
+const log = require('../../services/log.js');
+const TaskContext = require('../../services/task_context.js');
+const ValidationError = require('../../errors/validation_error.js');
async function importNotesToBranch(req) {
const {parentNoteId} = req.params;
diff --git a/src/routes/api/keys.js b/src/routes/api/keys.js
index bc1b97d4a..3f75f11a3 100644
--- a/src/routes/api/keys.js
+++ b/src/routes/api/keys.js
@@ -1,7 +1,7 @@
"use strict";
-const keyboardActions = require('../../services/keyboard_actions');
-const becca = require('../../becca/becca');
+const keyboardActions = require('../../services/keyboard_actions.js');
+const becca = require('../../becca/becca.js');
function getKeyboardActions() {
return keyboardActions.getKeyboardActions();
diff --git a/src/routes/api/login.js b/src/routes/api/login.js
index 42b78d951..9dbf058d4 100644
--- a/src/routes/api/login.js
+++ b/src/routes/api/login.js
@@ -1,17 +1,17 @@
"use strict";
-const options = require('../../services/options');
-const utils = require('../../services/utils');
-const dateUtils = require('../../services/date_utils');
-const instanceId = require('../../services/instance_id');
-const passwordEncryptionService = require('../../services/encryption/password_encryption');
-const protectedSessionService = require('../../services/protected_session');
-const appInfo = require('../../services/app_info');
-const eventService = require('../../services/events');
-const sqlInit = require('../../services/sql_init');
-const sql = require('../../services/sql');
-const ws = require("../../services/ws");
-const etapiTokenService = require("../../services/etapi_tokens");
+const options = require('../../services/options.js');
+const utils = require('../../services/utils.js');
+const dateUtils = require('../../services/date_utils.js');
+const instanceId = require('../../services/instance_id.js');
+const passwordEncryptionService = require('../../services/encryption/password_encryption.js');
+const protectedSessionService = require('../../services/protected_session.js');
+const appInfo = require('../../services/app_info.js');
+const eventService = require('../../services/events.js');
+const sqlInit = require('../../services/sql_init.js');
+const sql = require('../../services/sql.js');
+const ws = require('../../services/ws.js');
+const etapiTokenService = require('../../services/etapi_tokens.js');
function loginSync(req) {
if (!sqlInit.schemaExists()) {
diff --git a/src/routes/api/note_map.js b/src/routes/api/note_map.js
index 4816be9c1..30ad771ca 100644
--- a/src/routes/api/note_map.js
+++ b/src/routes/api/note_map.js
@@ -1,6 +1,6 @@
"use strict";
-const becca = require("../../becca/becca");
+const becca = require('../../becca/becca.js');
const { JSDOM } = require("jsdom");
function buildDescendantCountMap(noteIdsToCount) {
diff --git a/src/routes/api/notes.js b/src/routes/api/notes.js
index d4deaf82c..54cd83330 100644
--- a/src/routes/api/notes.js
+++ b/src/routes/api/notes.js
@@ -1,15 +1,15 @@
"use strict";
-const noteService = require('../../services/notes');
-const eraseService = require('../../services/erase');
-const treeService = require('../../services/tree');
-const sql = require('../../services/sql');
-const utils = require('../../services/utils');
-const log = require('../../services/log');
-const TaskContext = require('../../services/task_context');
-const becca = require("../../becca/becca");
-const ValidationError = require("../../errors/validation_error");
-const blobService = require("../../services/blob");
+const noteService = require('../../services/notes.js');
+const eraseService = require('../../services/erase.js');
+const treeService = require('../../services/tree.js');
+const sql = require('../../services/sql.js');
+const utils = require('../../services/utils.js');
+const log = require('../../services/log.js');
+const TaskContext = require('../../services/task_context.js');
+const becca = require('../../becca/becca.js');
+const ValidationError = require('../../errors/validation_error.js');
+const blobService = require('../../services/blob.js');
function getNote(req) {
return becca.getNoteOrThrow(req.params.noteId);
diff --git a/src/routes/api/options.js b/src/routes/api/options.js
index a04f54306..efd70a07e 100644
--- a/src/routes/api/options.js
+++ b/src/routes/api/options.js
@@ -1,9 +1,9 @@
"use strict";
-const optionService = require('../../services/options');
-const log = require('../../services/log');
-const searchService = require('../../services/search/services/search');
-const ValidationError = require("../../errors/validation_error");
+const optionService = require('../../services/options.js');
+const log = require('../../services/log.js');
+const searchService = require('../../services/search/services/search.js');
+const ValidationError = require('../../errors/validation_error.js');
// options allowed to be updated directly in the Options dialog
const ALLOWED_OPTIONS = new Set([
diff --git a/src/routes/api/other.js b/src/routes/api/other.js
index 5cc3a05f4..ca92e15c6 100644
--- a/src/routes/api/other.js
+++ b/src/routes/api/other.js
@@ -1,5 +1,5 @@
-const becca = require("../../becca/becca");
-const markdownService = require("../../services/import/markdown");
+const becca = require('../../becca/becca.js');
+const markdownService = require('../../services/import/markdown.js');
function getIconUsage() {
const iconClassToCountMap = {};
diff --git a/src/routes/api/password.js b/src/routes/api/password.js
index dabd3e50a..a80d4151c 100644
--- a/src/routes/api/password.js
+++ b/src/routes/api/password.js
@@ -1,7 +1,7 @@
"use strict";
-const passwordService = require('../../services/encryption/password');
-const ValidationError = require("../../errors/validation_error");
+const passwordService = require('../../services/encryption/password.js');
+const ValidationError = require('../../errors/validation_error.js');
function changePassword(req) {
if (passwordService.isPasswordSet()) {
diff --git a/src/routes/api/recent_changes.js b/src/routes/api/recent_changes.js
index 00b0df681..567abfb3a 100644
--- a/src/routes/api/recent_changes.js
+++ b/src/routes/api/recent_changes.js
@@ -1,9 +1,9 @@
"use strict";
-const sql = require('../../services/sql');
-const protectedSessionService = require('../../services/protected_session');
-const noteService = require('../../services/notes');
-const becca = require("../../becca/becca");
+const sql = require('../../services/sql.js');
+const protectedSessionService = require('../../services/protected_session.js');
+const noteService = require('../../services/notes.js');
+const becca = require('../../becca/becca.js');
function getRecentChanges(req) {
const {ancestorNoteId} = req.params;
diff --git a/src/routes/api/recent_notes.js b/src/routes/api/recent_notes.js
index 40139477a..2ba5c5020 100644
--- a/src/routes/api/recent_notes.js
+++ b/src/routes/api/recent_notes.js
@@ -1,8 +1,8 @@
"use strict";
-const BRecentNote = require('../../becca/entities/brecent_note');
-const sql = require('../../services/sql');
-const dateUtils = require('../../services/date_utils');
+const BRecentNote = require('../../becca/entities/brecent_note.js');
+const sql = require('../../services/sql.js');
+const dateUtils = require('../../services/date_utils.js');
function addRecentNote(req) {
new BRecentNote({
diff --git a/src/routes/api/relation-map.js b/src/routes/api/relation-map.js
index 3faaef900..0c3db4e6d 100644
--- a/src/routes/api/relation-map.js
+++ b/src/routes/api/relation-map.js
@@ -1,5 +1,5 @@
-const becca = require("../../becca/becca");
-const sql = require("../../services/sql");
+const becca = require('../../becca/becca.js');
+const sql = require('../../services/sql.js');
function getRelationMap(req) {
const {relationMapNoteId, noteIds} = req.body;
diff --git a/src/routes/api/revisions.js b/src/routes/api/revisions.js
index 7fd36476d..cc1659c2e 100644
--- a/src/routes/api/revisions.js
+++ b/src/routes/api/revisions.js
@@ -1,13 +1,13 @@
"use strict";
-const beccaService = require('../../becca/becca_service');
-const revisionService = require('../../services/revisions');
-const utils = require('../../services/utils');
-const sql = require('../../services/sql');
-const cls = require('../../services/cls');
+const beccaService = require('../../becca/becca_service.js');
+const revisionService = require('../../services/revisions.js');
+const utils = require('../../services/utils.js');
+const sql = require('../../services/sql.js');
+const cls = require('../../services/cls.js');
const path = require('path');
-const becca = require("../../becca/becca");
-const blobService = require("../../services/blob");
+const becca = require('../../becca/becca.js');
+const blobService = require('../../services/blob.js');
function getRevisionBlob(req) {
const preview = req.query.preview === 'true';
diff --git a/src/routes/api/script.js b/src/routes/api/script.js
index 43b726aff..833a57b9b 100644
--- a/src/routes/api/script.js
+++ b/src/routes/api/script.js
@@ -1,10 +1,10 @@
"use strict";
-const scriptService = require('../../services/script');
-const attributeService = require('../../services/attributes');
-const becca = require('../../becca/becca');
-const syncService = require('../../services/sync');
-const sql = require('../../services/sql');
+const scriptService = require('../../services/script.js');
+const attributeService = require('../../services/attributes.js');
+const becca = require('../../becca/becca.js');
+const syncService = require('../../services/sync.js');
+const sql = require('../../services/sql.js');
// The async/await here is very confusing, because the body.script may, but may not be async. If it is async, then we
// need to await it and make the complete response including metadata available in a Promise, so that the route detects
diff --git a/src/routes/api/search.js b/src/routes/api/search.js
index 4be87e89d..cf4887523 100644
--- a/src/routes/api/search.js
+++ b/src/routes/api/search.js
@@ -1,12 +1,12 @@
"use strict";
-const becca = require('../../becca/becca');
-const SearchContext = require('../../services/search/search_context');
-const searchService = require('../../services/search/services/search');
-const bulkActionService = require("../../services/bulk_actions");
-const cls = require("../../services/cls");
-const {formatAttrForSearch} = require("../../services/attribute_formatter");
-const ValidationError = require("../../errors/validation_error");
+const becca = require('../../becca/becca.js');
+const SearchContext = require('../../services/search/search_context.js');
+const searchService = require('../../services/search/services/search.js');
+const bulkActionService = require('../../services/bulk_actions.js');
+const cls = require('../../services/cls.js');
+const {formatAttrForSearch} = require('../../services/attribute_formatter.js');
+const ValidationError = require('../../errors/validation_error.js');
function searchFromNote(req) {
const note = becca.getNoteOrThrow(req.params.noteId);
diff --git a/src/routes/api/sender.js b/src/routes/api/sender.js
index 7d434b2f8..1e55d7a7b 100644
--- a/src/routes/api/sender.js
+++ b/src/routes/api/sender.js
@@ -1,10 +1,10 @@
"use strict";
const imageType = require('image-type');
-const imageService = require('../../services/image');
-const noteService = require('../../services/notes');
-const {sanitizeAttributeName} = require("../../services/sanitize_attribute_name");
-const specialNotesService = require("../../services/special_notes");
+const imageService = require('../../services/image.js');
+const noteService = require('../../services/notes.js');
+const {sanitizeAttributeName} = require('../../services/sanitize_attribute_name.js');
+const specialNotesService = require('../../services/special_notes.js');
function uploadImage(req) {
const file = req.file;
diff --git a/src/routes/api/setup.js b/src/routes/api/setup.js
index dbaf44807..4ed672f9d 100644
--- a/src/routes/api/setup.js
+++ b/src/routes/api/setup.js
@@ -1,9 +1,9 @@
"use strict";
-const sqlInit = require('../../services/sql_init');
-const setupService = require('../../services/setup');
-const log = require('../../services/log');
-const appInfo = require('../../services/app_info');
+const sqlInit = require('../../services/sql_init.js');
+const setupService = require('../../services/setup.js');
+const log = require('../../services/log.js');
+const appInfo = require('../../services/app_info.js');
function getStatus() {
return {
diff --git a/src/routes/api/similar_notes.js b/src/routes/api/similar_notes.js
index e48aee3d7..781ba0efc 100644
--- a/src/routes/api/similar_notes.js
+++ b/src/routes/api/similar_notes.js
@@ -1,7 +1,7 @@
"use strict";
-const similarityService = require('../../becca/similarity');
-const becca = require("../../becca/becca");
+const similarityService = require('../../becca/similarity.js');
+const becca = require('../../becca/becca.js');
async function getSimilarNotes(req) {
const noteId = req.params.noteId;
diff --git a/src/routes/api/special_notes.js b/src/routes/api/special_notes.js
index 5ed6e0656..5f4c7933b 100644
--- a/src/routes/api/special_notes.js
+++ b/src/routes/api/special_notes.js
@@ -1,10 +1,10 @@
"use strict";
-const dateNoteService = require('../../services/date_notes');
-const sql = require('../../services/sql');
-const cls = require('../../services/cls');
-const specialNotesService = require('../../services/special_notes');
-const becca = require('../../becca/becca');
+const dateNoteService = require('../../services/date_notes.js');
+const sql = require('../../services/sql.js');
+const cls = require('../../services/cls.js');
+const specialNotesService = require('../../services/special_notes.js');
+const becca = require('../../becca/becca.js');
function getInboxNote(req) {
return specialNotesService.getInboxNote(req.params.date);
diff --git a/src/routes/api/sql.js b/src/routes/api/sql.js
index 00bbf852e..6a9767317 100644
--- a/src/routes/api/sql.js
+++ b/src/routes/api/sql.js
@@ -1,7 +1,7 @@
"use strict";
-const sql = require('../../services/sql');
-const becca = require("../../becca/becca");
+const sql = require('../../services/sql.js');
+const becca = require('../../becca/becca.js');
function getSchema() {
const tableNames = sql.getColumn(`SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%' ORDER BY name`);
diff --git a/src/routes/api/stats.js b/src/routes/api/stats.js
index 05d05d25c..d67d624d3 100644
--- a/src/routes/api/stats.js
+++ b/src/routes/api/stats.js
@@ -1,5 +1,5 @@
-const sql = require('../../services/sql');
-const becca = require('../../becca/becca');
+const sql = require('../../services/sql.js');
+const becca = require('../../becca/becca.js');
function getNoteSize(req) {
const {noteId} = req.params;
diff --git a/src/routes/api/sync.js b/src/routes/api/sync.js
index 4b23e8451..44da3e52c 100644
--- a/src/routes/api/sync.js
+++ b/src/routes/api/sync.js
@@ -1,16 +1,16 @@
"use strict";
-const syncService = require('../../services/sync');
-const syncUpdateService = require('../../services/sync_update');
-const entityChangesService = require('../../services/entity_changes');
-const sql = require('../../services/sql');
-const sqlInit = require('../../services/sql_init');
-const optionService = require('../../services/options');
-const contentHashService = require('../../services/content_hash');
-const log = require('../../services/log');
-const syncOptions = require('../../services/sync_options');
-const utils = require('../../services/utils');
-const ws = require('../../services/ws');
+const syncService = require('../../services/sync.js');
+const syncUpdateService = require('../../services/sync_update.js');
+const entityChangesService = require('../../services/entity_changes.js');
+const sql = require('../../services/sql.js');
+const sqlInit = require('../../services/sql_init.js');
+const optionService = require('../../services/options.js');
+const contentHashService = require('../../services/content_hash.js');
+const log = require('../../services/log.js');
+const syncOptions = require('../../services/sync_options.js');
+const utils = require('../../services/utils.js');
+const ws = require('../../services/ws.js');
async function testSync() {
try {
@@ -193,7 +193,7 @@ function queueSector(req) {
}
function checkEntityChanges() {
- require("../../services/consistency_checks").runEntityChangesChecks();
+ require('../../services/consistency_checks.js').runEntityChangesChecks();
}
module.exports = {
diff --git a/src/routes/api/tree.js b/src/routes/api/tree.js
index a3992cedc..a5b4ad639 100644
--- a/src/routes/api/tree.js
+++ b/src/routes/api/tree.js
@@ -1,8 +1,8 @@
"use strict";
-const becca = require('../../becca/becca');
-const log = require('../../services/log');
-const NotFoundError = require("../../errors/not_found_error");
+const becca = require('../../becca/becca.js');
+const log = require('../../services/log.js');
+const NotFoundError = require('../../errors/not_found_error.js');
function getNotesAndBranchesAndAttributes(noteIds) {
noteIds = new Set(noteIds);
diff --git a/src/routes/assets.js b/src/routes/assets.js
index 13849bd02..100bef353 100644
--- a/src/routes/assets.js
+++ b/src/routes/assets.js
@@ -1,7 +1,7 @@
-const assetPath = require("../services/asset_path");
+const assetPath = require('../services/asset_path.js');
const path = require("path");
const express = require("express");
-const env = require("../services/env");
+const env = require('../services/env.js');
const persistentCacheStatic = (root, options) => {
if (!env.isDev()) {
diff --git a/src/routes/custom.js b/src/routes/custom.js
index 69eeebeeb..c76240976 100644
--- a/src/routes/custom.js
+++ b/src/routes/custom.js
@@ -1,9 +1,9 @@
-const log = require('../services/log');
-const fileService = require('./api/files');
-const scriptService = require('../services/script');
-const cls = require('../services/cls');
-const sql = require("../services/sql");
-const becca = require("../becca/becca");
+const log = require('../services/log.js');
+const fileService = require('./api/files.js');
+const scriptService = require('../services/script.js');
+const cls = require('../services/cls.js');
+const sql = require('../services/sql.js');
+const becca = require('../becca/becca.js');
function handleRequest(req, res) {
// express puts content after first slash into 0 index element
diff --git a/src/routes/error_handlers.js b/src/routes/error_handlers.js
index 1b945ea86..1e9715ed8 100644
--- a/src/routes/error_handlers.js
+++ b/src/routes/error_handlers.js
@@ -1,4 +1,4 @@
-const log = require("../services/log");
+const log = require('../services/log.js');
function register(app) {
app.use((err, req, res, next) => {
diff --git a/src/routes/index.js b/src/routes/index.js
index 657619123..d57563bad 100644
--- a/src/routes/index.js
+++ b/src/routes/index.js
@@ -1,16 +1,16 @@
"use strict";
-const sql = require('../services/sql');
-const attributeService = require('../services/attributes');
-const config = require('../services/config');
-const optionService = require('../services/options');
-const log = require('../services/log');
-const env = require('../services/env');
-const utils = require('../services/utils');
-const protectedSessionService = require("../services/protected_session");
+const sql = require('../services/sql.js');
+const attributeService = require('../services/attributes.js');
+const config = require('../services/config.js');
+const optionService = require('../services/options.js');
+const log = require('../services/log.js');
+const env = require('../services/env.js');
+const utils = require('../services/utils.js');
+const protectedSessionService = require('../services/protected_session.js');
const packageJson = require('../../package.json');
-const assetPath = require("../services/asset_path");
-const appPath = require("../services/app_path");
+const assetPath = require('../services/asset_path.js');
+const appPath = require('../services/app_path.js');
function index(req, res) {
const options = optionService.getOptionMap();
diff --git a/src/routes/login.js b/src/routes/login.js
index 42c0e59a0..6c4af5cdb 100644
--- a/src/routes/login.js
+++ b/src/routes/login.js
@@ -1,13 +1,13 @@
"use strict";
-const utils = require('../services/utils');
-const optionService = require('../services/options');
-const myScryptService = require('../services/encryption/my_scrypt');
-const log = require('../services/log');
-const passwordService = require("../services/encryption/password");
-const assetPath = require("../services/asset_path");
-const appPath = require("../services/app_path");
-const ValidationError = require("../errors/validation_error");
+const utils = require('../services/utils.js');
+const optionService = require('../services/options.js');
+const myScryptService = require('../services/encryption/my_scrypt.js');
+const log = require('../services/log.js');
+const passwordService = require('../services/encryption/password.js');
+const assetPath = require('../services/asset_path.js');
+const appPath = require('../services/app_path.js');
+const ValidationError = require('../errors/validation_error.js');
function loginPage(req, res) {
res.render('login', {
diff --git a/src/routes/routes.js b/src/routes/routes.js
index 304761920..fd3cf167a 100644
--- a/src/routes/routes.js
+++ b/src/routes/routes.js
@@ -1,75 +1,75 @@
"use strict";
-const utils = require('../services/utils');
+const utils = require('../services/utils.js');
const multer = require('multer');
-const log = require('../services/log');
+const log = require('../services/log.js');
const express = require('express');
const router = express.Router();
-const auth = require('../services/auth');
-const cls = require('../services/cls');
-const sql = require('../services/sql');
-const entityChangesService = require('../services/entity_changes');
+const auth = require('../services/auth.js');
+const cls = require('../services/cls.js');
+const sql = require('../services/sql.js');
+const entityChangesService = require('../services/entity_changes.js');
const csurf = require('csurf');
const { createPartialContentHandler } = require("express-partial-content");
const rateLimit = require("express-rate-limit");
-const AbstractBeccaEntity = require("../becca/entities/abstract_becca_entity");
-const NotFoundError = require("../errors/not_found_error");
-const ValidationError = require("../errors/validation_error");
+const AbstractBeccaEntity = require('../becca/entities/abstract_becca_entity.js');
+const NotFoundError = require('../errors/not_found_error.js');
+const ValidationError = require('../errors/validation_error.js');
// page routes
-const setupRoute = require('./setup');
-const loginRoute = require('./login');
-const indexRoute = require('./index');
+const setupRoute = require('./setup.js');
+const loginRoute = require('./login.js');
+const indexRoute = require('./index.js');
// API routes
-const treeApiRoute = require('./api/tree');
-const notesApiRoute = require('./api/notes');
-const branchesApiRoute = require('./api/branches');
-const attachmentsApiRoute = require('./api/attachments');
-const autocompleteApiRoute = require('./api/autocomplete');
-const cloningApiRoute = require('./api/cloning');
-const revisionsApiRoute = require('./api/revisions');
-const recentChangesApiRoute = require('./api/recent_changes');
-const optionsApiRoute = require('./api/options');
-const passwordApiRoute = require('./api/password');
-const syncApiRoute = require('./api/sync');
-const loginApiRoute = require('./api/login');
-const recentNotesRoute = require('./api/recent_notes');
-const appInfoRoute = require('./api/app_info');
-const exportRoute = require('./api/export');
-const importRoute = require('./api/import');
-const setupApiRoute = require('./api/setup');
-const sqlRoute = require('./api/sql');
-const databaseRoute = require('./api/database');
-const imageRoute = require('./api/image');
-const attributesRoute = require('./api/attributes');
-const scriptRoute = require('./api/script');
-const senderRoute = require('./api/sender');
-const filesRoute = require('./api/files');
-const searchRoute = require('./api/search');
-const bulkActionRoute = require('./api/bulk_action');
-const specialNotesRoute = require('./api/special_notes');
-const noteMapRoute = require('./api/note_map');
-const clipperRoute = require('./api/clipper');
-const similarNotesRoute = require('./api/similar_notes');
-const keysRoute = require('./api/keys');
-const backendLogRoute = require('./api/backend_log');
-const statsRoute = require('./api/stats');
-const fontsRoute = require('./api/fonts');
-const etapiTokensApiRoutes = require('./api/etapi_tokens');
+const treeApiRoute = require('./api/tree.js');
+const notesApiRoute = require('./api/notes.js');
+const branchesApiRoute = require('./api/branches.js');
+const attachmentsApiRoute = require('./api/attachments.js');
+const autocompleteApiRoute = require('./api/autocomplete.js');
+const cloningApiRoute = require('./api/cloning.js');
+const revisionsApiRoute = require('./api/revisions.js');
+const recentChangesApiRoute = require('./api/recent_changes.js');
+const optionsApiRoute = require('./api/options.js');
+const passwordApiRoute = require('./api/password.js');
+const syncApiRoute = require('./api/sync.js');
+const loginApiRoute = require('./api/login.js');
+const recentNotesRoute = require('./api/recent_notes.js');
+const appInfoRoute = require('./api/app_info.js');
+const exportRoute = require('./api/export.js');
+const importRoute = require('./api/import.js');
+const setupApiRoute = require('./api/setup.js');
+const sqlRoute = require('./api/sql.js');
+const databaseRoute = require('./api/database.js');
+const imageRoute = require('./api/image.js');
+const attributesRoute = require('./api/attributes.js');
+const scriptRoute = require('./api/script.js');
+const senderRoute = require('./api/sender.js');
+const filesRoute = require('./api/files.js');
+const searchRoute = require('./api/search.js');
+const bulkActionRoute = require('./api/bulk_action.js');
+const specialNotesRoute = require('./api/special_notes.js');
+const noteMapRoute = require('./api/note_map.js');
+const clipperRoute = require('./api/clipper.js');
+const similarNotesRoute = require('./api/similar_notes.js');
+const keysRoute = require('./api/keys.js');
+const backendLogRoute = require('./api/backend_log.js');
+const statsRoute = require('./api/stats.js');
+const fontsRoute = require('./api/fonts.js');
+const etapiTokensApiRoutes = require('./api/etapi_tokens.js');
const relationMapApiRoute = require('./api/relation-map');
-const otherRoute = require('./api/other');
-const shareRoutes = require('../share/routes');
+const otherRoute = require('./api/other.js');
+const shareRoutes = require('../share/routes.js');
-const etapiAuthRoutes = require('../etapi/auth');
-const etapiAppInfoRoutes = require('../etapi/app_info');
-const etapiAttachmentRoutes = require('../etapi/attachments');
-const etapiAttributeRoutes = require('../etapi/attributes');
-const etapiBranchRoutes = require('../etapi/branches');
-const etapiNoteRoutes = require('../etapi/notes');
-const etapiSpecialNoteRoutes = require('../etapi/special_notes');
-const etapiSpecRoute = require('../etapi/spec');
-const etapiBackupRoute = require('../etapi/backup');
+const etapiAuthRoutes = require('../etapi/auth.js');
+const etapiAppInfoRoutes = require('../etapi/app_info.js');
+const etapiAttachmentRoutes = require('../etapi/attachments.js');
+const etapiAttributeRoutes = require('../etapi/attributes.js');
+const etapiBranchRoutes = require('../etapi/branches.js');
+const etapiNoteRoutes = require('../etapi/notes.js');
+const etapiSpecialNoteRoutes = require('../etapi/special_notes.js');
+const etapiSpecRoute = require('../etapi/spec.js');
+const etapiBackupRoute = require('../etapi/backup.js');
const csrfMiddleware = csurf({
cookie: true,
diff --git a/src/routes/session_parser.js b/src/routes/session_parser.js
index 06c17e40b..404159b62 100644
--- a/src/routes/session_parser.js
+++ b/src/routes/session_parser.js
@@ -1,6 +1,6 @@
const session = require("express-session");
-const sessionSecret = require("../services/session_secret");
-const dataDir = require("../services/data_dir");
+const sessionSecret = require('../services/session_secret.js');
+const dataDir = require('../services/data_dir.js');
const FileStore = require('session-file-store')(session);
const sessionParser = session({
diff --git a/src/routes/setup.js b/src/routes/setup.js
index 1d4de5dad..be14c2310 100644
--- a/src/routes/setup.js
+++ b/src/routes/setup.js
@@ -1,15 +1,15 @@
"use strict";
-const sqlInit = require('../services/sql_init');
-const setupService = require('../services/setup');
-const utils = require('../services/utils');
-const assetPath = require("../services/asset_path");
-const appPath = require("../services/app_path");
+const sqlInit = require('../services/sql_init.js');
+const setupService = require('../services/setup.js');
+const utils = require('../services/utils.js');
+const assetPath = require('../services/asset_path.js');
+const appPath = require('../services/app_path.js');
function setupPage(req, res) {
if (sqlInit.isDbInitialized()) {
if (utils.isElectron()) {
- const windowService = require('../services/window');
+ const windowService = require('../services/window.js');
const {app} = require('electron');
windowService.createMainWindow(app);
windowService.closeSetupWindow();
diff --git a/src/services/anonymization.js b/src/services/anonymization.js
index 160b6e2a2..acd48e72c 100644
--- a/src/services/anonymization.js
+++ b/src/services/anonymization.js
@@ -1,9 +1,9 @@
-const BUILTIN_ATTRIBUTES = require("./builtin_attributes");
+const BUILTIN_ATTRIBUTES = require('./builtin_attributes.js');
const fs = require("fs-extra");
-const dataDir = require("./data_dir");
-const dateUtils = require("./date_utils");
+const dataDir = require('./data_dir.js');
+const dateUtils = require('./date_utils.js');
const Database = require("better-sqlite3");
-const sql = require("./sql");
+const sql = require('./sql.js');
const path = require("path");
function getFullAnonymizationScript() {
diff --git a/src/services/app_icon.js b/src/services/app_icon.js
index 34ff69e60..51e319113 100644
--- a/src/services/app_icon.js
+++ b/src/services/app_icon.js
@@ -1,12 +1,12 @@
"use strict";
const path = require('path');
-const {ELECTRON_APP_ROOT_DIR} = require("./resource_dir");
-const log = require("./log");
+const {ELECTRON_APP_ROOT_DIR} = require('./resource_dir.js');
+const log = require('./log.js');
const os = require('os');
const fs = require('fs');
-const config = require('./config');
-const utils = require('./utils');
+const config = require('./config.js');
+const utils = require('./utils.js');
const template = `[Desktop Entry]
Type=Application
diff --git a/src/services/app_info.js b/src/services/app_info.js
index 7f5a7818a..9198fce98 100644
--- a/src/services/app_info.js
+++ b/src/services/app_info.js
@@ -1,8 +1,8 @@
"use strict";
-const build = require('./build');
-const packageJson = require('../../package');
-const {TRILIUM_DATA_DIR} = require('./data_dir');
+const build = require('./build.js');
+const packageJson = require('../../package.json');
+const {TRILIUM_DATA_DIR} = require('./data_dir.js');
const APP_DB_VERSION = 227;
const SYNC_VERSION = 31;
diff --git a/src/services/app_path.js b/src/services/app_path.js
index 09129aadb..ab449495d 100644
--- a/src/services/app_path.js
+++ b/src/services/app_path.js
@@ -1,5 +1,5 @@
-const assetPath = require("./asset_path");
-const env = require("./env");
+const assetPath = require('./asset_path.js');
+const env = require('./env.js');
module.exports = env.isDev()
? assetPath + "/app"
diff --git a/src/services/attributes.js b/src/services/attributes.js
index 7807a93fc..632a6e09a 100644
--- a/src/services/attributes.js
+++ b/src/services/attributes.js
@@ -1,11 +1,11 @@
"use strict";
-const searchService = require('./search/services/search');
-const sql = require('./sql');
-const becca = require('../becca/becca');
-const BAttribute = require('../becca/entities/battribute');
-const {formatAttrForSearch} = require("./attribute_formatter");
-const BUILTIN_ATTRIBUTES = require("./builtin_attributes");
+const searchService = require('./search/services/search.js');
+const sql = require('./sql.js');
+const becca = require('../becca/becca.js');
+const BAttribute = require('../becca/entities/battribute.js');
+const {formatAttrForSearch} = require('./attribute_formatter.js');
+const BUILTIN_ATTRIBUTES = require('./builtin_attributes.js');
const ATTRIBUTE_TYPES = ['label', 'relation'];
diff --git a/src/services/auth.js b/src/services/auth.js
index 951e0710e..adb565134 100644
--- a/src/services/auth.js
+++ b/src/services/auth.js
@@ -1,12 +1,12 @@
"use strict";
-const etapiTokenService = require("./etapi_tokens");
-const log = require('./log');
-const sqlInit = require('./sql_init');
-const utils = require('./utils');
-const passwordEncryptionService = require('./encryption/password_encryption');
-const config = require('./config');
-const passwordService = require("./encryption/password");
+const etapiTokenService = require('./etapi_tokens.js');
+const log = require('./log.js');
+const sqlInit = require('./sql_init.js');
+const utils = require('./utils.js');
+const passwordEncryptionService = require('./encryption/password_encryption.js');
+const config = require('./config.js');
+const passwordService = require('./encryption/password.js');
const noAuthentication = config.General && config.General.noAuthentication === true;
diff --git a/src/services/backend_script_api.js b/src/services/backend_script_api.js
index e3e5b5b36..a5a94392c 100644
--- a/src/services/backend_script_api.js
+++ b/src/services/backend_script_api.js
@@ -1,27 +1,27 @@
-const log = require('./log');
-const noteService = require('./notes');
-const sql = require('./sql');
-const utils = require('./utils');
-const attributeService = require('./attributes');
-const dateNoteService = require('./date_notes');
-const treeService = require('./tree');
-const config = require('./config');
+const log = require('./log.js');
+const noteService = require('./notes.js');
+const sql = require('./sql.js');
+const utils = require('./utils.js');
+const attributeService = require('./attributes.js');
+const dateNoteService = require('./date_notes.js');
+const treeService = require('./tree.js');
+const config = require('./config.js');
const axios = require('axios');
const dayjs = require('dayjs');
const xml2js = require('xml2js');
-const cloningService = require('./cloning');
-const appInfo = require('./app_info');
-const searchService = require('./search/services/search');
-const SearchContext = require("./search/search_context");
-const becca = require("../becca/becca");
-const ws = require("./ws");
-const SpacedUpdate = require("./spaced_update");
-const specialNotesService = require("./special_notes");
-const branchService = require("./branches");
-const exportService = require("./export/zip");
-const syncMutex = require("./sync_mutex");
-const backupService = require("./backup");
-const optionsService = require("./options");
+const cloningService = require('./cloning.js');
+const appInfo = require('./app_info.js');
+const searchService = require('./search/services/search.js');
+const SearchContext = require('./search/search_context.js');
+const becca = require('../becca/becca.js');
+const ws = require('./ws.js');
+const SpacedUpdate = require('./spaced_update.js');
+const specialNotesService = require('./special_notes.js');
+const branchService = require('./branches.js');
+const exportService = require('./export/zip.js');
+const syncMutex = require('./sync_mutex.js');
+const backupService = require('./backup.js');
+const optionsService = require('./options.js');
/**
diff --git a/src/services/backup.js b/src/services/backup.js
index 7fa41eb5e..ef36d91cf 100644
--- a/src/services/backup.js
+++ b/src/services/backup.js
@@ -1,13 +1,13 @@
"use strict";
-const dateUtils = require('./date_utils');
-const optionService = require('./options');
+const dateUtils = require('./date_utils.js');
+const optionService = require('./options.js');
const fs = require('fs-extra');
-const dataDir = require('./data_dir');
-const log = require('./log');
-const syncMutexService = require('./sync_mutex');
-const cls = require('./cls');
-const sql = require('./sql');
+const dataDir = require('./data_dir.js');
+const log = require('./log.js');
+const syncMutexService = require('./sync_mutex.js');
+const cls = require('./cls.js');
+const sql = require('./sql.js');
const path = require('path');
function getExistingBackups() {
diff --git a/src/services/blob.js b/src/services/blob.js
index ff4dd24a8..19786ad11 100644
--- a/src/services/blob.js
+++ b/src/services/blob.js
@@ -1,7 +1,7 @@
-const becca = require('../becca/becca');
-const NotFoundError = require("../errors/not_found_error");
-const protectedSessionService = require("./protected_session");
-const utils = require("./utils");
+const becca = require('../becca/becca.js');
+const NotFoundError = require('../errors/not_found_error.js');
+const protectedSessionService = require('./protected_session.js');
+const utils = require('./utils.js');
function getBlobPojo(entityName, entityId) {
const entity = becca.getEntity(entityName, entityId);
diff --git a/src/services/branches.js b/src/services/branches.js
index 681676ab1..644bde80e 100644
--- a/src/services/branches.js
+++ b/src/services/branches.js
@@ -1,5 +1,5 @@
-const treeService = require("./tree");
-const sql = require("./sql");
+const treeService = require('./tree.js');
+const sql = require('./sql.js');
function moveBranchToNote(branchToMove, targetParentNoteId) {
if (branchToMove.parentNoteId === targetParentNoteId) {
diff --git a/src/services/bulk_actions.js b/src/services/bulk_actions.js
index 9926aff67..84fc69cfe 100644
--- a/src/services/bulk_actions.js
+++ b/src/services/bulk_actions.js
@@ -1,9 +1,9 @@
-const log = require("./log");
-const revisionService = require("./revisions");
-const becca = require("../becca/becca");
-const cloningService = require("./cloning");
-const branchService = require("./branches");
-const utils = require("./utils");
+const log = require('./log.js');
+const revisionService = require('./revisions.js');
+const becca = require('../becca/becca.js');
+const cloningService = require('./cloning.js');
+const branchService = require('./branches.js');
+const utils = require('./utils.js');
const ACTION_HANDLERS = {
addLabel: (action, note) => {
diff --git a/src/services/cloning.js b/src/services/cloning.js
index 4d6603373..4baae5de7 100644
--- a/src/services/cloning.js
+++ b/src/services/cloning.js
@@ -1,11 +1,11 @@
"use strict";
-const sql = require('./sql');
-const eventChangesService = require('./entity_changes');
-const treeService = require('./tree');
-const BBranch = require('../becca/entities/bbranch');
-const becca = require("../becca/becca");
-const log = require("./log");
+const sql = require('./sql.js');
+const eventChangesService = require('./entity_changes.js');
+const treeService = require('./tree.js');
+const BBranch = require('../becca/entities/bbranch.js');
+const becca = require('../becca/becca.js');
+const log = require('./log.js');
function cloneNoteToParentNote(noteId, parentNoteId, prefix = null) {
if (!(noteId in becca.notes) || !(parentNoteId in becca.notes)) {
diff --git a/src/services/config.js b/src/services/config.js
index 8bc0723a7..2968f1248 100644
--- a/src/services/config.js
+++ b/src/services/config.js
@@ -2,9 +2,9 @@
const ini = require('ini');
const fs = require('fs');
-const dataDir = require('./data_dir');
+const dataDir = require('./data_dir.js');
const path = require('path');
-const resourceDir = require('./resource_dir');
+const resourceDir = require('./resource_dir.js');
const configSampleFilePath = path.resolve(resourceDir.RESOURCE_DIR, "config-sample.ini");
diff --git a/src/services/consistency_checks.js b/src/services/consistency_checks.js
index 020848d83..bf83cd9d9 100644
--- a/src/services/consistency_checks.js
+++ b/src/services/consistency_checks.js
@@ -1,20 +1,20 @@
"use strict";
-const sql = require('./sql');
-const sqlInit = require('./sql_init');
-const log = require('./log');
-const ws = require('./ws');
-const syncMutexService = require('./sync_mutex');
-const cls = require('./cls');
-const entityChangesService = require('./entity_changes');
-const optionsService = require('./options');
-const BBranch = require('../becca/entities/bbranch');
-const revisionService = require('./revisions');
-const becca = require("../becca/becca");
-const utils = require("../services/utils");
-const eraseService = require("../services/erase");
-const {sanitizeAttributeName} = require("./sanitize_attribute_name");
-const noteTypes = require("../services/note_types").getNoteTypeNames();
+const sql = require('./sql.js');
+const sqlInit = require('./sql_init.js');
+const log = require('./log.js');
+const ws = require('./ws.js');
+const syncMutexService = require('./sync_mutex.js');
+const cls = require('./cls.js');
+const entityChangesService = require('./entity_changes.js');
+const optionsService = require('./options.js');
+const BBranch = require('../becca/entities/bbranch.js');
+const revisionService = require('./revisions.js');
+const becca = require('../becca/becca.js');
+const utils = require('../services/utils.js');
+const eraseService = require('../services/erase.js');
+const {sanitizeAttributeName} = require('./sanitize_attribute_name.js');
+const noteTypes = require('../services/note_types.js').getNoteTypeNames();
class ConsistencyChecks {
constructor(autoFix) {
@@ -763,7 +763,7 @@ class ConsistencyChecks {
}
if (this.reloadNeeded) {
- require("../becca/becca_loader").reload("consistency checks need becca reload");
+ require('../becca/becca_loader.js').reload("consistency checks need becca reload");
}
return !this.unrecoveredConsistencyErrors;
diff --git a/src/services/content_hash.js b/src/services/content_hash.js
index f200aa81e..c9ca7fef6 100644
--- a/src/services/content_hash.js
+++ b/src/services/content_hash.js
@@ -1,9 +1,9 @@
"use strict";
-const sql = require('./sql');
-const utils = require('./utils');
-const log = require('./log');
-const eraseService = require("./erase");
+const sql = require('./sql.js');
+const utils = require('./utils.js');
+const log = require('./log.js');
+const eraseService = require('./erase.js');
function getEntityHashes() {
// blob erasure is not synced, we should check before each sync if there's some blob to erase
diff --git a/src/services/date_notes.js b/src/services/date_notes.js
index 7595a8604..69e2a06a0 100644
--- a/src/services/date_notes.js
+++ b/src/services/date_notes.js
@@ -1,13 +1,13 @@
"use strict";
-const noteService = require('./notes');
-const attributeService = require('./attributes');
-const dateUtils = require('./date_utils');
-const sql = require('./sql');
-const protectedSessionService = require('./protected_session');
-const searchService = require('../services/search/services/search');
-const SearchContext = require('../services/search/search_context');
-const hoistedNoteService = require("./hoisted_note");
+const noteService = require('./notes.js');
+const attributeService = require('./attributes.js');
+const dateUtils = require('./date_utils.js');
+const sql = require('./sql.js');
+const protectedSessionService = require('./protected_session.js');
+const searchService = require('../services/search/services/search.js');
+const SearchContext = require('../services/search/search_context.js');
+const hoistedNoteService = require('./hoisted_note.js');
const CALENDAR_ROOT_LABEL = 'calendarRoot';
const YEAR_LABEL = 'yearNote';
diff --git a/src/services/date_utils.js b/src/services/date_utils.js
index cc17a9036..4eb47bdb7 100644
--- a/src/services/date_utils.js
+++ b/src/services/date_utils.js
@@ -1,5 +1,5 @@
const dayjs = require('dayjs');
-const cls = require('./cls');
+const cls = require('./cls.js');
const LOCAL_DATETIME_FORMAT = 'YYYY-MM-DD HH:mm:ss.SSSZZ';
const UTC_DATETIME_FORMAT = 'YYYY-MM-DD HH:mm:ssZ';
diff --git a/src/services/encryption/data_encryption.js b/src/services/encryption/data_encryption.js
index 2b18058c5..6b81686ed 100644
--- a/src/services/encryption/data_encryption.js
+++ b/src/services/encryption/data_encryption.js
@@ -1,7 +1,7 @@
"use strict";
const crypto = require('crypto');
-const log = require('../log');
+const log = require('../log.js');
function arraysIdentical(a, b) {
let i = a.length;
diff --git a/src/services/encryption/my_scrypt.js b/src/services/encryption/my_scrypt.js
index b0a589bf1..bc01cdde7 100644
--- a/src/services/encryption/my_scrypt.js
+++ b/src/services/encryption/my_scrypt.js
@@ -1,6 +1,6 @@
"use strict";
-const optionService = require('../options');
+const optionService = require('../options.js');
const crypto = require('crypto');
function getVerificationHash(password) {
diff --git a/src/services/encryption/password.js b/src/services/encryption/password.js
index 30aa9cc14..563e86c02 100644
--- a/src/services/encryption/password.js
+++ b/src/services/encryption/password.js
@@ -1,10 +1,10 @@
"use strict";
-const sql = require('../sql');
-const optionService = require('../options');
-const myScryptService = require('./my_scrypt');
-const utils = require('../utils');
-const passwordEncryptionService = require('./password_encryption');
+const sql = require('../sql.js');
+const optionService = require('../options.js');
+const myScryptService = require('./my_scrypt.js');
+const utils = require('../utils.js');
+const passwordEncryptionService = require('./password_encryption.js');
function isPasswordSet() {
return !!sql.getValue("SELECT value FROM options WHERE name = 'passwordVerificationHash'");
diff --git a/src/services/encryption/password_encryption.js b/src/services/encryption/password_encryption.js
index 421cb16de..336be8f2f 100644
--- a/src/services/encryption/password_encryption.js
+++ b/src/services/encryption/password_encryption.js
@@ -1,7 +1,7 @@
-const optionService = require('../options');
-const myScryptService = require('./my_scrypt');
-const utils = require('../utils');
-const dataEncryptionService = require('./data_encryption');
+const optionService = require('../options.js');
+const myScryptService = require('./my_scrypt.js');
+const utils = require('../utils.js');
+const dataEncryptionService = require('./data_encryption.js');
function verifyPassword(password) {
const givenPasswordHash = utils.toBase64(myScryptService.getVerificationHash(password));
diff --git a/src/services/entity_changes.js b/src/services/entity_changes.js
index f1fd2eb5f..0e0a8ddb3 100644
--- a/src/services/entity_changes.js
+++ b/src/services/entity_changes.js
@@ -1,11 +1,11 @@
-const sql = require('./sql');
-const dateUtils = require('./date_utils');
-const log = require('./log');
-const cls = require('./cls');
-const utils = require('./utils');
-const instanceId = require('./instance_id');
-const becca = require("../becca/becca");
-const blobService = require("../services/blob");
+const sql = require('./sql.js');
+const dateUtils = require('./date_utils.js');
+const log = require('./log.js');
+const cls = require('./cls.js');
+const utils = require('./utils.js');
+const instanceId = require('./instance_id.js');
+const becca = require('../becca/becca.js');
+const blobService = require('../services/blob.js');
let maxEntityChangeId = 0;
@@ -53,7 +53,7 @@ function putNoteReorderingEntityChange(parentNoteId, componentId) {
instanceId
});
- const eventService = require('./events');
+ const eventService = require('./events.js');
eventService.emit(eventService.ENTITY_CHANGED, {
entityName: 'note_reordering',
diff --git a/src/services/etapi_tokens.js b/src/services/etapi_tokens.js
index dcf3a178f..4033b8016 100644
--- a/src/services/etapi_tokens.js
+++ b/src/services/etapi_tokens.js
@@ -1,6 +1,6 @@
-const becca = require("../becca/becca");
-const utils = require("./utils");
-const BEtapiToken = require("../becca/entities/betapi_token");
+const becca = require('../becca/becca.js');
+const utils = require('./utils.js');
+const BEtapiToken = require('../becca/entities/betapi_token.js');
const crypto = require("crypto");
function getTokens() {
diff --git a/src/services/events.js b/src/services/events.js
index 51c30be17..acb409107 100644
--- a/src/services/events.js
+++ b/src/services/events.js
@@ -1,4 +1,4 @@
-const log = require('./log');
+const log = require('./log.js');
const NOTE_TITLE_CHANGED = "NOTE_TITLE_CHANGED";
const ENTER_PROTECTED_SESSION = "ENTER_PROTECTED_SESSION";
diff --git a/src/services/export/opml.js b/src/services/export/opml.js
index 346a6b081..976fb5b24 100644
--- a/src/services/export/opml.js
+++ b/src/services/export/opml.js
@@ -1,7 +1,7 @@
"use strict";
-const utils = require('../utils');
-const becca = require("../../becca/becca");
+const utils = require('../utils.js');
+const becca = require('../../becca/becca.js');
function exportToOpml(taskContext, branch, version, res) {
if (!['1.0', '2.0'].includes(version)) {
diff --git a/src/services/export/single.js b/src/services/export/single.js
index 7d2b92b7b..a3bc03335 100644
--- a/src/services/export/single.js
+++ b/src/services/export/single.js
@@ -2,9 +2,9 @@
const mimeTypes = require('mime-types');
const html = require('html');
-const utils = require('../utils');
-const mdService = require('./md');
-const becca = require("../../becca/becca");
+const utils = require('../utils.js');
+const mdService = require('./md.js');
+const becca = require('../../becca/becca.js');
function exportSingleNote(taskContext, branch, format, res) {
const note = branch.getNote();
diff --git a/src/services/export/zip.js b/src/services/export/zip.js
index 152d4ae6b..0e6b11e46 100644
--- a/src/services/export/zip.js
+++ b/src/services/export/zip.js
@@ -1,24 +1,24 @@
"use strict";
const html = require('html');
-const dateUtils = require('../date_utils');
+const dateUtils = require('../date_utils.js');
const path = require('path');
const mimeTypes = require('mime-types');
-const mdService = require('./md');
+const mdService = require('./md.js');
const packageInfo = require('../../../package.json');
-const utils = require('../utils');
-const protectedSessionService = require('../protected_session');
+const utils = require('../utils.js');
+const protectedSessionService = require('../protected_session.js');
const sanitize = require("sanitize-filename");
const fs = require("fs");
-const becca = require("../../becca/becca");
-const RESOURCE_DIR = require('../../services/resource_dir').RESOURCE_DIR;
+const becca = require('../../becca/becca.js');
+const RESOURCE_DIR = require('../../services/resource_dir.js').RESOURCE_DIR;
const archiver = require('archiver');
-const log = require("../log");
-const TaskContext = require("../task_context");
-const ValidationError = require("../../errors/validation_error");
-const NoteMeta = require("../meta/note_meta");
-const AttachmentMeta = require("../meta/attachment_meta");
-const AttributeMeta = require("../meta/attribute_meta");
+const log = require('../log.js');
+const TaskContext = require('../task_context.js');
+const ValidationError = require('../../errors/validation_error.js');
+const NoteMeta = require('../meta/note_meta.js');
+const AttachmentMeta = require('../meta/attachment_meta.js');
+const AttributeMeta = require('../meta/attribute_meta.js');
/**
* @param {TaskContext} taskContext
diff --git a/src/services/handlers.js b/src/services/handlers.js
index 6dcb90e84..769c69485 100644
--- a/src/services/handlers.js
+++ b/src/services/handlers.js
@@ -1,11 +1,11 @@
-const eventService = require('./events');
-const scriptService = require('./script');
-const treeService = require('./tree');
-const noteService = require('./notes');
-const becca = require('../becca/becca');
-const BAttribute = require('../becca/entities/battribute');
-const hiddenSubtreeService = require("./hidden_subtree");
-const oneTimeTimer = require("./one_time_timer");
+const eventService = require('./events.js');
+const scriptService = require('./script.js');
+const treeService = require('./tree.js');
+const noteService = require('./notes.js');
+const becca = require('../becca/becca.js');
+const BAttribute = require('../becca/entities/battribute.js');
+const hiddenSubtreeService = require('./hidden_subtree.js');
+const oneTimeTimer = require('./one_time_timer.js');
function runAttachedRelations(note, relationName, originEntity) {
if (!note) {
diff --git a/src/services/hidden_subtree.js b/src/services/hidden_subtree.js
index 47d72dc18..9c2820943 100644
--- a/src/services/hidden_subtree.js
+++ b/src/services/hidden_subtree.js
@@ -1,8 +1,8 @@
-const becca = require("../becca/becca");
-const noteService = require("./notes");
-const BAttribute = require("../becca/entities/battribute");
-const log = require("./log");
-const migrationService = require("./migration");
+const becca = require('../becca/becca.js');
+const noteService = require('./notes.js');
+const BAttribute = require('../becca/entities/battribute.js');
+const log = require('./log.js');
+const migrationService = require('./migration.js');
const LBTPL_ROOT = "_lbTplRoot";
const LBTPL_BASE = "_lbTplBase";
diff --git a/src/services/hoisted_note.js b/src/services/hoisted_note.js
index de64f2da0..f3f4e5675 100644
--- a/src/services/hoisted_note.js
+++ b/src/services/hoisted_note.js
@@ -1,5 +1,5 @@
-const cls = require("./cls");
-const becca = require("../becca/becca");
+const cls = require('./cls.js');
+const becca = require('../becca/becca.js');
function getHoistedNoteId() {
return cls.getHoistedNoteId();
diff --git a/src/services/host.js b/src/services/host.js
index 389203e99..2430d45c2 100644
--- a/src/services/host.js
+++ b/src/services/host.js
@@ -1,3 +1,3 @@
-const config = require('./config');
+const config = require('./config.js');
module.exports = process.env.TRILIUM_HOST || config['Network']['host'] || '0.0.0.0';
diff --git a/src/services/image.js b/src/services/image.js
index 111a77771..5a45e85ca 100644
--- a/src/services/image.js
+++ b/src/services/image.js
@@ -1,17 +1,17 @@
"use strict";
-const becca = require('../becca/becca');
-const log = require('./log');
-const protectedSessionService = require('./protected_session');
-const noteService = require('./notes');
-const optionService = require('./options');
-const sql = require('./sql');
+const becca = require('../becca/becca.js');
+const log = require('./log.js');
+const protectedSessionService = require('./protected_session.js');
+const noteService = require('./notes.js');
+const optionService = require('./options.js');
+const sql = require('./sql.js');
const jimp = require('jimp');
const imageType = require('image-type');
const sanitizeFilename = require('sanitize-filename');
const isSvg = require('is-svg');
const isAnimated = require('is-animated');
-const htmlSanitizer = require("./html_sanitizer");
+const htmlSanitizer = require('./html_sanitizer.js');
async function processImage(uploadBuffer, originalName, shrinkImageSwitch) {
const compressImages = optionService.getOptionBool("compressImages");
@@ -154,7 +154,7 @@ function saveImageToAttachment(noteId, uploadBuffer, originalName, shrinkImageSw
setTimeout(() => {
sql.transactional(() => {
const note = becca.getNoteOrThrow(noteId);
- const noteService = require("../services/notes");
+ const noteService = require('../services/notes.js');
noteService.asyncPostProcessContent(note, note.getContent()); // to mark an unused attachment for deletion
});
}, 5000);
diff --git a/src/services/import/enex.js b/src/services/import/enex.js
index 5dcd9453b..2774155bd 100644
--- a/src/services/import/enex.js
+++ b/src/services/import/enex.js
@@ -1,14 +1,14 @@
const sax = require("sax");
const stream = require('stream');
const {Throttle} = require('stream-throttle');
-const log = require("../log");
-const utils = require("../utils");
-const sql = require("../sql");
-const noteService = require("../notes");
-const imageService = require("../image");
-const protectedSessionService = require('../protected_session');
-const htmlSanitizer = require("../html_sanitizer");
-const {sanitizeAttributeName} = require("../sanitize_attribute_name");
+const log = require('../log.js');
+const utils = require('../utils.js');
+const sql = require('../sql.js');
+const noteService = require('../notes.js');
+const imageService = require('../image.js');
+const protectedSessionService = require('../protected_session.js');
+const htmlSanitizer = require('../html_sanitizer.js');
+const {sanitizeAttributeName} = require('../sanitize_attribute_name.js');
/**
* date format is e.g. 20181121T193703Z or 2013-04-14T16:19:00.000Z (Mac evernote, see #3496)
diff --git a/src/services/import/markdown.js b/src/services/import/markdown.js
index e350cd065..90b6d1f43 100644
--- a/src/services/import/markdown.js
+++ b/src/services/import/markdown.js
@@ -1,8 +1,8 @@
"use strict";
const marked = require("marked");
-const htmlSanitizer = require("../html_sanitizer");
-const importUtils = require("./utils");
+const htmlSanitizer = require('../html_sanitizer.js');
+const importUtils = require('./utils.js');
function renderToHtml(content, title) {
const html = marked.parse(content, {
diff --git a/src/services/import/opml.js b/src/services/import/opml.js
index 2b99dbd85..eb7b891d6 100644
--- a/src/services/import/opml.js
+++ b/src/services/import/opml.js
@@ -1,9 +1,9 @@
"use strict";
-const noteService = require('../../services/notes');
+const noteService = require('../../services/notes.js');
const parseString = require('xml2js').parseString;
-const protectedSessionService = require('../protected_session');
-const htmlSanitizer = require('../html_sanitizer');
+const protectedSessionService = require('../protected_session.js');
+const htmlSanitizer = require('../html_sanitizer.js');
/**
* @param {TaskContext} taskContext
diff --git a/src/services/import/single.js b/src/services/import/single.js
index 31928e7fe..7d3ea164f 100644
--- a/src/services/import/single.js
+++ b/src/services/import/single.js
@@ -1,13 +1,13 @@
"use strict";
-const noteService = require('../../services/notes');
-const imageService = require('../../services/image');
-const protectedSessionService = require('../protected_session');
-const markdownService = require('./markdown');
-const mimeService = require('./mime');
-const utils = require('../../services/utils');
-const importUtils = require('./utils');
-const htmlSanitizer = require('../html_sanitizer');
+const noteService = require('../../services/notes.js');
+const imageService = require('../../services/image.js');
+const protectedSessionService = require('../protected_session.js');
+const markdownService = require('./markdown.js');
+const mimeService = require('./mime.js');
+const utils = require('../../services/utils.js');
+const importUtils = require('./utils.js');
+const htmlSanitizer = require('../html_sanitizer.js');
function importSingleFile(taskContext, file, parentNote) {
const mime = mimeService.getMime(file.originalname) || file.mimetype;
diff --git a/src/services/import/zip.js b/src/services/import/zip.js
index 64e3ff2d0..5097ba925 100644
--- a/src/services/import/zip.js
+++ b/src/services/import/zip.js
@@ -1,20 +1,20 @@
"use strict";
-const BAttribute = require('../../becca/entities/battribute');
-const utils = require('../../services/utils');
-const log = require('../../services/log');
-const noteService = require('../../services/notes');
-const attributeService = require('../../services/attributes');
-const BBranch = require('../../becca/entities/bbranch');
+const BAttribute = require('../../becca/entities/battribute.js');
+const utils = require('../../services/utils.js');
+const log = require('../../services/log.js');
+const noteService = require('../../services/notes.js');
+const attributeService = require('../../services/attributes.js');
+const BBranch = require('../../becca/entities/bbranch.js');
const path = require('path');
-const protectedSessionService = require('../protected_session');
-const mimeService = require("./mime");
-const treeService = require("../tree");
+const protectedSessionService = require('../protected_session.js');
+const mimeService = require('./mime.js');
+const treeService = require('../tree.js');
const yauzl = require("yauzl");
-const htmlSanitizer = require('../html_sanitizer');
-const becca = require("../../becca/becca");
-const BAttachment = require("../../becca/entities/battachment");
-const markdownService = require("./markdown");
+const htmlSanitizer = require('../html_sanitizer.js');
+const becca = require('../../becca/becca.js');
+const BAttachment = require('../../becca/entities/battachment.js');
+const markdownService = require('./markdown.js');
/**
* @param {TaskContext} taskContext
diff --git a/src/services/instance_id.js b/src/services/instance_id.js
index 4ee187b01..49f0a4209 100644
--- a/src/services/instance_id.js
+++ b/src/services/instance_id.js
@@ -1,4 +1,4 @@
-const utils = require('./utils');
+const utils = require('./utils.js');
const instanceId = utils.randomString(12);
diff --git a/src/services/keyboard_actions.js b/src/services/keyboard_actions.js
index 368e6db98..597e81c2f 100644
--- a/src/services/keyboard_actions.js
+++ b/src/services/keyboard_actions.js
@@ -1,8 +1,8 @@
"use strict";
-const optionService = require('./options');
-const log = require('./log');
-const utils = require('./utils');
+const optionService = require('./options.js');
+const log = require('./log.js');
+const utils = require('./utils.js');
const isMac = process.platform === "darwin";
const isElectron = utils.isElectron();
diff --git a/src/services/log.js b/src/services/log.js
index a141eae14..935d695ef 100644
--- a/src/services/log.js
+++ b/src/services/log.js
@@ -1,8 +1,8 @@
"use strict";
const fs = require('fs');
-const dataDir = require('./data_dir');
-const cls = require('./cls');
+const dataDir = require('./data_dir.js');
+const cls = require('./cls.js');
if (!fs.existsSync(dataDir.LOG_DIR)) {
fs.mkdirSync(dataDir.LOG_DIR, 0o700);
diff --git a/src/services/migration.js b/src/services/migration.js
index 58b910d7b..934d1fbab 100644
--- a/src/services/migration.js
+++ b/src/services/migration.js
@@ -1,10 +1,10 @@
-const backupService = require('./backup');
-const sql = require('./sql');
+const backupService = require('./backup.js');
+const sql = require('./sql.js');
const fs = require('fs-extra');
-const log = require('./log');
-const utils = require('./utils');
-const resourceDir = require('./resource_dir');
-const appInfo = require('./app_info');
+const log = require('./log.js');
+const utils = require('./utils.js');
+const resourceDir = require('./resource_dir.js');
+const appInfo = require('./app_info.js');
async function migrate() {
const currentDbVersion = getDbVersion();
diff --git a/src/services/notes.js b/src/services/notes.js
index b89755393..7293e23d2 100644
--- a/src/services/notes.js
+++ b/src/services/notes.js
@@ -1,27 +1,27 @@
-const sql = require('./sql');
-const optionService = require('./options');
-const dateUtils = require('./date_utils');
-const entityChangesService = require('./entity_changes');
-const eventService = require('./events');
-const cls = require('../services/cls');
-const protectedSessionService = require('../services/protected_session');
-const log = require('../services/log');
-const utils = require('../services/utils');
-const revisionService = require('./revisions');
-const request = require('./request');
+const sql = require('./sql.js');
+const optionService = require('./options.js');
+const dateUtils = require('./date_utils.js');
+const entityChangesService = require('./entity_changes.js');
+const eventService = require('./events.js');
+const cls = require('../services/cls.js');
+const protectedSessionService = require('../services/protected_session.js');
+const log = require('../services/log.js');
+const utils = require('../services/utils.js');
+const revisionService = require('./revisions.js');
+const request = require('./request.js');
const path = require('path');
const url = require('url');
-const becca = require('../becca/becca');
-const BBranch = require('../becca/entities/bbranch');
-const BNote = require('../becca/entities/bnote');
-const BAttribute = require('../becca/entities/battribute');
-const BAttachment = require("../becca/entities/battachment");
+const becca = require('../becca/becca.js');
+const BBranch = require('../becca/entities/bbranch.js');
+const BNote = require('../becca/entities/bnote.js');
+const BAttribute = require('../becca/entities/battribute.js');
+const BAttachment = require('../becca/entities/battachment.js');
const dayjs = require("dayjs");
-const htmlSanitizer = require("./html_sanitizer");
-const ValidationError = require("../errors/validation_error");
-const noteTypesService = require("./note_types");
+const htmlSanitizer = require('./html_sanitizer.js');
+const ValidationError = require('../errors/validation_error.js');
+const noteTypesService = require('./note_types.js');
const fs = require("fs");
-const ws = require("./ws");
+const ws = require('./ws.js');
const html2plaintext = require('html2plaintext')
/** @param {BNote} parentNote */
@@ -493,7 +493,7 @@ async function downloadImage(noteId, imageUrl) {
const parsedUrl = url.parse(imageUrl);
const title = path.basename(parsedUrl.pathname);
- const imageService = require('../services/image');
+ const imageService = require('../services/image.js');
const {attachment} = imageService.saveImageToAttachment(noteId, imageBuffer, title, true, true);
imageUrlToAttachmentIdMapping[imageUrl] = attachment.attachmentId;
@@ -526,7 +526,7 @@ function downloadImages(noteId, content) {
const imageBase64 = url.substr(inlineImageMatch[0].length);
const imageBuffer = Buffer.from(imageBase64, 'base64');
- const imageService = require('../services/image');
+ const imageService = require('../services/image.js');
const attachment = imageService.saveImageToAttachment(noteId, imageBuffer, "inline image", true, true);
const sanitizedTitle = attachment.title.replace(/[^a-z0-9-.]/gi, "");
diff --git a/src/services/options.js b/src/services/options.js
index 1ddf3fe6a..6c33b9478 100644
--- a/src/services/options.js
+++ b/src/services/options.js
@@ -1,5 +1,5 @@
-const becca = require('../becca/becca');
-const sql = require("./sql");
+const becca = require('../becca/becca.js');
+const sql = require('./sql.js');
/** @returns {string|null} */
function getOptionOrNull(name) {
@@ -73,7 +73,7 @@ function setOption(name, value) {
function createOption(name, value, isSynced) {
// to avoid circular dependency, need to find a better solution
- const BOption = require('../becca/entities/boption');
+ const BOption = require('../becca/entities/boption.js');
new BOption({
name: name,
diff --git a/src/services/options_init.js b/src/services/options_init.js
index d601353af..95514d6d6 100644
--- a/src/services/options_init.js
+++ b/src/services/options_init.js
@@ -1,9 +1,9 @@
-const optionService = require('./options');
-const appInfo = require('./app_info');
-const utils = require('./utils');
-const log = require('./log');
-const dateUtils = require('./date_utils');
-const keyboardActions = require('./keyboard_actions');
+const optionService = require('./options.js');
+const appInfo = require('./app_info.js');
+const utils = require('./utils.js');
+const log = require('./log.js');
+const dateUtils = require('./date_utils.js');
+const keyboardActions = require('./keyboard_actions.js');
function initDocumentOptions() {
optionService.createOption('documentId', utils.randomSecureToken(16), false);
diff --git a/src/services/port.js b/src/services/port.js
index c57f22a5d..938eb3324 100644
--- a/src/services/port.js
+++ b/src/services/port.js
@@ -1,7 +1,7 @@
-const config = require('./config');
-const utils = require('./utils');
-const env = require('./env');
-const dataDir = require('./data_dir');
+const config = require('./config.js');
+const utils = require('./utils.js');
+const env = require('./env.js');
+const dataDir = require('./data_dir.js');
function parseAndValidate(portStr, source) {
const portNum = parseInt(portStr);
diff --git a/src/services/protected_session.js b/src/services/protected_session.js
index 120e9d60e..2ade5e338 100644
--- a/src/services/protected_session.js
+++ b/src/services/protected_session.js
@@ -1,7 +1,7 @@
"use strict";
-const log = require('./log');
-const dataEncryptionService = require('./encryption/data_encryption');
+const log = require('./log.js');
+const dataEncryptionService = require('./encryption/data_encryption.js');
let dataKey = null;
@@ -50,7 +50,7 @@ function touchProtectedSession() {
}
function checkProtectedSessionExpiration() {
- const options = require("./options");
+ const options = require('./options.js');
const protectedSessionTimeout = options.getOptionInt('protectedSessionTimeout');
if (isProtectedSessionAvailable()
&& lastProtectedSessionOperationDate
@@ -60,7 +60,7 @@ function checkProtectedSessionExpiration() {
log.info("Expiring protected session");
- require('./ws').reloadFrontend("leaving protected session");
+ require('./ws.js').reloadFrontend("leaving protected session");
}
}
diff --git a/src/services/request.js b/src/services/request.js
index 5a7158007..0334c0986 100644
--- a/src/services/request.js
+++ b/src/services/request.js
@@ -1,9 +1,9 @@
"use strict";
-const utils = require('./utils');
-const log = require('./log');
+const utils = require('./utils.js');
+const log = require('./log.js');
const url = require('url');
-const syncOptions = require('./sync_options');
+const syncOptions = require('./sync_options.js');
// this service provides abstraction over node's HTTP/HTTPS and electron net.client APIs
// this allows supporting system proxy
diff --git a/src/services/resource_dir.js b/src/services/resource_dir.js
index 4f3710e18..088a6d7d3 100644
--- a/src/services/resource_dir.js
+++ b/src/services/resource_dir.js
@@ -1,4 +1,4 @@
-const log = require('./log');
+const log = require('./log.js');
const path = require('path');
const fs = require('fs');
diff --git a/src/services/revisions.js b/src/services/revisions.js
index d7b059efa..b55c386b4 100644
--- a/src/services/revisions.js
+++ b/src/services/revisions.js
@@ -1,9 +1,9 @@
"use strict";
-const log = require('./log');
-const sql = require('./sql');
-const protectedSessionService = require("./protected_session");
-const dateUtils = require("./date_utils");
+const log = require('./log.js');
+const sql = require('./sql.js');
+const protectedSessionService = require('./protected_session.js');
+const dateUtils = require('./date_utils.js');
/**
* @param {BNote} note
diff --git a/src/services/scheduler.js b/src/services/scheduler.js
index 45b973601..48a19815a 100644
--- a/src/services/scheduler.js
+++ b/src/services/scheduler.js
@@ -1,11 +1,11 @@
-const scriptService = require('./script');
-const cls = require('./cls');
-const sqlInit = require('./sql_init');
-const config = require('./config');
-const log = require('./log');
-const attributeService = require("../services/attributes");
-const protectedSessionService = require("../services/protected_session");
-const hiddenSubtreeService = require("./hidden_subtree");
+const scriptService = require('./script.js');
+const cls = require('./cls.js');
+const sqlInit = require('./sql_init.js');
+const config = require('./config.js');
+const log = require('./log.js');
+const attributeService = require('../services/attributes.js');
+const protectedSessionService = require('../services/protected_session.js');
+const hiddenSubtreeService = require('./hidden_subtree.js');
/**
* @param {BNote} note
diff --git a/src/services/script.js b/src/services/script.js
index 5650b8a9d..6119075e3 100644
--- a/src/services/script.js
+++ b/src/services/script.js
@@ -1,7 +1,7 @@
-const ScriptContext = require('./script_context');
-const cls = require('./cls');
-const log = require('./log');
-const becca = require("../becca/becca");
+const ScriptContext = require('./script_context.js');
+const cls = require('./cls.js');
+const log = require('./log.js');
+const becca = require('../becca/becca.js');
function executeNote(note, apiParams) {
if (!note.isJavaScript() || note.getScriptEnv() !== 'backend' || !note.isContentAvailable()) {
diff --git a/src/services/script_context.js b/src/services/script_context.js
index c65558aaa..67400d630 100644
--- a/src/services/script_context.js
+++ b/src/services/script_context.js
@@ -1,5 +1,5 @@
-const utils = require('./utils');
-const BackendScriptApi = require('./backend_script_api');
+const utils = require('./utils.js');
+const BackendScriptApi = require('./backend_script_api.js');
function ScriptContext(allNotes, apiParams = {}) {
this.modules = {};
@@ -19,4 +19,4 @@ function ScriptContext(allNotes, apiParams = {}) {
};
}
-module.exports = ScriptContext;
\ No newline at end of file
+module.exports = ScriptContext;
diff --git a/src/services/search/expressions/ancestor.js b/src/services/search/expressions/ancestor.js
index f48e9e59f..57c3adb5f 100644
--- a/src/services/search/expressions/ancestor.js
+++ b/src/services/search/expressions/ancestor.js
@@ -1,9 +1,9 @@
"use strict";
-const Expression = require('./expression');
-const NoteSet = require('../note_set');
-const log = require('../../log');
-const becca = require('../../../becca/becca');
+const Expression = require('./expression.js');
+const NoteSet = require('../note_set.js');
+const log = require('../../log.js');
+const becca = require('../../../becca/becca.js');
class AncestorExp extends Expression {
constructor(ancestorNoteId, ancestorDepth) {
diff --git a/src/services/search/expressions/and.js b/src/services/search/expressions/and.js
index eacb1d0a1..a0dd35047 100644
--- a/src/services/search/expressions/and.js
+++ b/src/services/search/expressions/and.js
@@ -1,7 +1,7 @@
"use strict";
-const Expression = require('./expression');
-const TrueExp = require("./true");
+const Expression = require('./expression.js');
+const TrueExp = require('./true.js');
class AndExp extends Expression {
static of(subExpressions) {
diff --git a/src/services/search/expressions/attribute_exists.js b/src/services/search/expressions/attribute_exists.js
index 6d2e92d64..f9be65689 100644
--- a/src/services/search/expressions/attribute_exists.js
+++ b/src/services/search/expressions/attribute_exists.js
@@ -1,8 +1,8 @@
"use strict";
-const NoteSet = require('../note_set');
-const becca = require('../../../becca/becca');
-const Expression = require('./expression');
+const NoteSet = require('../note_set.js');
+const becca = require('../../../becca/becca.js');
+const Expression = require('./expression.js');
class AttributeExistsExp extends Expression {
constructor(attributeType, attributeName, prefixMatch) {
diff --git a/src/services/search/expressions/child_of.js b/src/services/search/expressions/child_of.js
index bbfc4a6ef..d53b49c20 100644
--- a/src/services/search/expressions/child_of.js
+++ b/src/services/search/expressions/child_of.js
@@ -1,7 +1,7 @@
"use strict";
-const Expression = require('./expression');
-const NoteSet = require('../note_set');
+const Expression = require('./expression.js');
+const NoteSet = require('../note_set.js');
class ChildOfExp extends Expression {
constructor(subExpression) {
diff --git a/src/services/search/expressions/descendant_of.js b/src/services/search/expressions/descendant_of.js
index 918bd352e..fa0e50dd3 100644
--- a/src/services/search/expressions/descendant_of.js
+++ b/src/services/search/expressions/descendant_of.js
@@ -1,8 +1,8 @@
"use strict";
-const Expression = require('./expression');
-const NoteSet = require('../note_set');
-const becca = require('../../../becca/becca');
+const Expression = require('./expression.js');
+const NoteSet = require('../note_set.js');
+const becca = require('../../../becca/becca.js');
class DescendantOfExp extends Expression {
constructor(subExpression) {
diff --git a/src/services/search/expressions/is_hidden.js b/src/services/search/expressions/is_hidden.js
index 9fb59cec3..32f33b512 100644
--- a/src/services/search/expressions/is_hidden.js
+++ b/src/services/search/expressions/is_hidden.js
@@ -1,7 +1,7 @@
"use strict";
-const Expression = require('./expression');
-const NoteSet = require('../note_set');
+const Expression = require('./expression.js');
+const NoteSet = require('../note_set.js');
/**
* Note is hidden when all its note paths start in hidden subtree (i.e., the note is not cloned into visible tree)
diff --git a/src/services/search/expressions/label_comparison.js b/src/services/search/expressions/label_comparison.js
index 1d6f7572b..0bc27ff0c 100644
--- a/src/services/search/expressions/label_comparison.js
+++ b/src/services/search/expressions/label_comparison.js
@@ -1,8 +1,8 @@
"use strict";
-const Expression = require('./expression');
-const NoteSet = require('../note_set');
-const becca = require('../../../becca/becca');
+const Expression = require('./expression.js');
+const NoteSet = require('../note_set.js');
+const becca = require('../../../becca/becca.js');
class LabelComparisonExp extends Expression {
constructor(attributeType, attributeName, comparator) {
diff --git a/src/services/search/expressions/not.js b/src/services/search/expressions/not.js
index 3117b4a01..2efd741e2 100644
--- a/src/services/search/expressions/not.js
+++ b/src/services/search/expressions/not.js
@@ -1,6 +1,6 @@
"use strict";
-const Expression = require('./expression');
+const Expression = require('./expression.js');
class NotExp extends Expression {
constructor(subExpression) {
diff --git a/src/services/search/expressions/note_content_fulltext.js b/src/services/search/expressions/note_content_fulltext.js
index a194ad448..86b08c469 100644
--- a/src/services/search/expressions/note_content_fulltext.js
+++ b/src/services/search/expressions/note_content_fulltext.js
@@ -1,12 +1,12 @@
"use strict";
-const Expression = require('./expression');
-const NoteSet = require('../note_set');
-const log = require('../../log');
-const becca = require('../../../becca/becca');
-const protectedSessionService = require('../../protected_session');
+const Expression = require('./expression.js');
+const NoteSet = require('../note_set.js');
+const log = require('../../log.js');
+const becca = require('../../../becca/becca.js');
+const protectedSessionService = require('../../protected_session.js');
const striptags = require('striptags');
-const utils = require("../../utils");
+const utils = require('../../utils.js');
const ALLOWED_OPERATORS = ['=', '!=', '*=*', '*=', '=*', '%='];
@@ -38,7 +38,7 @@ class NoteContentFulltextExp extends Expression {
}
const resultNoteSet = new NoteSet();
- const sql = require('../../sql');
+ const sql = require('../../sql.js');
for (const row of sql.iterateRows(`
SELECT noteId, type, mime, content, isProtected
diff --git a/src/services/search/expressions/note_flat_text.js b/src/services/search/expressions/note_flat_text.js
index 3703b5a2f..11cc466ec 100644
--- a/src/services/search/expressions/note_flat_text.js
+++ b/src/services/search/expressions/note_flat_text.js
@@ -1,9 +1,9 @@
"use strict";
-const Expression = require('./expression');
-const NoteSet = require('../note_set');
-const becca = require('../../../becca/becca');
-const utils = require("../../utils");
+const Expression = require('./expression.js');
+const NoteSet = require('../note_set.js');
+const becca = require('../../../becca/becca.js');
+const utils = require('../../utils.js');
class NoteFlatTextExp extends Expression {
constructor(tokens) {
@@ -14,7 +14,7 @@ class NoteFlatTextExp extends Expression {
execute(inputNoteSet, executionContext, searchContext) {
// has deps on SQL which breaks unit test so needs to be dynamically required
- const beccaService = require('../../../becca/becca_service');
+ const beccaService = require('../../../becca/becca_service.js');
const resultNoteSet = new NoteSet();
/**
diff --git a/src/services/search/expressions/or.js b/src/services/search/expressions/or.js
index 2927882af..1704b5c60 100644
--- a/src/services/search/expressions/or.js
+++ b/src/services/search/expressions/or.js
@@ -1,8 +1,8 @@
"use strict";
-const Expression = require('./expression');
-const NoteSet = require('../note_set');
-const TrueExp = require("./true");
+const Expression = require('./expression.js');
+const NoteSet = require('../note_set.js');
+const TrueExp = require('./true.js');
class OrExp extends Expression {
static of(subExpressions) {
diff --git a/src/services/search/expressions/order_by_and_limit.js b/src/services/search/expressions/order_by_and_limit.js
index 2de6547ed..c00f361f1 100644
--- a/src/services/search/expressions/order_by_and_limit.js
+++ b/src/services/search/expressions/order_by_and_limit.js
@@ -1,7 +1,7 @@
"use strict";
-const Expression = require('./expression');
-const NoteSet = require('../note_set');
+const Expression = require('./expression.js');
+const NoteSet = require('../note_set.js');
class OrderByAndLimitExp extends Expression {
constructor(orderDefinitions, limit) {
diff --git a/src/services/search/expressions/parent_of.js b/src/services/search/expressions/parent_of.js
index 9a474ed40..2243d3540 100644
--- a/src/services/search/expressions/parent_of.js
+++ b/src/services/search/expressions/parent_of.js
@@ -1,7 +1,7 @@
"use strict";
-const Expression = require('./expression');
-const NoteSet = require('../note_set');
+const Expression = require('./expression.js');
+const NoteSet = require('../note_set.js');
class ParentOfExp extends Expression {
constructor(subExpression) {
diff --git a/src/services/search/expressions/property_comparison.js b/src/services/search/expressions/property_comparison.js
index f4183988e..9b014a642 100644
--- a/src/services/search/expressions/property_comparison.js
+++ b/src/services/search/expressions/property_comparison.js
@@ -1,8 +1,8 @@
"use strict";
-const Expression = require('./expression');
-const NoteSet = require('../note_set');
-const buildComparator = require("../services/build_comparator");
+const Expression = require('./expression.js');
+const NoteSet = require('../note_set.js');
+const buildComparator = require('../services/build_comparator.js');
/**
* Search string is lower cased for case-insensitive comparison. But when retrieving properties,
diff --git a/src/services/search/expressions/relation_where.js b/src/services/search/expressions/relation_where.js
index 33d4e8f59..dee56b1dd 100644
--- a/src/services/search/expressions/relation_where.js
+++ b/src/services/search/expressions/relation_where.js
@@ -1,8 +1,8 @@
"use strict";
-const Expression = require('./expression');
-const NoteSet = require('../note_set');
-const becca = require('../../../becca/becca');
+const Expression = require('./expression.js');
+const NoteSet = require('../note_set.js');
+const becca = require('../../../becca/becca.js');
class RelationWhereExp extends Expression {
constructor(relationName, subExpression) {
diff --git a/src/services/search/expressions/true.js b/src/services/search/expressions/true.js
index fd685cc17..7dbf35c27 100644
--- a/src/services/search/expressions/true.js
+++ b/src/services/search/expressions/true.js
@@ -1,6 +1,6 @@
"use strict";
-const Expression = require('./expression');
+const Expression = require('./expression.js');
class TrueExp extends Expression {
execute(inputNoteSet, executionContext, searchContext) {
diff --git a/src/services/search/search_context.js b/src/services/search/search_context.js
index 8db266e33..6827e3841 100644
--- a/src/services/search/search_context.js
+++ b/src/services/search/search_context.js
@@ -1,6 +1,6 @@
"use strict";
-const hoistedNoteService = require("../hoisted_note");
+const hoistedNoteService = require('../hoisted_note.js');
class SearchContext {
constructor(params = {}) {
diff --git a/src/services/search/search_result.js b/src/services/search/search_result.js
index ca3811f8e..3a094bc8c 100644
--- a/src/services/search/search_result.js
+++ b/src/services/search/search_result.js
@@ -1,7 +1,7 @@
"use strict";
-const beccaService = require('../../becca/becca_service');
-const becca = require('../../becca/becca');
+const beccaService = require('../../becca/becca_service.js');
+const becca = require('../../becca/becca.js');
class SearchResult {
constructor(notePathArray) {
diff --git a/src/services/search/services/parse.js b/src/services/search/services/parse.js
index 1580caa37..b31ea265d 100644
--- a/src/services/search/services/parse.js
+++ b/src/services/search/services/parse.js
@@ -1,25 +1,25 @@
"use strict";
const dayjs = require("dayjs");
-const AndExp = require('../expressions/and');
-const OrExp = require('../expressions/or');
-const NotExp = require('../expressions/not');
-const ChildOfExp = require('../expressions/child_of');
-const DescendantOfExp = require('../expressions/descendant_of');
-const ParentOfExp = require('../expressions/parent_of');
-const RelationWhereExp = require('../expressions/relation_where');
-const PropertyComparisonExp = require('../expressions/property_comparison');
-const AttributeExistsExp = require('../expressions/attribute_exists');
-const LabelComparisonExp = require('../expressions/label_comparison');
-const NoteFlatTextExp = require('../expressions/note_flat_text');
-const NoteContentFulltextExp = require('../expressions/note_content_fulltext');
-const OrderByAndLimitExp = require('../expressions/order_by_and_limit');
-const AncestorExp = require("../expressions/ancestor");
-const buildComparator = require('./build_comparator');
-const ValueExtractor = require('../value_extractor');
-const utils = require("../../utils");
-const TrueExp = require("../expressions/true");
-const IsHiddenExp = require("../expressions/is_hidden");
+const AndExp = require('../expressions/and.js');
+const OrExp = require('../expressions/or.js');
+const NotExp = require('../expressions/not.js');
+const ChildOfExp = require('../expressions/child_of.js');
+const DescendantOfExp = require('../expressions/descendant_of.js');
+const ParentOfExp = require('../expressions/parent_of.js');
+const RelationWhereExp = require('../expressions/relation_where.js');
+const PropertyComparisonExp = require('../expressions/property_comparison.js');
+const AttributeExistsExp = require('../expressions/attribute_exists.js');
+const LabelComparisonExp = require('../expressions/label_comparison.js');
+const NoteFlatTextExp = require('../expressions/note_flat_text.js');
+const NoteContentFulltextExp = require('../expressions/note_content_fulltext.js');
+const OrderByAndLimitExp = require('../expressions/order_by_and_limit.js');
+const AncestorExp = require('../expressions/ancestor.js');
+const buildComparator = require('./build_comparator.js');
+const ValueExtractor = require('../value_extractor.js');
+const utils = require('../../utils.js');
+const TrueExp = require('../expressions/true.js');
+const IsHiddenExp = require('../expressions/is_hidden.js');
function getFulltext(tokens, searchContext) {
tokens = tokens.map(t => utils.removeDiacritic(t.token));
diff --git a/src/services/search/services/search.js b/src/services/search/services/search.js
index a174e37b5..e1ceed086 100644
--- a/src/services/search/services/search.js
+++ b/src/services/search/services/search.js
@@ -1,16 +1,16 @@
"use strict";
const normalizeString = require("normalize-strings");
-const lex = require('./lex');
-const handleParens = require('./handle_parens');
-const parse = require('./parse');
-const SearchResult = require("../search_result");
-const SearchContext = require("../search_context");
-const becca = require('../../../becca/becca');
-const beccaService = require('../../../becca/becca_service');
-const utils = require('../../utils');
-const log = require('../../log');
-const hoistedNoteService = require("../../hoisted_note");
+const lex = require('./lex.js');
+const handleParens = require('./handle_parens.js');
+const parse = require('./parse.js');
+const SearchResult = require('../search_result.js');
+const SearchContext = require('../search_context.js');
+const becca = require('../../../becca/becca.js');
+const beccaService = require('../../../becca/becca_service.js');
+const utils = require('../../utils.js');
+const log = require('../../log.js');
+const hoistedNoteService = require('../../hoisted_note.js');
function searchFromNote(note) {
let searchResultNoteIds, highlightedTokens;
@@ -72,7 +72,7 @@ function searchFromRelation(note, relationName) {
return [];
}
- const scriptService = require("../../script"); // to avoid circular dependency
+ const scriptService = require('../../script.js'); // to avoid circular dependency
const result = scriptService.executeNote(scriptNote, {originEntity: note});
if (!Array.isArray(result)) {
@@ -90,7 +90,7 @@ function searchFromRelation(note, relationName) {
}
function loadNeededInfoFromDatabase() {
- const sql = require('../../sql');
+ const sql = require('../../sql.js');
/**
* This complex structure is needed to calculate total occupied space by a note. Several object instances
diff --git a/src/services/session_secret.js b/src/services/session_secret.js
index f7ff8ef03..90eaa65bc 100644
--- a/src/services/session_secret.js
+++ b/src/services/session_secret.js
@@ -2,8 +2,8 @@
const fs = require('fs');
const crypto = require('crypto');
-const dataDir = require('./data_dir');
-const log = require('./log');
+const dataDir = require('./data_dir.js');
+const log = require('./log.js');
const sessionSecretPath = `${dataDir.TRILIUM_DATA_DIR}/session_secret.txt`;
@@ -26,4 +26,4 @@ else {
sessionSecret = fs.readFileSync(sessionSecretPath, 'ASCII');
}
-module.exports = sessionSecret;
\ No newline at end of file
+module.exports = sessionSecret;
diff --git a/src/services/setup.js b/src/services/setup.js
index be1d0df05..67eb7f3ce 100644
--- a/src/services/setup.js
+++ b/src/services/setup.js
@@ -1,12 +1,12 @@
-const syncService = require('./sync');
-const log = require('./log');
-const sqlInit = require('./sql_init');
-const optionService = require('./options');
-const syncOptions = require('./sync_options');
-const request = require('./request');
-const appInfo = require('./app_info');
-const utils = require('./utils');
-const becca = require("../becca/becca");
+const syncService = require('./sync.js');
+const log = require('./log.js');
+const sqlInit = require('./sql_init.js');
+const optionService = require('./options.js');
+const syncOptions = require('./sync_options.js');
+const request = require('./request.js');
+const appInfo = require('./app_info.js');
+const utils = require('./utils.js');
+const becca = require('../becca/becca.js');
async function hasSyncServerSchemaAndSeed() {
const response = await requestToSyncServer('GET', '/api/setup/status');
diff --git a/src/services/special_notes.js b/src/services/special_notes.js
index 20426eb40..60d202df0 100644
--- a/src/services/special_notes.js
+++ b/src/services/special_notes.js
@@ -1,13 +1,13 @@
-const attributeService = require("./attributes");
-const dateNoteService = require("./date_notes");
-const becca = require("../becca/becca");
-const noteService = require("./notes");
-const dateUtils = require("./date_utils");
-const log = require("./log");
-const hoistedNoteService = require("./hoisted_note");
-const searchService = require("./search/services/search");
-const SearchContext = require("./search/search_context");
-const {LBTPL_NOTE_LAUNCHER, LBTPL_CUSTOM_WIDGET, LBTPL_SPACER, LBTPL_SCRIPT} = require("./hidden_subtree");
+const attributeService = require('./attributes.js');
+const dateNoteService = require('./date_notes.js');
+const becca = require('../becca/becca.js');
+const noteService = require('./notes.js');
+const dateUtils = require('./date_utils.js');
+const log = require('./log.js');
+const hoistedNoteService = require('./hoisted_note.js');
+const searchService = require('./search/services/search.js');
+const SearchContext = require('./search/search_context.js');
+const {LBTPL_NOTE_LAUNCHER, LBTPL_CUSTOM_WIDGET, LBTPL_SPACER, LBTPL_SCRIPT} = require('./hidden_subtree.js');
function getInboxNote(date) {
const workspaceNote = hoistedNoteService.getWorkspaceNote();
diff --git a/src/services/sql.js b/src/services/sql.js
index 4343f4962..38cbabe19 100644
--- a/src/services/sql.js
+++ b/src/services/sql.js
@@ -4,10 +4,10 @@
* @module sql
*/
-const log = require('./log');
+const log = require('./log.js');
const Database = require('better-sqlite3');
-const dataDir = require('./data_dir');
-const cls = require('./cls');
+const dataDir = require('./data_dir.js');
+const cls = require('./cls.js');
const fs = require("fs-extra");
const dbConnection = new Database(dataDir.DOCUMENT_PATH);
@@ -242,7 +242,7 @@ function transactional(func) {
const ret = dbConnection.transaction(func).deferred();
if (!dbConnection.inTransaction) { // i.e. transaction was really committed (and not just savepoint released)
- require('./ws').sendTransactionEntityChangesToAllClients();
+ require('./ws.js').sendTransactionEntityChangesToAllClients();
}
return ret;
@@ -253,11 +253,11 @@ function transactional(func) {
if (entityChangeIds.length > 0) {
log.info("Transaction rollback dirtied the becca, forcing reload.");
- require('../becca/becca_loader').load();
+ require('../becca/becca_loader.js').load();
}
// the maxEntityChangeId has been incremented during failed transaction, need to recalculate
- require('./entity_changes').recalculateMaxEntityChangeId();
+ require('./entity_changes.js').recalculateMaxEntityChangeId();
throw e;
}
diff --git a/src/services/sql_init.js b/src/services/sql_init.js
index 47e6b8733..f1b4e9152 100644
--- a/src/services/sql_init.js
+++ b/src/services/sql_init.js
@@ -1,15 +1,15 @@
-const log = require('./log');
+const log = require('./log.js');
const fs = require('fs');
-const resourceDir = require('./resource_dir');
-const sql = require('./sql');
-const utils = require('./utils');
-const optionService = require('./options');
-const port = require('./port');
-const BOption = require('../becca/entities/boption');
-const TaskContext = require('./task_context');
-const migrationService = require('./migration');
-const cls = require('./cls');
-const config = require('./config');
+const resourceDir = require('./resource_dir.js');
+const sql = require('./sql.js');
+const utils = require('./utils.js');
+const optionService = require('./options.js');
+const port = require('./port.js');
+const BOption = require('../becca/entities/boption.js');
+const TaskContext = require('./task_context.js');
+const migrationService = require('./migration.js');
+const cls = require('./cls.js');
+const config = require('./config.js');
const dbReady = utils.deferred();
@@ -60,10 +60,10 @@ async function createInitialDatabase() {
sql.executeScript(schema);
- require("../becca/becca_loader").load();
+ require('../becca/becca_loader.js').load();
- const BNote = require("../becca/entities/bnote");
- const BBranch = require("../becca/entities/bbranch");
+ const BNote = require('../becca/entities/bnote.js');
+ const BBranch = require('../becca/entities/bbranch.js');
log.info("Creating root note ...");
@@ -83,19 +83,19 @@ async function createInitialDatabase() {
notePosition: 10
}).save();
- const optionsInitService = require('./options_init');
+ const optionsInitService = require('./options_init.js');
optionsInitService.initDocumentOptions();
optionsInitService.initNotSyncedOptions(true, {});
optionsInitService.initStartupOptions();
- require("./encryption/password").resetPassword();
+ require('./encryption/password.js').resetPassword();
});
log.info("Importing demo content ...");
const dummyTaskContext = new TaskContext("no-progress-reporting", 'import', false);
- const zipImportService = require("./import/zip");
+ const zipImportService = require('./import/zip.js');
await zipImportService.importZip(dummyTaskContext, demoFile, rootNote);
sql.transactional(() => {
@@ -105,7 +105,7 @@ async function createInitialDatabase() {
const startNoteId = sql.getValue("SELECT noteId FROM branches WHERE parentNoteId = 'root' AND isDeleted = 0 ORDER BY notePosition");
- const optionService = require("./options");
+ const optionService = require('./options.js');
optionService.setOption('openNoteContexts', JSON.stringify([
{
notePath: startNoteId,
@@ -131,7 +131,7 @@ function createDatabaseForSync(options, syncServerHost = '', syncProxy = '') {
sql.transactional(() => {
sql.executeScript(schema);
- require('./options_init').initNotSyncedOptions(false, { syncServerHost, syncProxy });
+ require('./options_init.js').initNotSyncedOptions(false, { syncServerHost, syncProxy });
// document options required for sync to kick off
for (const opt of options) {
@@ -166,10 +166,10 @@ dbReady.then(() => {
return;
}
- setInterval(() => require('./backup').regularBackup(), 4 * 60 * 60 * 1000);
+ setInterval(() => require('./backup.js').regularBackup(), 4 * 60 * 60 * 1000);
// kickoff first backup soon after start up
- setTimeout(() => require('./backup').regularBackup(), 5 * 60 * 1000);
+ setTimeout(() => require('./backup.js').regularBackup(), 5 * 60 * 1000);
// optimize is usually inexpensive no-op, so running it semi-frequently is not a big deal
setTimeout(() => optimize(), 60 * 60 * 1000);
diff --git a/src/services/sync.js b/src/services/sync.js
index ad59f77be..fbafdfcfa 100644
--- a/src/services/sync.js
+++ b/src/services/sync.js
@@ -1,22 +1,22 @@
"use strict";
-const log = require('./log');
-const sql = require('./sql');
-const optionService = require('./options');
-const utils = require('./utils');
-const instanceId = require('./instance_id');
-const dateUtils = require('./date_utils');
-const syncUpdateService = require('./sync_update');
-const contentHashService = require('./content_hash');
-const appInfo = require('./app_info');
-const syncOptions = require('./sync_options');
-const syncMutexService = require('./sync_mutex');
-const cls = require('./cls');
-const request = require('./request');
-const ws = require('./ws');
-const entityChangesService = require('./entity_changes');
-const entityConstructor = require('../becca/entity_constructor');
-const becca = require("../becca/becca");
+const log = require('./log.js');
+const sql = require('./sql.js');
+const optionService = require('./options.js');
+const utils = require('./utils.js');
+const instanceId = require('./instance_id.js');
+const dateUtils = require('./date_utils.js');
+const syncUpdateService = require('./sync_update.js');
+const contentHashService = require('./content_hash.js');
+const appInfo = require('./app_info.js');
+const syncOptions = require('./sync_options.js');
+const syncMutexService = require('./sync_mutex.js');
+const cls = require('./cls.js');
+const request = require('./request.js');
+const ws = require('./ws.js');
+const entityChangesService = require('./entity_changes.js');
+const entityConstructor = require('../becca/entity_constructor.js');
+const becca = require('../becca/becca.js');
let proxyToggle = true;
@@ -84,7 +84,7 @@ async function sync() {
}
async function login() {
- const setupService = require('./setup'); // circular dependency issue
+ const setupService = require('./setup.js'); // circular dependency issue
if (!await setupService.hasSyncServerSchemaAndSeed()) {
await setupService.sendSeedToSyncServer();
@@ -244,7 +244,7 @@ async function checkContentHash(syncContext) {
if (failedChecks.length > 0) {
// before re-queuing sectors, make sure the entity changes are correct
- const consistencyChecks = require("./consistency_checks");
+ const consistencyChecks = require('./consistency_checks.js');
consistencyChecks.runEntityChangesChecks();
await syncRequest(syncContext, 'POST', `/api/sync/check-entity-changes`);
@@ -399,7 +399,7 @@ function getOutstandingPullCount() {
return outstandingPullCount;
}
-require("../becca/becca_loader").beccaLoaded.then(() => {
+require('../becca/becca_loader.js').beccaLoaded.then(() => {
setInterval(cls.wrap(sync), 60000);
// kickoff initial sync immediately, but should happen after initial consistency checks
diff --git a/src/services/sync_options.js b/src/services/sync_options.js
index a059be973..7cf44c06f 100644
--- a/src/services/sync_options.js
+++ b/src/services/sync_options.js
@@ -1,7 +1,7 @@
"use strict";
-const optionService = require('./options');
-const config = require('./config');
+const optionService = require('./options.js');
+const config = require('./config.js');
/*
* Primary configuration for sync is in the options (document), but we allow to override
diff --git a/src/services/sync_update.js b/src/services/sync_update.js
index d5bb4ab30..d4a392e6d 100644
--- a/src/services/sync_update.js
+++ b/src/services/sync_update.js
@@ -1,9 +1,9 @@
-const sql = require('./sql');
-const log = require('./log');
-const entityChangesService = require('./entity_changes');
-const eventService = require('./events');
-const entityConstructor = require("../becca/entity_constructor");
-const ws = require("./ws");
+const sql = require('./sql.js');
+const log = require('./log.js');
+const entityChangesService = require('./entity_changes.js');
+const eventService = require('./events.js');
+const entityConstructor = require('../becca/entity_constructor.js');
+const ws = require('./ws.js');
function updateEntities(entityChanges, instanceId) {
if (entityChanges.length === 0) {
diff --git a/src/services/task_context.js b/src/services/task_context.js
index be031ddac..58530ffec 100644
--- a/src/services/task_context.js
+++ b/src/services/task_context.js
@@ -1,6 +1,6 @@
"use strict";
-const ws = require('./ws');
+const ws = require('./ws.js');
// taskId => TaskContext
const taskContexts = {};
diff --git a/src/services/tray.js b/src/services/tray.js
index 667d613bf..bb32a78bb 100644
--- a/src/services/tray.js
+++ b/src/services/tray.js
@@ -1,7 +1,7 @@
const { Menu, Tray } = require('electron');
const path = require('path');
-const windowService = require("./window");
-const optionService = require("./options");
+const windowService = require('./window.js');
+const optionService = require('./options.js');
const UPDATE_TRAY_EVENTS = [
'minimize', 'maximize', 'show', 'hide'
diff --git a/src/services/tree.js b/src/services/tree.js
index 60f481d55..6a725d821 100644
--- a/src/services/tree.js
+++ b/src/services/tree.js
@@ -1,10 +1,10 @@
"use strict";
-const sql = require('./sql');
-const log = require('./log');
-const BBranch = require('../becca/entities/bbranch');
-const entityChangesService = require('./entity_changes');
-const becca = require('../becca/becca');
+const sql = require('./sql.js');
+const log = require('./log.js');
+const BBranch = require('../becca/entities/bbranch.js');
+const entityChangesService = require('./entity_changes.js');
+const becca = require('../becca/becca.js');
function validateParentChild(parentNoteId, childNoteId, branchId = null) {
if (['root', '_hidden', '_share', '_lbRoot', '_lbAvailableLaunchers', '_lbVisibleLaunchers'].includes(childNoteId)) {
diff --git a/src/services/window.js b/src/services/window.js
index fa2c4e841..68f70010a 100644
--- a/src/services/window.js
+++ b/src/services/window.js
@@ -1,12 +1,12 @@
const path = require('path');
const url = require("url");
-const port = require('./port');
-const optionService = require('./options');
-const env = require('./env');
-const log = require('./log');
-const sqlInit = require('./sql_init');
-const cls = require('./cls');
-const keyboardActionsService = require('./keyboard_actions');
+const port = require('./port.js');
+const optionService = require('./options.js');
+const env = require('./env.js');
+const log = require('./log.js');
+const sqlInit = require('./sql_init.js');
+const cls = require('./cls.js');
+const keyboardActionsService = require('./keyboard_actions.js');
const {ipcMain} = require('electron');
// Prevent the window being garbage collected
diff --git a/src/services/ws.js b/src/services/ws.js
index e8405585e..9dead1866 100644
--- a/src/services/ws.js
+++ b/src/services/ws.js
@@ -1,15 +1,15 @@
const WebSocket = require('ws');
-const utils = require('./utils');
-const log = require('./log');
-const sql = require('./sql');
-const cls = require('./cls');
-const config = require('./config');
-const syncMutexService = require('./sync_mutex');
-const protectedSessionService = require('./protected_session');
-const becca = require("../becca/becca");
-const AbstractBeccaEntity = require("../becca/entities/abstract_becca_entity");
+const utils = require('./utils.js');
+const log = require('./log.js');
+const sql = require('./sql.js');
+const cls = require('./cls.js');
+const config = require('./config.js');
+const syncMutexService = require('./sync_mutex.js');
+const protectedSessionService = require('./protected_session.js');
+const becca = require('../becca/becca.js');
+const AbstractBeccaEntity = require('../becca/entities/abstract_becca_entity.js');
-const env = require('./env');
+const env = require('./env.js');
if (env.isDev()) {
const chokidar = require('chokidar');
const debounce = require('debounce');
diff --git a/src/share/content_renderer.js b/src/share/content_renderer.js
index 91f7f7c76..daf3b1105 100644
--- a/src/share/content_renderer.js
+++ b/src/share/content_renderer.js
@@ -1,7 +1,7 @@
const {JSDOM} = require("jsdom");
-const shaca = require("./shaca/shaca");
-const assetPath = require("../services/asset_path");
-const shareRoot = require('./share_root');
+const shaca = require('./shaca/shaca.js');
+const assetPath = require('../services/asset_path.js');
+const shareRoot = require('./share_root.js');
const escapeHtml = require('escape-html');
function getContent(note) {
diff --git a/src/share/routes.js b/src/share/routes.js
index b3f6860ec..2805933a8 100644
--- a/src/share/routes.js
+++ b/src/share/routes.js
@@ -3,15 +3,15 @@ const path = require('path');
const safeCompare = require('safe-compare');
const ejs = require("ejs");
-const shaca = require("./shaca/shaca");
-const shacaLoader = require("./shaca/shaca_loader");
-const shareRoot = require("./share_root");
-const contentRenderer = require("./content_renderer");
-const assetPath = require("../services/asset_path");
-const appPath = require("../services/app_path");
-const searchService = require("../services/search/services/search");
-const SearchContext = require("../services/search/search_context");
-const log = require("../services/log");
+const shaca = require('./shaca/shaca.js');
+const shacaLoader = require('./shaca/shaca_loader.js');
+const shareRoot = require('./share_root.js');
+const contentRenderer = require('./content_renderer.js');
+const assetPath = require('../services/asset_path.js');
+const appPath = require('../services/app_path.js');
+const searchService = require('../services/search/services/search.js');
+const SearchContext = require('../services/search/search_context.js');
+const log = require('../services/log.js');
/**
* @param {SNote} note
@@ -236,7 +236,7 @@ function register(router) {
addNoIndexHeader(note, res);
- const utils = require("../services/utils");
+ const utils = require('../services/utils.js');
const filename = utils.formatDownloadTitle(note.title, note.type, note.mime);
@@ -304,7 +304,7 @@ function register(router) {
addNoIndexHeader(attachment.note, res);
- const utils = require("../services/utils");
+ const utils = require('../services/utils.js');
const filename = utils.formatDownloadTitle(attachment.title, null, attachment.mime);
diff --git a/src/share/shaca/entities/abstract_shaca_entity.js b/src/share/shaca/entities/abstract_shaca_entity.js
index a6753e9b7..772eb4d6f 100644
--- a/src/share/shaca/entities/abstract_shaca_entity.js
+++ b/src/share/shaca/entities/abstract_shaca_entity.js
@@ -4,7 +4,7 @@ class AbstractShacaEntity {
/** @return {Shaca} */
get shaca() {
if (!shaca) {
- shaca = require("../shaca");
+ shaca = require('../shaca.js');
}
return shaca;
diff --git a/src/share/shaca/entities/sattachment.js b/src/share/shaca/entities/sattachment.js
index 998c5ac95..46504ba14 100644
--- a/src/share/shaca/entities/sattachment.js
+++ b/src/share/shaca/entities/sattachment.js
@@ -1,8 +1,8 @@
"use strict";
-const sql = require('../../sql');
-const utils = require('../../../services/utils');
-const AbstractShacaEntity = require('./abstract_shaca_entity');
+const sql = require('../../sql.js');
+const utils = require('../../../services/utils.js');
+const AbstractShacaEntity = require('./abstract_shaca_entity.js');
class SAttachment extends AbstractShacaEntity {
constructor([attachmentId, ownerId, role, mime, title, blobId, utcDateModified]) {
diff --git a/src/share/shaca/entities/sattribute.js b/src/share/shaca/entities/sattribute.js
index 26b285ce8..bc3b5437a 100644
--- a/src/share/shaca/entities/sattribute.js
+++ b/src/share/shaca/entities/sattribute.js
@@ -1,6 +1,6 @@
"use strict";
-const AbstractShacaEntity = require('./abstract_shaca_entity');
+const AbstractShacaEntity = require('./abstract_shaca_entity.js');
class SAttribute extends AbstractShacaEntity {
constructor([attributeId, noteId, type, name, value, isInheritable, position]) {
diff --git a/src/share/shaca/entities/sbranch.js b/src/share/shaca/entities/sbranch.js
index a6f2ac13a..1be0f424a 100644
--- a/src/share/shaca/entities/sbranch.js
+++ b/src/share/shaca/entities/sbranch.js
@@ -1,6 +1,6 @@
"use strict";
-const AbstractShacaEntity = require('./abstract_shaca_entity');
+const AbstractShacaEntity = require('./abstract_shaca_entity.js');
class SBranch extends AbstractShacaEntity {
constructor([branchId, noteId, parentNoteId, prefix, isExpanded]) {
diff --git a/src/share/shaca/entities/snote.js b/src/share/shaca/entities/snote.js
index 06d4e3dc4..889960e23 100644
--- a/src/share/shaca/entities/snote.js
+++ b/src/share/shaca/entities/snote.js
@@ -1,8 +1,8 @@
"use strict";
-const sql = require('../../sql');
-const utils = require('../../../services/utils');
-const AbstractShacaEntity = require('./abstract_shaca_entity');
+const sql = require('../../sql.js');
+const utils = require('../../../services/utils.js');
+const AbstractShacaEntity = require('./abstract_shaca_entity.js');
const escape = require('escape-html');
const LABEL = 'label';
diff --git a/src/share/shaca/shaca_loader.js b/src/share/shaca/shaca_loader.js
index 6f3545bda..00ba63182 100644
--- a/src/share/shaca/shaca_loader.js
+++ b/src/share/shaca/shaca_loader.js
@@ -1,14 +1,14 @@
"use strict";
-const sql = require('../sql');
-const shaca = require('./shaca');
-const log = require('../../services/log');
-const SNote = require('./entities/snote');
-const SBranch = require('./entities/sbranch');
-const SAttribute = require('./entities/sattribute');
-const SAttachment = require("./entities/sattachment");
-const shareRoot = require('../share_root');
-const eventService = require("../../services/events");
+const sql = require('../sql.js');
+const shaca = require('./shaca.js');
+const log = require('../../services/log.js');
+const SNote = require('./entities/snote.js');
+const SBranch = require('./entities/sbranch.js');
+const SAttribute = require('./entities/sattribute.js');
+const SAttachment = require('./entities/sattachment.js');
+const shareRoot = require('../share_root.js');
+const eventService = require('../../services/events.js');
function load() {
const start = Date.now();
diff --git a/src/share/sql.js b/src/share/sql.js
index 485c87921..07dd2fd85 100644
--- a/src/share/sql.js
+++ b/src/share/sql.js
@@ -1,7 +1,7 @@
"use strict";
const Database = require('better-sqlite3');
-const dataDir = require('../services/data_dir');
+const dataDir = require('../services/data_dir.js');
const dbConnection = new Database(dataDir.DOCUMENT_PATH, { readonly: true });
diff --git a/src/tools/generate_document.js b/src/tools/generate_document.js
index e716e7e01..67f202a2b 100644
--- a/src/tools/generate_document.js
+++ b/src/tools/generate_document.js
@@ -3,12 +3,12 @@
* will create 1000 new notes and some clones into the current document.db
*/
-require('../becca/entity_constructor');
-const sqlInit = require('../services/sql_init');
-const noteService = require('../services/notes');
-const attributeService = require('../services/attributes');
-const cls = require('../services/cls');
-const cloningService = require('../services/cloning');
+require('../becca/entity_constructor.js');
+const sqlInit = require('../services/sql_init.js');
+const noteService = require('../services/notes.js');
+const attributeService = require('../services/attributes.js');
+const cls = require('../services/cls.js');
+const cloningService = require('../services/cloning.js');
const loremIpsum = require('lorem-ipsum').loremIpsum;
const noteCount = parseInt(process.argv[2]);
diff --git a/src/www b/src/www.js
similarity index 100%
rename from src/www
rename to src/www.js
diff --git a/webpack.config.js b/webpack.config.js
index 41077c00e..639642f52 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -1,5 +1,5 @@
const path = require('path');
-const assetPath = require('./src/services/asset_path');
+const assetPath = require('./src/services/asset_path.js');
module.exports = {
mode: 'production',