mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
use .js extension for require() as a preparation for future migration to ESM
This commit is contained in:
parent
722299dd26
commit
cf99345962
4
LICENSE
4
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.
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.js.gnu.org/licenses/>.
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
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,
|
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.
|
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
|
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||||
<http://www.gnu.org/licenses/>.
|
<http://www.js.gnu.org/licenses/>.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
const anonymizationService = require('../src/services/anonymization');
|
const anonymizationService = require('../src/services/anonymization.js');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
module.exports = () => {
|
module.exports = () => {
|
||||||
const sql = require("../../src/services/sql");
|
const sql = require('../../src/services/sql.js');
|
||||||
const utils = require("../../src/services/utils");
|
const utils = require('../../src/services/utils.js');
|
||||||
|
|
||||||
const existingBlobIds = new Set();
|
const existingBlobIds = new Set();
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
module.exports = () => {
|
module.exports = () => {
|
||||||
const beccaLoader = require("../../src/becca/becca_loader");
|
const beccaLoader = require('../../src/becca/becca_loader.js');
|
||||||
const becca = require("../../src/becca/becca");
|
const becca = require('../../src/becca/becca.js');
|
||||||
const cls = require("../../src/services/cls");
|
const cls = require('../../src/services/cls.js');
|
||||||
const log = require("../../src/services/log");
|
const log = require('../../src/services/log.js');
|
||||||
const sql = require("../../src/services/sql");
|
const sql = require('../../src/services/sql.js');
|
||||||
|
|
||||||
cls.init(() => {
|
cls.init(() => {
|
||||||
// emergency disabling of image compression since it appears to make problems in migration to 0.61
|
// emergency disabling of image compression since it appears to make problems in migration to 0.61
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
const http = require("http");
|
const http = require("http");
|
||||||
const ini = require("ini");
|
const ini = require("ini");
|
||||||
const fs = require("fs");
|
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'));
|
const config = ini.parse(fs.readFileSync(dataDir.CONFIG_INI_PATH, 'utf-8'));
|
||||||
|
|
||||||
if (config.Network.https) {
|
if (config.Network.https) {
|
||||||
@ -10,8 +10,8 @@ if (config.Network.https) {
|
|||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
const port = require('./src/services/port');
|
const port = require('./src/services/port.js');
|
||||||
const host = require('./src/services/host');
|
const host = require('./src/services/host.js');
|
||||||
|
|
||||||
const options = { timeout: 2000 };
|
const options = { timeout: 2000 };
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
const yargs = require('yargs/yargs')
|
const yargs = require('yargs/yargs')
|
||||||
const { hideBin } = require('yargs/helpers')
|
const { hideBin } = require('yargs/helpers')
|
||||||
const dumpService = require("./inc/dump");
|
const dumpService = require('./inc/dump.js');
|
||||||
|
|
||||||
yargs(hideBin(process.argv))
|
yargs(hideBin(process.argv))
|
||||||
.command('$0 <path_to_document> <target_directory>', 'dump the contents of document.db into the target directory', (yargs) => {
|
.command('$0 <path_to_document> <target_directory>', 'dump the contents of document.db into the target directory', (yargs) => {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const crypto = require("crypto");
|
const crypto = require("crypto");
|
||||||
const sql = require("./sql");
|
const sql = require('./sql.js');
|
||||||
const decryptService = require("./decrypt");
|
const decryptService = require('./decrypt.js');
|
||||||
|
|
||||||
function getDataKey(password) {
|
function getDataKey(password) {
|
||||||
if (!password) {
|
if (!password) {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const sanitize = require("sanitize-filename");
|
const sanitize = require("sanitize-filename");
|
||||||
const sql = require("./sql");
|
const sql = require('./sql.js');
|
||||||
const decryptService = require("./decrypt");
|
const decryptService = require('./decrypt.js');
|
||||||
const dataKeyService = require("./data_key");
|
const dataKeyService = require('./data_key.js');
|
||||||
const extensionService = require("./extension");
|
const extensionService = require('./extension.js');
|
||||||
|
|
||||||
function dumpDocument(documentPath, targetPath, options) {
|
function dumpDocument(documentPath, targetPath, options) {
|
||||||
const stats = {
|
const stats = {
|
||||||
|
10
electron.js
10
electron.js
@ -1,10 +1,10 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const {app, globalShortcut, BrowserWindow} = require('electron');
|
const {app, globalShortcut, BrowserWindow} = require('electron');
|
||||||
const sqlInit = require('./src/services/sql_init');
|
const sqlInit = require('./src/services/sql_init.js');
|
||||||
const appIconService = require('./src/services/app_icon');
|
const appIconService = require('./src/services/app_icon.js');
|
||||||
const windowService = require('./src/services/window');
|
const windowService = require('./src/services/window.js');
|
||||||
const tray = require('./src/services/tray');
|
const tray = require('./src/services/tray.js');
|
||||||
|
|
||||||
// Adds debug features like hotkeys for triggering dev tools and reload
|
// Adds debug features like hotkeys for triggering dev tools and reload
|
||||||
require('electron-debug')();
|
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)
|
// this is to disable electron warning spam in the dev console (local development only)
|
||||||
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true';
|
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true';
|
||||||
|
|
||||||
require('./src/www');
|
require('./src/www.js');
|
||||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "trilium",
|
"name": "trilium",
|
||||||
"version": "0.62.1-beta",
|
"version": "0.62.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "trilium",
|
"name": "trilium",
|
||||||
"version": "0.62.1-beta",
|
"version": "0.62.2",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
10
package.json
10
package.json
@ -6,20 +6,20 @@
|
|||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
"main": "electron.js",
|
"main": "electron.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
"trilium": "./src/www"
|
"trilium": "src/www.js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/zadam/trilium.git"
|
"url": "https://github.com/zadam/trilium.git"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"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": "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",
|
"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",
|
"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": "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 .",
|
"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 .",
|
"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-server": "rm -rf ./node_modules/better-sqlite3 && npm install",
|
||||||
"switch-electron": "./node_modules/.bin/electron-rebuild",
|
"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",
|
"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",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
const {
|
const {
|
||||||
describeEtapi, postEtapi,
|
describeEtapi, postEtapi,
|
||||||
putEtapiContent
|
putEtapiContent
|
||||||
} = require("../support/etapi");
|
} = require('../support/etapi.js');
|
||||||
const {getEtapi} = require("../support/etapi.js");
|
const {getEtapi} = require("../support/etapi.js");
|
||||||
|
|
||||||
describeEtapi("app_info", () => {
|
describeEtapi("app_info", () => {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
const {
|
const {
|
||||||
describeEtapi, postEtapi,
|
describeEtapi, postEtapi,
|
||||||
getEtapi,
|
getEtapi,
|
||||||
} = require("../support/etapi");
|
} = require('../support/etapi.js');
|
||||||
const {putEtapiContent} = require("../support/etapi.js");
|
const {putEtapiContent} = require("../support/etapi.js");
|
||||||
|
|
||||||
describeEtapi("backup", () => {
|
describeEtapi("backup", () => {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
const {
|
const {
|
||||||
describeEtapi, postEtapi,
|
describeEtapi, postEtapi,
|
||||||
postEtapiContent,
|
postEtapiContent,
|
||||||
} = require("../support/etapi");
|
} = require('../support/etapi.js');
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const {getEtapiContent} = require("../support/etapi.js");
|
const {getEtapiContent} = require("../support/etapi.js");
|
||||||
|
@ -7,7 +7,7 @@ const {
|
|||||||
getEtapiContent,
|
getEtapiContent,
|
||||||
patchEtapi, putEtapi,
|
patchEtapi, putEtapi,
|
||||||
putEtapiContent
|
putEtapiContent
|
||||||
} = require("../support/etapi");
|
} = require('../support/etapi.js');
|
||||||
|
|
||||||
describeEtapi("notes", () => {
|
describeEtapi("notes", () => {
|
||||||
it("create", async () => {
|
it("create", async () => {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
const BNote = require('../../src/becca/entities/bnote');
|
const BNote = require('../../src/becca/entities/bnote.js');
|
||||||
const BBranch = require('../../src/becca/entities/bbranch');
|
const BBranch = require('../../src/becca/entities/bbranch.js');
|
||||||
const BAttribute = require('../../src/becca/entities/battribute');
|
const BAttribute = require('../../src/becca/entities/battribute.js');
|
||||||
const becca = require('../../src/becca/becca');
|
const becca = require('../../src/becca/becca.js');
|
||||||
const randtoken = require('rand-token').generator({source: 'crypto'});
|
const randtoken = require('rand-token').generator({source: 'crypto'});
|
||||||
|
|
||||||
/** @returns {BNote} */
|
/** @returns {BNote} */
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const lex = require('../../src/services/search/services/lex');
|
const lex = require('../../src/services/search/services/lex.js');
|
||||||
|
|
||||||
describe("Lexer fulltext", () => {
|
describe("Lexer fulltext", () => {
|
||||||
it("simple lexing", () => {
|
it("simple lexing", () => {
|
||||||
|
@ -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", () => {
|
describe("Parens handler", () => {
|
||||||
it("handles parens", () => {
|
it("handles parens", () => {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const SearchContext = require("../../src/services/search/search_context");
|
const SearchContext = require('../../src/services/search/search_context.js');
|
||||||
const parse = require('../../src/services/search/services/parse');
|
const parse = require('../../src/services/search/services/parse.js');
|
||||||
|
|
||||||
function tokens(toks, cur = 0) {
|
function tokens(toks, cur = 0) {
|
||||||
return toks.map(arg => {
|
return toks.map(arg => {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
const searchService = require('../../src/services/search/services/search');
|
const searchService = require('../../src/services/search/services/search.js');
|
||||||
const BNote = require('../../src/becca/entities/bnote');
|
const BNote = require('../../src/becca/entities/bnote.js');
|
||||||
const BBranch = require('../../src/becca/entities/bbranch');
|
const BBranch = require('../../src/becca/entities/bbranch.js');
|
||||||
const SearchContext = require('../../src/services/search/search_context');
|
const SearchContext = require('../../src/services/search/search_context.js');
|
||||||
const dateUtils = require('../../src/services/date_utils');
|
const dateUtils = require('../../src/services/date_utils.js');
|
||||||
const becca = require('../../src/becca/becca');
|
const becca = require('../../src/becca/becca.js');
|
||||||
const {NoteBuilder, findNoteByTitle, note} = require('./becca_mocking');
|
const {NoteBuilder, findNoteByTitle, note} = require('./becca_mocking.js');
|
||||||
|
|
||||||
describe("Search", () => {
|
describe("Search", () => {
|
||||||
let rootNote;
|
let rootNote;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
const {note} = require('./becca_mocking');
|
const {note} = require('./becca_mocking.js');
|
||||||
const ValueExtractor = require('../../src/services/search/value_extractor');
|
const ValueExtractor = require('../../src/services/search/value_extractor.js');
|
||||||
const becca = require('../../src/becca/becca');
|
const becca = require('../../src/becca/becca.js');
|
||||||
const SearchContext = require("../../src/services/search/search_context");
|
const SearchContext = require('../../src/services/search/search_context.js');
|
||||||
|
|
||||||
const dsc = new SearchContext();
|
const dsc = new SearchContext();
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const anonymizationService = require('./services/anonymization');
|
const anonymizationService = require('./services/anonymization.js');
|
||||||
const sqlInit = require('./services/sql_init');
|
const sqlInit = require('./services/sql_init.js');
|
||||||
require('./becca/entity_constructor');
|
require('./becca/entity_constructor.js');
|
||||||
|
|
||||||
sqlInit.dbReady.then(async () => {
|
sqlInit.dbReady.then(async () => {
|
||||||
try {
|
try {
|
||||||
|
24
src/app.js
24
src/app.js
@ -4,11 +4,11 @@ const favicon = require('serve-favicon');
|
|||||||
const cookieParser = require('cookie-parser');
|
const cookieParser = require('cookie-parser');
|
||||||
const helmet = require('helmet');
|
const helmet = require('helmet');
|
||||||
const compression = require('compression');
|
const compression = require('compression');
|
||||||
const sessionParser = require('./routes/session_parser');
|
const sessionParser = require('./routes/session_parser.js');
|
||||||
const utils = require('./services/utils');
|
const utils = require('./services/utils.js');
|
||||||
|
|
||||||
require('./services/handlers');
|
require('./services/handlers.js');
|
||||||
require('./becca/becca_loader');
|
require('./becca/becca_loader.js');
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
@ -37,21 +37,21 @@ app.use(`/robots.txt`, express.static(path.join(__dirname, 'public/robots.txt'))
|
|||||||
app.use(sessionParser);
|
app.use(sessionParser);
|
||||||
app.use(favicon(`${__dirname}/../images/app-icons/win/icon.ico`));
|
app.use(favicon(`${__dirname}/../images/app-icons/win/icon.ico`));
|
||||||
|
|
||||||
require('./routes/assets').register(app);
|
require('./routes/assets.js').register(app);
|
||||||
require('./routes/routes').register(app);
|
require('./routes/routes.js').register(app);
|
||||||
require('./routes/custom').register(app);
|
require('./routes/custom.js').register(app);
|
||||||
require('./routes/error_handlers').register(app);
|
require('./routes/error_handlers.js').register(app);
|
||||||
|
|
||||||
// triggers sync timer
|
// triggers sync timer
|
||||||
require('./services/sync');
|
require('./services/sync.js');
|
||||||
|
|
||||||
// triggers backup timer
|
// triggers backup timer
|
||||||
require('./services/backup');
|
require('./services/backup.js');
|
||||||
|
|
||||||
// trigger consistency checks timer
|
// trigger consistency checks timer
|
||||||
require('./services/consistency_checks');
|
require('./services/consistency_checks.js');
|
||||||
|
|
||||||
require('./services/scheduler');
|
require('./services/scheduler.js');
|
||||||
|
|
||||||
if (utils.isElectron()) {
|
if (utils.isElectron()) {
|
||||||
require('@electron/remote/main').initialize();
|
require('@electron/remote/main').initialize();
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const sql = require("../services/sql");
|
const sql = require('../services/sql.js');
|
||||||
const NoteSet = require("../services/search/note_set");
|
const NoteSet = require('../services/search/note_set.js');
|
||||||
const NotFoundError = require("../errors/not_found_error");
|
const NotFoundError = require('../errors/not_found_error.js');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Becca is a backend cache of all notes, branches, and attributes.
|
* Becca is a backend cache of all notes, branches, and attributes.
|
||||||
@ -148,7 +148,7 @@ class Becca {
|
|||||||
getRevision(revisionId) {
|
getRevision(revisionId) {
|
||||||
const row = sql.getRow("SELECT * FROM revisions WHERE revisionId = ?", [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;
|
return row ? new BRevision(row) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ class Becca {
|
|||||||
WHERE attachmentId = ? AND isDeleted = 0`
|
WHERE attachmentId = ? AND isDeleted = 0`
|
||||||
: `SELECT * FROM attachments 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])
|
return sql.getRows(query, [attachmentId])
|
||||||
.map(row => new BAttachment(row))[0];
|
.map(row => new BAttachment(row))[0];
|
||||||
@ -180,7 +180,7 @@ class Becca {
|
|||||||
|
|
||||||
/** @returns {BAttachment[]} */
|
/** @returns {BAttachment[]} */
|
||||||
getAttachments(attachmentIds) {
|
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)
|
return sql.getManyRows("SELECT * FROM attachments WHERE attachmentId IN (???) AND isDeleted = 0", attachmentIds)
|
||||||
.map(row => new BAttachment(row));
|
.map(row => new BAttachment(row));
|
||||||
}
|
}
|
||||||
@ -189,7 +189,7 @@ class Becca {
|
|||||||
getBlob(entity) {
|
getBlob(entity) {
|
||||||
const row = sql.getRow("SELECT *, LENGTH(content) AS contentLength FROM blobs WHERE blobId = ?", [entity.blobId]);
|
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;
|
return row ? new BBlob(row) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ class Becca {
|
|||||||
getRecentNotesFromQuery(query, params = []) {
|
getRecentNotesFromQuery(query, params = []) {
|
||||||
const rows = sql.getRows(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));
|
return rows.map(row => new BRecentNote(row));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +246,7 @@ class Becca {
|
|||||||
getRevisionsFromQuery(query, params = []) {
|
getRevisionsFromQuery(query, params = []) {
|
||||||
const rows = sql.getRows(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));
|
return rows.map(row => new BRevision(row));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const sql = require('../services/sql');
|
const sql = require('../services/sql.js');
|
||||||
const eventService = require('../services/events');
|
const eventService = require('../services/events.js');
|
||||||
const becca = require('./becca');
|
const becca = require('./becca.js');
|
||||||
const sqlInit = require('../services/sql_init');
|
const sqlInit = require('../services/sql_init.js');
|
||||||
const log = require('../services/log');
|
const log = require('../services/log.js');
|
||||||
const BNote = require('./entities/bnote');
|
const BNote = require('./entities/bnote.js');
|
||||||
const BBranch = require('./entities/bbranch');
|
const BBranch = require('./entities/bbranch.js');
|
||||||
const BAttribute = require('./entities/battribute');
|
const BAttribute = require('./entities/battribute.js');
|
||||||
const BOption = require('./entities/boption');
|
const BOption = require('./entities/boption.js');
|
||||||
const BEtapiToken = require("./entities/betapi_token");
|
const BEtapiToken = require('./entities/betapi_token.js');
|
||||||
const cls = require("../services/cls");
|
const cls = require('../services/cls.js');
|
||||||
const entityConstructor = require("../becca/entity_constructor");
|
const entityConstructor = require('../becca/entity_constructor.js');
|
||||||
|
|
||||||
const beccaLoaded = new Promise((res, rej) => {
|
const beccaLoaded = new Promise((res, rej) => {
|
||||||
sqlInit.dbReady.then(() => {
|
sqlInit.dbReady.then(() => {
|
||||||
cls.init(() => {
|
cls.init(() => {
|
||||||
load();
|
load();
|
||||||
|
|
||||||
require('../services/options_init').initStartupOptions();
|
require('../services/options_init.js').initStartupOptions();
|
||||||
|
|
||||||
res();
|
res();
|
||||||
});
|
});
|
||||||
@ -71,7 +71,7 @@ function load() {
|
|||||||
function reload(reason) {
|
function reload(reason) {
|
||||||
load();
|
load();
|
||||||
|
|
||||||
require('../services/ws').reloadFrontend(reason || "becca reloaded");
|
require('../services/ws.js').reloadFrontend(reason || "becca reloaded");
|
||||||
}
|
}
|
||||||
|
|
||||||
eventService.subscribeBeccaLoader([eventService.ENTITY_CHANGE_SYNCED], ({entityName, entityRow}) => {
|
eventService.subscribeBeccaLoader([eventService.ENTITY_CHANGE_SYNCED], ({entityName, entityRow}) => {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const becca = require('./becca');
|
const becca = require('./becca.js');
|
||||||
const cls = require('../services/cls');
|
const cls = require('../services/cls.js');
|
||||||
const log = require('../services/log');
|
const log = require('../services/log.js');
|
||||||
|
|
||||||
function isNotePathArchived(notePath) {
|
function isNotePathArchived(notePath) {
|
||||||
const noteId = notePath[notePath.length - 1];
|
const noteId = notePath[notePath.length - 1];
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const utils = require('../../services/utils');
|
const utils = require('../../services/utils.js');
|
||||||
const sql = require('../../services/sql');
|
const sql = require('../../services/sql.js');
|
||||||
const entityChangesService = require('../../services/entity_changes');
|
const entityChangesService = require('../../services/entity_changes.js');
|
||||||
const eventService = require("../../services/events");
|
const eventService = require('../../services/events.js');
|
||||||
const dateUtils = require("../../services/date_utils");
|
const dateUtils = require('../../services/date_utils.js');
|
||||||
const cls = require("../../services/cls");
|
const cls = require('../../services/cls.js');
|
||||||
const log = require("../../services/log");
|
const log = require('../../services/log.js');
|
||||||
const protectedSessionService = require("../../services/protected_session");
|
const protectedSessionService = require('../../services/protected_session.js');
|
||||||
const blobService = require("../../services/blob");
|
const blobService = require('../../services/blob.js');
|
||||||
|
|
||||||
let becca = null;
|
let becca = null;
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ class AbstractBeccaEntity {
|
|||||||
*/
|
*/
|
||||||
get becca() {
|
get becca() {
|
||||||
if (!becca) {
|
if (!becca) {
|
||||||
becca = require('../becca');
|
becca = require('../becca.js');
|
||||||
}
|
}
|
||||||
|
|
||||||
return becca;
|
return becca;
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const utils = require('../../services/utils');
|
const utils = require('../../services/utils.js');
|
||||||
const dateUtils = require('../../services/date_utils');
|
const dateUtils = require('../../services/date_utils.js');
|
||||||
const AbstractBeccaEntity = require("./abstract_becca_entity");
|
const AbstractBeccaEntity = require('./abstract_becca_entity.js');
|
||||||
const sql = require("../../services/sql");
|
const sql = require('../../services/sql.js');
|
||||||
const protectedSessionService = require("../../services/protected_session");
|
const protectedSessionService = require('../../services/protected_session.js');
|
||||||
const log = require("../../services/log");
|
const log = require('../../services/log.js');
|
||||||
|
|
||||||
const attachmentRoleToNoteTypeMapping = {
|
const attachmentRoleToNoteTypeMapping = {
|
||||||
'image': 'image'
|
'image': 'image'
|
||||||
@ -37,7 +37,7 @@ class BAttachment extends AbstractBeccaEntity {
|
|||||||
|
|
||||||
/** @type {string} */
|
/** @type {string} */
|
||||||
this.attachmentId = row.attachmentId;
|
this.attachmentId = row.attachmentId;
|
||||||
/**
|
/**
|
||||||
* either noteId or revisionId to which this attachment belongs
|
* either noteId or revisionId to which this attachment belongs
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
@ -153,7 +153,7 @@ class BAttachment extends AbstractBeccaEntity {
|
|||||||
throw new Error(`Cannot convert protected attachment outside of protected session`);
|
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({
|
const { note, branch } = noteService.createNewNote({
|
||||||
parentNoteId: this.ownerId,
|
parentNoteId: this.ownerId,
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const BNote = require('./bnote');
|
const BNote = require('./bnote.js');
|
||||||
const AbstractBeccaEntity = require("./abstract_becca_entity");
|
const AbstractBeccaEntity = require('./abstract_becca_entity.js');
|
||||||
const sql = require("../../services/sql");
|
const sql = require('../../services/sql.js');
|
||||||
const dateUtils = require("../../services/date_utils");
|
const dateUtils = require('../../services/date_utils.js');
|
||||||
const promotedAttributeDefinitionParser = require("../../services/promoted_attribute_definition_parser");
|
const promotedAttributeDefinitionParser = require('../../services/promoted_attribute_definition_parser.js');
|
||||||
const {sanitizeAttributeName} = require("../../services/sanitize_attribute_name");
|
const {sanitizeAttributeName} = require('../../services/sanitize_attribute_name.js');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const BNote = require('./bnote');
|
const BNote = require('./bnote.js');
|
||||||
const AbstractBeccaEntity = require("./abstract_becca_entity");
|
const AbstractBeccaEntity = require('./abstract_becca_entity.js');
|
||||||
const dateUtils = require("../../services/date_utils");
|
const dateUtils = require('../../services/date_utils.js');
|
||||||
const utils = require("../../services/utils");
|
const utils = require('../../services/utils.js');
|
||||||
const TaskContext = require("../../services/task_context");
|
const TaskContext = require('../../services/task_context.js');
|
||||||
const cls = require("../../services/cls");
|
const cls = require('../../services/cls.js');
|
||||||
const log = require("../../services/log");
|
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
|
* 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) {
|
if (parentBranches.length === 1 && parentBranches[0] === this) {
|
||||||
// needs to be run before branches and attributes are deleted and thus attached relations disappear
|
// 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);
|
handlers.runAttachedRelations(note, 'runOnNoteDeletion', note);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const dateUtils = require('../../services/date_utils');
|
const dateUtils = require('../../services/date_utils.js');
|
||||||
const AbstractBeccaEntity = require("./abstract_becca_entity");
|
const AbstractBeccaEntity = require('./abstract_becca_entity.js');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EtapiToken is an entity representing token used to authenticate against Trilium REST API from client applications.
|
* EtapiToken is an entity representing token used to authenticate against Trilium REST API from client applications.
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const protectedSessionService = require('../../services/protected_session');
|
const protectedSessionService = require('../../services/protected_session.js');
|
||||||
const log = require('../../services/log');
|
const log = require('../../services/log.js');
|
||||||
const sql = require('../../services/sql');
|
const sql = require('../../services/sql.js');
|
||||||
const utils = require('../../services/utils');
|
const utils = require('../../services/utils.js');
|
||||||
const dateUtils = require('../../services/date_utils');
|
const dateUtils = require('../../services/date_utils.js');
|
||||||
const AbstractBeccaEntity = require("./abstract_becca_entity");
|
const AbstractBeccaEntity = require('./abstract_becca_entity.js');
|
||||||
const BRevision = require("./brevision");
|
const BRevision = require('./brevision.js');
|
||||||
const BAttachment = require("./battachment");
|
const BAttachment = require('./battachment.js');
|
||||||
const TaskContext = require("../../services/task_context");
|
const TaskContext = require('../../services/task_context.js');
|
||||||
const dayjs = require("dayjs");
|
const dayjs = require("dayjs");
|
||||||
const utc = require('dayjs/plugin/utc');
|
const utc = require('dayjs/plugin/utc');
|
||||||
const eventService = require("../../services/events");
|
const eventService = require('../../services/events.js');
|
||||||
dayjs.extend(utc);
|
dayjs.extend(utc);
|
||||||
|
|
||||||
const LABEL = 'label';
|
const LABEL = 'label';
|
||||||
@ -903,7 +903,7 @@ class BNote extends AbstractBeccaEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const searchService = require("../../services/search/services/search");
|
const searchService = require('../../services/search/services/search.js');
|
||||||
const {searchResultNoteIds} = searchService.searchFromNote(this);
|
const {searchResultNoteIds} = searchService.searchFromNote(this);
|
||||||
|
|
||||||
const becca = this.becca;
|
const becca = this.becca;
|
||||||
@ -1303,7 +1303,7 @@ class BNote extends AbstractBeccaEntity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const BAttribute = require("./battribute");
|
const BAttribute = require('./battribute.js');
|
||||||
|
|
||||||
new BAttribute({
|
new BAttribute({
|
||||||
noteId: this.noteId,
|
noteId: this.noteId,
|
||||||
@ -1343,7 +1343,7 @@ class BNote extends AbstractBeccaEntity {
|
|||||||
* @returns {BAttribute}
|
* @returns {BAttribute}
|
||||||
*/
|
*/
|
||||||
addAttribute(type, name, value = "", isInheritable = false, position = null) {
|
addAttribute(type, name, value = "", isInheritable = false, position = null) {
|
||||||
const BAttribute = require("./battribute");
|
const BAttribute = require('./battribute.js');
|
||||||
|
|
||||||
return new BAttribute({
|
return new BAttribute({
|
||||||
noteId: this.noteId,
|
noteId: this.noteId,
|
||||||
@ -1448,7 +1448,7 @@ class BNote extends AbstractBeccaEntity {
|
|||||||
removeRelation(name, value) { return this.removeAttribute(RELATION, name, value); }
|
removeRelation(name, value) { return this.removeAttribute(RELATION, name, value); }
|
||||||
|
|
||||||
searchNotesInSubtree(searchString) {
|
searchNotesInSubtree(searchString) {
|
||||||
const searchService = require("../../services/search/services/search");
|
const searchService = require('../../services/search/services/search.js');
|
||||||
|
|
||||||
return searchService.searchNotes(searchString);
|
return searchService.searchNotes(searchString);
|
||||||
}
|
}
|
||||||
@ -1462,7 +1462,7 @@ class BNote extends AbstractBeccaEntity {
|
|||||||
* @returns {{success: boolean, message: string, branchId: string, notePath: string}}
|
* @returns {{success: boolean, message: string, branchId: string, notePath: string}}
|
||||||
*/
|
*/
|
||||||
cloneTo(parentNoteId) {
|
cloneTo(parentNoteId) {
|
||||||
const cloningService = require("../../services/cloning");
|
const cloningService = require('../../services/cloning.js');
|
||||||
|
|
||||||
const branch = this.becca.getNote(parentNoteId).getParentBranches()[0];
|
const branch = this.becca.getNote(parentNoteId).getParentBranches()[0];
|
||||||
|
|
||||||
@ -1537,7 +1537,7 @@ class BNote extends AbstractBeccaEntity {
|
|||||||
|
|
||||||
parentNote.setContent(fixedContent);
|
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
|
noteService.asyncPostProcessContent(parentNote, fixedContent); // to mark an unused attachment for deletion
|
||||||
|
|
||||||
this.deleteNote();
|
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
|
// 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);
|
handlers.runAttachedRelations(this, 'runOnNoteDeletion', this);
|
||||||
taskContext.noteDeletionHandlerTriggered = true;
|
taskContext.noteDeletionHandlerTriggered = true;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const dateUtils = require('../../services/date_utils');
|
const dateUtils = require('../../services/date_utils.js');
|
||||||
const AbstractBeccaEntity = require("./abstract_becca_entity");
|
const AbstractBeccaEntity = require('./abstract_becca_entity.js');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Option represents a name-value pair, either directly configurable by the user or some system property.
|
* Option represents a name-value pair, either directly configurable by the user or some system property.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const dateUtils = require('../../services/date_utils');
|
const dateUtils = require('../../services/date_utils.js');
|
||||||
const AbstractBeccaEntity = require("./abstract_becca_entity");
|
const AbstractBeccaEntity = require('./abstract_becca_entity.js');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RecentNote represents recently visited note.
|
* RecentNote represents recently visited note.
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const protectedSessionService = require('../../services/protected_session');
|
const protectedSessionService = require('../../services/protected_session.js');
|
||||||
const utils = require('../../services/utils');
|
const utils = require('../../services/utils.js');
|
||||||
const dateUtils = require('../../services/date_utils');
|
const dateUtils = require('../../services/date_utils.js');
|
||||||
const becca = require('../becca');
|
const becca = require('../becca.js');
|
||||||
const AbstractBeccaEntity = require("./abstract_becca_entity");
|
const AbstractBeccaEntity = require('./abstract_becca_entity.js');
|
||||||
const sql = require("../../services/sql");
|
const sql = require('../../services/sql.js');
|
||||||
const BAttachment = require("./battachment");
|
const BAttachment = require('./battachment.js');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Revision represents a snapshot of note's title and content at some point in the past.
|
* Revision represents a snapshot of note's title and content at some point in the past.
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
const BAttachment = require("./entities/battachment");
|
const BAttachment = require('./entities/battachment.js');
|
||||||
const BAttribute = require('./entities/battribute');
|
const BAttribute = require('./entities/battribute.js');
|
||||||
const BBlob = require("./entities/bblob");
|
const BBlob = require('./entities/bblob.js');
|
||||||
const BBranch = require('./entities/bbranch');
|
const BBranch = require('./entities/bbranch.js');
|
||||||
const BEtapiToken = require('./entities/betapi_token');
|
const BEtapiToken = require('./entities/betapi_token.js');
|
||||||
const BNote = require('./entities/bnote');
|
const BNote = require('./entities/bnote.js');
|
||||||
const BOption = require('./entities/boption');
|
const BOption = require('./entities/boption.js');
|
||||||
const BRecentNote = require('./entities/brecent_note');
|
const BRecentNote = require('./entities/brecent_note.js');
|
||||||
const BRevision = require('./entities/brevision');
|
const BRevision = require('./entities/brevision.js');
|
||||||
|
|
||||||
const ENTITY_NAME_TO_ENTITY = {
|
const ENTITY_NAME_TO_ENTITY = {
|
||||||
"attachments": BAttachment,
|
"attachments": BAttachment,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
const becca = require('./becca');
|
const becca = require('./becca.js');
|
||||||
const log = require('../services/log');
|
const log = require('../services/log.js');
|
||||||
const beccaService = require('./becca_service');
|
const beccaService = require('./becca_service.js');
|
||||||
const dateUtils = require('../services/date_utils');
|
const dateUtils = require('../services/date_utils.js');
|
||||||
const {JSDOM} = require("jsdom");
|
const {JSDOM} = require("jsdom");
|
||||||
|
|
||||||
const DEBUG = false;
|
const DEBUG = false;
|
||||||
@ -35,7 +35,7 @@ const IGNORED_ATTR_NAMES = [
|
|||||||
function filterUrlValue(value) {
|
function filterUrlValue(value) {
|
||||||
return value
|
return value
|
||||||
.replace(/https?:\/\//ig, "")
|
.replace(/https?:\/\//ig, "")
|
||||||
.replace(/www\./ig, "")
|
.replace(/www.js\./ig, "")
|
||||||
.replace(/(\.net|\.com|\.org|\.info|\.edu)/ig, "");
|
.replace(/(\.net|\.com|\.org|\.info|\.edu)/ig, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const appInfo = require('../services/app_info');
|
const appInfo = require('../services/app_info.js');
|
||||||
const eu = require("./etapi_utils");
|
const eu = require('./etapi_utils.js');
|
||||||
|
|
||||||
function register(router) {
|
function register(router) {
|
||||||
eu.route(router, 'get', '/etapi/app-info', (req, res, next) => {
|
eu.route(router, 'get', '/etapi/app-info', (req, res, next) => {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
const becca = require("../becca/becca");
|
const becca = require('../becca/becca.js');
|
||||||
const eu = require("./etapi_utils");
|
const eu = require('./etapi_utils.js');
|
||||||
const mappers = require("./mappers");
|
const mappers = require('./mappers.js');
|
||||||
const v = require("./validators");
|
const v = require('./validators.js');
|
||||||
const utils = require("../services/utils");
|
const utils = require('../services/utils.js');
|
||||||
|
|
||||||
function register(router) {
|
function register(router) {
|
||||||
const ALLOWED_PROPERTIES_FOR_CREATE_ATTACHMENT = {
|
const ALLOWED_PROPERTIES_FOR_CREATE_ATTACHMENT = {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
const becca = require("../becca/becca");
|
const becca = require('../becca/becca.js');
|
||||||
const eu = require("./etapi_utils");
|
const eu = require('./etapi_utils.js');
|
||||||
const mappers = require("./mappers");
|
const mappers = require('./mappers.js');
|
||||||
const attributeService = require("../services/attributes");
|
const attributeService = require('../services/attributes.js');
|
||||||
const v = require("./validators");
|
const v = require('./validators.js');
|
||||||
|
|
||||||
function register(router) {
|
function register(router) {
|
||||||
eu.route(router, 'get', '/etapi/attributes/:attributeId', (req, res, next) => {
|
eu.route(router, 'get', '/etapi/attributes/:attributeId', (req, res, next) => {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
const becca = require("../becca/becca");
|
const becca = require('../becca/becca.js');
|
||||||
const eu = require("./etapi_utils");
|
const eu = require('./etapi_utils.js');
|
||||||
const passwordEncryptionService = require("../services/encryption/password_encryption");
|
const passwordEncryptionService = require('../services/encryption/password_encryption.js');
|
||||||
const etapiTokenService = require("../services/etapi_tokens");
|
const etapiTokenService = require('../services/etapi_tokens.js');
|
||||||
|
|
||||||
function register(router, loginMiddleware) {
|
function register(router, loginMiddleware) {
|
||||||
eu.NOT_AUTHENTICATED_ROUTE(router, 'post', '/etapi/auth/login', loginMiddleware, (req, res, next) => {
|
eu.NOT_AUTHENTICATED_ROUTE(router, 'post', '/etapi/auth/login', loginMiddleware, (req, res, next) => {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const eu = require("./etapi_utils");
|
const eu = require('./etapi_utils.js');
|
||||||
const backupService = require("../services/backup");
|
const backupService = require('../services/backup.js');
|
||||||
|
|
||||||
function register(router) {
|
function register(router) {
|
||||||
eu.route(router, 'put', '/etapi/backup/:backupName', async (req, res, next) => {
|
eu.route(router, 'put', '/etapi/backup/:backupName', async (req, res, next) => {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
const becca = require("../becca/becca");
|
const becca = require('../becca/becca.js');
|
||||||
const eu = require("./etapi_utils");
|
const eu = require('./etapi_utils.js');
|
||||||
const mappers = require("./mappers");
|
const mappers = require('./mappers.js');
|
||||||
const BBranch = require("../becca/entities/bbranch");
|
const BBranch = require('../becca/entities/bbranch.js');
|
||||||
const entityChangesService = require("../services/entity_changes");
|
const entityChangesService = require('../services/entity_changes.js');
|
||||||
const v = require("./validators");
|
const v = require('./validators.js');
|
||||||
|
|
||||||
function register(router) {
|
function register(router) {
|
||||||
eu.route(router, 'get', '/etapi/branches/:branchId', (req, res, next) => {
|
eu.route(router, 'get', '/etapi/branches/:branchId', (req, res, next) => {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
const cls = require("../services/cls");
|
const cls = require('../services/cls.js');
|
||||||
const sql = require("../services/sql");
|
const sql = require('../services/sql.js');
|
||||||
const log = require("../services/log");
|
const log = require('../services/log.js');
|
||||||
const becca = require("../becca/becca");
|
const becca = require('../becca/becca.js');
|
||||||
const etapiTokenService = require("../services/etapi_tokens");
|
const etapiTokenService = require('../services/etapi_tokens.js');
|
||||||
const config = require("../services/config");
|
const config = require('../services/config.js');
|
||||||
const GENERIC_CODE = "GENERIC";
|
const GENERIC_CODE = "GENERIC";
|
||||||
|
|
||||||
const noAuthentication = config.General && config.General.noAuthentication === true;
|
const noAuthentication = config.General && config.General.noAuthentication === true;
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
const becca = require("../becca/becca");
|
const becca = require('../becca/becca.js');
|
||||||
const utils = require("../services/utils");
|
const utils = require('../services/utils.js');
|
||||||
const eu = require("./etapi_utils");
|
const eu = require('./etapi_utils.js');
|
||||||
const mappers = require("./mappers");
|
const mappers = require('./mappers.js');
|
||||||
const noteService = require("../services/notes");
|
const noteService = require('../services/notes.js');
|
||||||
const TaskContext = require("../services/task_context");
|
const TaskContext = require('../services/task_context.js');
|
||||||
const v = require("./validators");
|
const v = require('./validators.js');
|
||||||
const searchService = require("../services/search/services/search");
|
const searchService = require('../services/search/services/search.js');
|
||||||
const SearchContext = require("../services/search/search_context");
|
const SearchContext = require('../services/search/search_context.js');
|
||||||
const zipExportService = require("../services/export/zip");
|
const zipExportService = require('../services/export/zip.js');
|
||||||
const zipImportService = require("../services/import/zip");
|
const zipImportService = require('../services/import/zip.js');
|
||||||
|
|
||||||
function register(router) {
|
function register(router) {
|
||||||
eu.route(router, 'get', '/etapi/notes', (req, res, next) => {
|
eu.route(router, 'get', '/etapi/notes', (req, res, next) => {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
const specialNotesService = require("../services/special_notes");
|
const specialNotesService = require('../services/special_notes.js');
|
||||||
const dateNotesService = require("../services/date_notes");
|
const dateNotesService = require('../services/date_notes.js');
|
||||||
const eu = require("./etapi_utils");
|
const eu = require('./etapi_utils.js');
|
||||||
const mappers = require("./mappers");
|
const mappers = require('./mappers.js');
|
||||||
|
|
||||||
const getDateInvalidError = date => new eu.EtapiError(400, "DATE_INVALID", `Date "${date}" is not valid.`);
|
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.`);
|
const getMonthInvalidError = month => new eu.EtapiError(400, "MONTH_INVALID", `Month "${month}" is not valid.`);
|
||||||
@ -74,4 +74,4 @@ function register(router) {
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
register
|
register
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const noteTypeService = require("../services/note_types");
|
const noteTypeService = require('../services/note_types.js');
|
||||||
const dateUtils = require("../services/date_utils");
|
const dateUtils = require('../services/date_utils.js');
|
||||||
|
|
||||||
function mandatory(obj) {
|
function mandatory(obj) {
|
||||||
if (obj === undefined ) {
|
if (obj === undefined ) {
|
||||||
@ -64,7 +64,7 @@ function isNoteId(obj) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const becca = require('../becca/becca');
|
const becca = require('../becca/becca.js');
|
||||||
|
|
||||||
if (typeof obj !== 'string') {
|
if (typeof obj !== 'string') {
|
||||||
return `'${obj}' is not a valid noteId`;
|
return `'${obj}' is not a valid noteId`;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const appInfo = require('../../services/app_info');
|
const appInfo = require('../../services/app_info.js');
|
||||||
|
|
||||||
function getAppInfo() {
|
function getAppInfo() {
|
||||||
return appInfo;
|
return appInfo;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const becca = require("../../becca/becca");
|
const becca = require('../../becca/becca.js');
|
||||||
const blobService = require("../../services/blob");
|
const blobService = require('../../services/blob.js');
|
||||||
const ValidationError = require("../../errors/validation_error");
|
const ValidationError = require('../../errors/validation_error.js');
|
||||||
const imageService = require("../../services/image.js");
|
const imageService = require("../../services/image.js");
|
||||||
|
|
||||||
function getAttachmentBlob(req) {
|
function getAttachmentBlob(req) {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const sql = require('../../services/sql');
|
const sql = require('../../services/sql.js');
|
||||||
const log = require('../../services/log');
|
const log = require('../../services/log.js');
|
||||||
const attributeService = require('../../services/attributes');
|
const attributeService = require('../../services/attributes.js');
|
||||||
const BAttribute = require('../../becca/entities/battribute');
|
const BAttribute = require('../../becca/entities/battribute.js');
|
||||||
const becca = require("../../becca/becca");
|
const becca = require('../../becca/becca.js');
|
||||||
const ValidationError = require("../../errors/validation_error");
|
const ValidationError = require('../../errors/validation_error.js');
|
||||||
|
|
||||||
function getEffectiveNoteAttributes(req) {
|
function getEffectiveNoteAttributes(req) {
|
||||||
const note = becca.getNote(req.params.noteId);
|
const note = becca.getNote(req.params.noteId);
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const beccaService = require('../../becca/becca_service');
|
const beccaService = require('../../becca/becca_service.js');
|
||||||
const searchService = require('../../services/search/services/search');
|
const searchService = require('../../services/search/services/search.js');
|
||||||
const log = require('../../services/log');
|
const log = require('../../services/log.js');
|
||||||
const utils = require('../../services/utils');
|
const utils = require('../../services/utils.js');
|
||||||
const cls = require('../../services/cls');
|
const cls = require('../../services/cls.js');
|
||||||
const becca = require("../../becca/becca");
|
const becca = require('../../becca/becca.js');
|
||||||
|
|
||||||
function getAutocomplete(req) {
|
function getAutocomplete(req) {
|
||||||
const query = req.query.query.trim();
|
const query = req.query.query.trim();
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const dateUtils = require('../../services/date_utils');
|
const dateUtils = require('../../services/date_utils.js');
|
||||||
const {LOG_DIR} = require('../../services/data_dir');
|
const {LOG_DIR} = require('../../services/data_dir.js');
|
||||||
|
|
||||||
function getBackendLog() {
|
function getBackendLog() {
|
||||||
const file = `${LOG_DIR}/trilium-${dateUtils.localNowDate()}.log`;
|
const file = `${LOG_DIR}/trilium-${dateUtils.localNowDate()}.log`;
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const sql = require('../../services/sql');
|
const sql = require('../../services/sql.js');
|
||||||
const utils = require('../../services/utils');
|
const utils = require('../../services/utils.js');
|
||||||
const entityChangesService = require('../../services/entity_changes');
|
const entityChangesService = require('../../services/entity_changes.js');
|
||||||
const treeService = require('../../services/tree');
|
const treeService = require('../../services/tree.js');
|
||||||
const eraseService = require('../../services/erase');
|
const eraseService = require('../../services/erase.js');
|
||||||
const becca = require('../../becca/becca');
|
const becca = require('../../becca/becca.js');
|
||||||
const TaskContext = require('../../services/task_context');
|
const TaskContext = require('../../services/task_context.js');
|
||||||
const branchService = require("../../services/branches");
|
const branchService = require('../../services/branches.js');
|
||||||
const log = require("../../services/log");
|
const log = require('../../services/log.js');
|
||||||
const ValidationError = require("../../errors/validation_error");
|
const ValidationError = require('../../errors/validation_error.js');
|
||||||
const eventService = require("../../services/events.js");
|
const eventService = require("../../services/events.js");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const becca = require("../../becca/becca");
|
const becca = require('../../becca/becca.js');
|
||||||
const bulkActionService = require("../../services/bulk_actions");
|
const bulkActionService = require('../../services/bulk_actions.js');
|
||||||
|
|
||||||
function execute(req) {
|
function execute(req) {
|
||||||
const {noteIds, includeDescendants} = req.body;
|
const {noteIds, includeDescendants} = req.body;
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const attributeService = require("../../services/attributes");
|
const attributeService = require('../../services/attributes.js');
|
||||||
const cloneService = require("../../services/cloning");
|
const cloneService = require('../../services/cloning.js');
|
||||||
const noteService = require('../../services/notes');
|
const noteService = require('../../services/notes.js');
|
||||||
const dateNoteService = require('../../services/date_notes');
|
const dateNoteService = require('../../services/date_notes.js');
|
||||||
const dateUtils = require('../../services/date_utils');
|
const dateUtils = require('../../services/date_utils.js');
|
||||||
const imageService = require('../../services/image');
|
const imageService = require('../../services/image.js');
|
||||||
const appInfo = require('../../services/app_info');
|
const appInfo = require('../../services/app_info.js');
|
||||||
const ws = require('../../services/ws');
|
const ws = require('../../services/ws.js');
|
||||||
const log = require('../../services/log');
|
const log = require('../../services/log.js');
|
||||||
const utils = require('../../services/utils');
|
const utils = require('../../services/utils.js');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const htmlSanitizer = require('../../services/html_sanitizer');
|
const htmlSanitizer = require('../../services/html_sanitizer.js');
|
||||||
const {formatAttrForSearch} = require("../../services/attribute_formatter");
|
const {formatAttrForSearch} = require('../../services/attribute_formatter.js');
|
||||||
const jsdom = require("jsdom");
|
const jsdom = require("jsdom");
|
||||||
const { JSDOM } = jsdom;
|
const { JSDOM } = jsdom;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const cloningService = require('../../services/cloning');
|
const cloningService = require('../../services/cloning.js');
|
||||||
|
|
||||||
function cloneNoteToBranch(req) {
|
function cloneNoteToBranch(req) {
|
||||||
const {noteId, parentBranchId} = req.params;
|
const {noteId, parentBranchId} = req.params;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const sql = require('../../services/sql');
|
const sql = require('../../services/sql.js');
|
||||||
const log = require('../../services/log');
|
const log = require('../../services/log.js');
|
||||||
const backupService = require('../../services/backup');
|
const backupService = require('../../services/backup.js');
|
||||||
const anonymizationService = require('../../services/anonymization');
|
const anonymizationService = require('../../services/anonymization.js');
|
||||||
const consistencyChecksService = require('../../services/consistency_checks');
|
const consistencyChecksService = require('../../services/consistency_checks.js');
|
||||||
|
|
||||||
function getExistingBackups() {
|
function getExistingBackups() {
|
||||||
return backupService.getExistingBackups();
|
return backupService.getExistingBackups();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const etapiTokenService = require("../../services/etapi_tokens");
|
const etapiTokenService = require('../../services/etapi_tokens.js');
|
||||||
|
|
||||||
function getTokens() {
|
function getTokens() {
|
||||||
const tokens = etapiTokenService.getTokens();
|
const tokens = etapiTokenService.getTokens();
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const zipExportService = require('../../services/export/zip');
|
const zipExportService = require('../../services/export/zip.js');
|
||||||
const singleExportService = require('../../services/export/single');
|
const singleExportService = require('../../services/export/single.js');
|
||||||
const opmlExportService = require('../../services/export/opml');
|
const opmlExportService = require('../../services/export/opml.js');
|
||||||
const becca = require('../../becca/becca');
|
const becca = require('../../becca/becca.js');
|
||||||
const TaskContext = require("../../services/task_context");
|
const TaskContext = require('../../services/task_context.js');
|
||||||
const log = require("../../services/log");
|
const log = require('../../services/log.js');
|
||||||
const NotFoundError = require("../../errors/not_found_error");
|
const NotFoundError = require('../../errors/not_found_error.js');
|
||||||
|
|
||||||
function exportBranch(req, res) {
|
function exportBranch(req, res) {
|
||||||
const {branchId, type, format, version, taskId} = req.params;
|
const {branchId, type, format, version, taskId} = req.params;
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const protectedSessionService = require('../../services/protected_session');
|
const protectedSessionService = require('../../services/protected_session.js');
|
||||||
const utils = require('../../services/utils');
|
const utils = require('../../services/utils.js');
|
||||||
const log = require('../../services/log');
|
const log = require('../../services/log.js');
|
||||||
const noteService = require('../../services/notes');
|
const noteService = require('../../services/notes.js');
|
||||||
const tmp = require('tmp');
|
const tmp = require('tmp');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const { Readable } = require('stream');
|
const { Readable } = require('stream');
|
||||||
const chokidar = require('chokidar');
|
const chokidar = require('chokidar');
|
||||||
const ws = require('../../services/ws');
|
const ws = require('../../services/ws.js');
|
||||||
const becca = require("../../becca/becca");
|
const becca = require('../../becca/becca.js');
|
||||||
const ValidationError = require("../../errors/validation_error");
|
const ValidationError = require('../../errors/validation_error.js');
|
||||||
|
|
||||||
function updateFile(req) {
|
function updateFile(req) {
|
||||||
const note = becca.getNoteOrThrow(req.params.noteId);
|
const note = becca.getNoteOrThrow(req.params.noteId);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const optionService = require('../../services/options');
|
const optionService = require('../../services/options.js');
|
||||||
|
|
||||||
function getFontCss(req, res) {
|
function getFontCss(req, res) {
|
||||||
res.setHeader('Content-Type', 'text/css');
|
res.setHeader('Content-Type', 'text/css');
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const imageService = require('../../services/image');
|
const imageService = require('../../services/image.js');
|
||||||
const becca = require('../../becca/becca');
|
const becca = require('../../becca/becca.js');
|
||||||
const RESOURCE_DIR = require('../../services/resource_dir').RESOURCE_DIR;
|
const RESOURCE_DIR = require('../../services/resource_dir.js').RESOURCE_DIR;
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
function returnImageFromNote(req, res) {
|
function returnImageFromNote(req, res) {
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const enexImportService = require('../../services/import/enex');
|
const enexImportService = require('../../services/import/enex.js');
|
||||||
const opmlImportService = require('../../services/import/opml');
|
const opmlImportService = require('../../services/import/opml.js');
|
||||||
const zipImportService = require('../../services/import/zip');
|
const zipImportService = require('../../services/import/zip.js');
|
||||||
const singleImportService = require('../../services/import/single');
|
const singleImportService = require('../../services/import/single.js');
|
||||||
const cls = require('../../services/cls');
|
const cls = require('../../services/cls.js');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const becca = require('../../becca/becca');
|
const becca = require('../../becca/becca.js');
|
||||||
const beccaLoader = require('../../becca/becca_loader');
|
const beccaLoader = require('../../becca/becca_loader.js');
|
||||||
const log = require('../../services/log');
|
const log = require('../../services/log.js');
|
||||||
const TaskContext = require('../../services/task_context');
|
const TaskContext = require('../../services/task_context.js');
|
||||||
const ValidationError = require("../../errors/validation_error");
|
const ValidationError = require('../../errors/validation_error.js');
|
||||||
|
|
||||||
async function importNotesToBranch(req) {
|
async function importNotesToBranch(req) {
|
||||||
const {parentNoteId} = req.params;
|
const {parentNoteId} = req.params;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const keyboardActions = require('../../services/keyboard_actions');
|
const keyboardActions = require('../../services/keyboard_actions.js');
|
||||||
const becca = require('../../becca/becca');
|
const becca = require('../../becca/becca.js');
|
||||||
|
|
||||||
function getKeyboardActions() {
|
function getKeyboardActions() {
|
||||||
return keyboardActions.getKeyboardActions();
|
return keyboardActions.getKeyboardActions();
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const options = require('../../services/options');
|
const options = require('../../services/options.js');
|
||||||
const utils = require('../../services/utils');
|
const utils = require('../../services/utils.js');
|
||||||
const dateUtils = require('../../services/date_utils');
|
const dateUtils = require('../../services/date_utils.js');
|
||||||
const instanceId = require('../../services/instance_id');
|
const instanceId = require('../../services/instance_id.js');
|
||||||
const passwordEncryptionService = require('../../services/encryption/password_encryption');
|
const passwordEncryptionService = require('../../services/encryption/password_encryption.js');
|
||||||
const protectedSessionService = require('../../services/protected_session');
|
const protectedSessionService = require('../../services/protected_session.js');
|
||||||
const appInfo = require('../../services/app_info');
|
const appInfo = require('../../services/app_info.js');
|
||||||
const eventService = require('../../services/events');
|
const eventService = require('../../services/events.js');
|
||||||
const sqlInit = require('../../services/sql_init');
|
const sqlInit = require('../../services/sql_init.js');
|
||||||
const sql = require('../../services/sql');
|
const sql = require('../../services/sql.js');
|
||||||
const ws = require("../../services/ws");
|
const ws = require('../../services/ws.js');
|
||||||
const etapiTokenService = require("../../services/etapi_tokens");
|
const etapiTokenService = require('../../services/etapi_tokens.js');
|
||||||
|
|
||||||
function loginSync(req) {
|
function loginSync(req) {
|
||||||
if (!sqlInit.schemaExists()) {
|
if (!sqlInit.schemaExists()) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const becca = require("../../becca/becca");
|
const becca = require('../../becca/becca.js');
|
||||||
const { JSDOM } = require("jsdom");
|
const { JSDOM } = require("jsdom");
|
||||||
|
|
||||||
function buildDescendantCountMap(noteIdsToCount) {
|
function buildDescendantCountMap(noteIdsToCount) {
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const noteService = require('../../services/notes');
|
const noteService = require('../../services/notes.js');
|
||||||
const eraseService = require('../../services/erase');
|
const eraseService = require('../../services/erase.js');
|
||||||
const treeService = require('../../services/tree');
|
const treeService = require('../../services/tree.js');
|
||||||
const sql = require('../../services/sql');
|
const sql = require('../../services/sql.js');
|
||||||
const utils = require('../../services/utils');
|
const utils = require('../../services/utils.js');
|
||||||
const log = require('../../services/log');
|
const log = require('../../services/log.js');
|
||||||
const TaskContext = require('../../services/task_context');
|
const TaskContext = require('../../services/task_context.js');
|
||||||
const becca = require("../../becca/becca");
|
const becca = require('../../becca/becca.js');
|
||||||
const ValidationError = require("../../errors/validation_error");
|
const ValidationError = require('../../errors/validation_error.js');
|
||||||
const blobService = require("../../services/blob");
|
const blobService = require('../../services/blob.js');
|
||||||
|
|
||||||
function getNote(req) {
|
function getNote(req) {
|
||||||
return becca.getNoteOrThrow(req.params.noteId);
|
return becca.getNoteOrThrow(req.params.noteId);
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const optionService = require('../../services/options');
|
const optionService = require('../../services/options.js');
|
||||||
const log = require('../../services/log');
|
const log = require('../../services/log.js');
|
||||||
const searchService = require('../../services/search/services/search');
|
const searchService = require('../../services/search/services/search.js');
|
||||||
const ValidationError = require("../../errors/validation_error");
|
const ValidationError = require('../../errors/validation_error.js');
|
||||||
|
|
||||||
// options allowed to be updated directly in the Options dialog
|
// options allowed to be updated directly in the Options dialog
|
||||||
const ALLOWED_OPTIONS = new Set([
|
const ALLOWED_OPTIONS = new Set([
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const becca = require("../../becca/becca");
|
const becca = require('../../becca/becca.js');
|
||||||
const markdownService = require("../../services/import/markdown");
|
const markdownService = require('../../services/import/markdown.js');
|
||||||
|
|
||||||
function getIconUsage() {
|
function getIconUsage() {
|
||||||
const iconClassToCountMap = {};
|
const iconClassToCountMap = {};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const passwordService = require('../../services/encryption/password');
|
const passwordService = require('../../services/encryption/password.js');
|
||||||
const ValidationError = require("../../errors/validation_error");
|
const ValidationError = require('../../errors/validation_error.js');
|
||||||
|
|
||||||
function changePassword(req) {
|
function changePassword(req) {
|
||||||
if (passwordService.isPasswordSet()) {
|
if (passwordService.isPasswordSet()) {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const sql = require('../../services/sql');
|
const sql = require('../../services/sql.js');
|
||||||
const protectedSessionService = require('../../services/protected_session');
|
const protectedSessionService = require('../../services/protected_session.js');
|
||||||
const noteService = require('../../services/notes');
|
const noteService = require('../../services/notes.js');
|
||||||
const becca = require("../../becca/becca");
|
const becca = require('../../becca/becca.js');
|
||||||
|
|
||||||
function getRecentChanges(req) {
|
function getRecentChanges(req) {
|
||||||
const {ancestorNoteId} = req.params;
|
const {ancestorNoteId} = req.params;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const BRecentNote = require('../../becca/entities/brecent_note');
|
const BRecentNote = require('../../becca/entities/brecent_note.js');
|
||||||
const sql = require('../../services/sql');
|
const sql = require('../../services/sql.js');
|
||||||
const dateUtils = require('../../services/date_utils');
|
const dateUtils = require('../../services/date_utils.js');
|
||||||
|
|
||||||
function addRecentNote(req) {
|
function addRecentNote(req) {
|
||||||
new BRecentNote({
|
new BRecentNote({
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const becca = require("../../becca/becca");
|
const becca = require('../../becca/becca.js');
|
||||||
const sql = require("../../services/sql");
|
const sql = require('../../services/sql.js');
|
||||||
|
|
||||||
function getRelationMap(req) {
|
function getRelationMap(req) {
|
||||||
const {relationMapNoteId, noteIds} = req.body;
|
const {relationMapNoteId, noteIds} = req.body;
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const beccaService = require('../../becca/becca_service');
|
const beccaService = require('../../becca/becca_service.js');
|
||||||
const revisionService = require('../../services/revisions');
|
const revisionService = require('../../services/revisions.js');
|
||||||
const utils = require('../../services/utils');
|
const utils = require('../../services/utils.js');
|
||||||
const sql = require('../../services/sql');
|
const sql = require('../../services/sql.js');
|
||||||
const cls = require('../../services/cls');
|
const cls = require('../../services/cls.js');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const becca = require("../../becca/becca");
|
const becca = require('../../becca/becca.js');
|
||||||
const blobService = require("../../services/blob");
|
const blobService = require('../../services/blob.js');
|
||||||
|
|
||||||
function getRevisionBlob(req) {
|
function getRevisionBlob(req) {
|
||||||
const preview = req.query.preview === 'true';
|
const preview = req.query.preview === 'true';
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const scriptService = require('../../services/script');
|
const scriptService = require('../../services/script.js');
|
||||||
const attributeService = require('../../services/attributes');
|
const attributeService = require('../../services/attributes.js');
|
||||||
const becca = require('../../becca/becca');
|
const becca = require('../../becca/becca.js');
|
||||||
const syncService = require('../../services/sync');
|
const syncService = require('../../services/sync.js');
|
||||||
const sql = require('../../services/sql');
|
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
|
// 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
|
// need to await it and make the complete response including metadata available in a Promise, so that the route detects
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const becca = require('../../becca/becca');
|
const becca = require('../../becca/becca.js');
|
||||||
const SearchContext = require('../../services/search/search_context');
|
const SearchContext = require('../../services/search/search_context.js');
|
||||||
const searchService = require('../../services/search/services/search');
|
const searchService = require('../../services/search/services/search.js');
|
||||||
const bulkActionService = require("../../services/bulk_actions");
|
const bulkActionService = require('../../services/bulk_actions.js');
|
||||||
const cls = require("../../services/cls");
|
const cls = require('../../services/cls.js');
|
||||||
const {formatAttrForSearch} = require("../../services/attribute_formatter");
|
const {formatAttrForSearch} = require('../../services/attribute_formatter.js');
|
||||||
const ValidationError = require("../../errors/validation_error");
|
const ValidationError = require('../../errors/validation_error.js');
|
||||||
|
|
||||||
function searchFromNote(req) {
|
function searchFromNote(req) {
|
||||||
const note = becca.getNoteOrThrow(req.params.noteId);
|
const note = becca.getNoteOrThrow(req.params.noteId);
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const imageType = require('image-type');
|
const imageType = require('image-type');
|
||||||
const imageService = require('../../services/image');
|
const imageService = require('../../services/image.js');
|
||||||
const noteService = require('../../services/notes');
|
const noteService = require('../../services/notes.js');
|
||||||
const {sanitizeAttributeName} = require("../../services/sanitize_attribute_name");
|
const {sanitizeAttributeName} = require('../../services/sanitize_attribute_name.js');
|
||||||
const specialNotesService = require("../../services/special_notes");
|
const specialNotesService = require('../../services/special_notes.js');
|
||||||
|
|
||||||
function uploadImage(req) {
|
function uploadImage(req) {
|
||||||
const file = req.file;
|
const file = req.file;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const sqlInit = require('../../services/sql_init');
|
const sqlInit = require('../../services/sql_init.js');
|
||||||
const setupService = require('../../services/setup');
|
const setupService = require('../../services/setup.js');
|
||||||
const log = require('../../services/log');
|
const log = require('../../services/log.js');
|
||||||
const appInfo = require('../../services/app_info');
|
const appInfo = require('../../services/app_info.js');
|
||||||
|
|
||||||
function getStatus() {
|
function getStatus() {
|
||||||
return {
|
return {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const similarityService = require('../../becca/similarity');
|
const similarityService = require('../../becca/similarity.js');
|
||||||
const becca = require("../../becca/becca");
|
const becca = require('../../becca/becca.js');
|
||||||
|
|
||||||
async function getSimilarNotes(req) {
|
async function getSimilarNotes(req) {
|
||||||
const noteId = req.params.noteId;
|
const noteId = req.params.noteId;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const dateNoteService = require('../../services/date_notes');
|
const dateNoteService = require('../../services/date_notes.js');
|
||||||
const sql = require('../../services/sql');
|
const sql = require('../../services/sql.js');
|
||||||
const cls = require('../../services/cls');
|
const cls = require('../../services/cls.js');
|
||||||
const specialNotesService = require('../../services/special_notes');
|
const specialNotesService = require('../../services/special_notes.js');
|
||||||
const becca = require('../../becca/becca');
|
const becca = require('../../becca/becca.js');
|
||||||
|
|
||||||
function getInboxNote(req) {
|
function getInboxNote(req) {
|
||||||
return specialNotesService.getInboxNote(req.params.date);
|
return specialNotesService.getInboxNote(req.params.date);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const sql = require('../../services/sql');
|
const sql = require('../../services/sql.js');
|
||||||
const becca = require("../../becca/becca");
|
const becca = require('../../becca/becca.js');
|
||||||
|
|
||||||
function getSchema() {
|
function getSchema() {
|
||||||
const tableNames = sql.getColumn(`SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%' ORDER BY name`);
|
const tableNames = sql.getColumn(`SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%' ORDER BY name`);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const sql = require('../../services/sql');
|
const sql = require('../../services/sql.js');
|
||||||
const becca = require('../../becca/becca');
|
const becca = require('../../becca/becca.js');
|
||||||
|
|
||||||
function getNoteSize(req) {
|
function getNoteSize(req) {
|
||||||
const {noteId} = req.params;
|
const {noteId} = req.params;
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const syncService = require('../../services/sync');
|
const syncService = require('../../services/sync.js');
|
||||||
const syncUpdateService = require('../../services/sync_update');
|
const syncUpdateService = require('../../services/sync_update.js');
|
||||||
const entityChangesService = require('../../services/entity_changes');
|
const entityChangesService = require('../../services/entity_changes.js');
|
||||||
const sql = require('../../services/sql');
|
const sql = require('../../services/sql.js');
|
||||||
const sqlInit = require('../../services/sql_init');
|
const sqlInit = require('../../services/sql_init.js');
|
||||||
const optionService = require('../../services/options');
|
const optionService = require('../../services/options.js');
|
||||||
const contentHashService = require('../../services/content_hash');
|
const contentHashService = require('../../services/content_hash.js');
|
||||||
const log = require('../../services/log');
|
const log = require('../../services/log.js');
|
||||||
const syncOptions = require('../../services/sync_options');
|
const syncOptions = require('../../services/sync_options.js');
|
||||||
const utils = require('../../services/utils');
|
const utils = require('../../services/utils.js');
|
||||||
const ws = require('../../services/ws');
|
const ws = require('../../services/ws.js');
|
||||||
|
|
||||||
async function testSync() {
|
async function testSync() {
|
||||||
try {
|
try {
|
||||||
@ -193,7 +193,7 @@ function queueSector(req) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function checkEntityChanges() {
|
function checkEntityChanges() {
|
||||||
require("../../services/consistency_checks").runEntityChangesChecks();
|
require('../../services/consistency_checks.js').runEntityChangesChecks();
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const becca = require('../../becca/becca');
|
const becca = require('../../becca/becca.js');
|
||||||
const log = require('../../services/log');
|
const log = require('../../services/log.js');
|
||||||
const NotFoundError = require("../../errors/not_found_error");
|
const NotFoundError = require('../../errors/not_found_error.js');
|
||||||
|
|
||||||
function getNotesAndBranchesAndAttributes(noteIds) {
|
function getNotesAndBranchesAndAttributes(noteIds) {
|
||||||
noteIds = new Set(noteIds);
|
noteIds = new Set(noteIds);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
const assetPath = require("../services/asset_path");
|
const assetPath = require('../services/asset_path.js');
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const express = require("express");
|
const express = require("express");
|
||||||
const env = require("../services/env");
|
const env = require('../services/env.js');
|
||||||
|
|
||||||
const persistentCacheStatic = (root, options) => {
|
const persistentCacheStatic = (root, options) => {
|
||||||
if (!env.isDev()) {
|
if (!env.isDev()) {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
const log = require('../services/log');
|
const log = require('../services/log.js');
|
||||||
const fileService = require('./api/files');
|
const fileService = require('./api/files.js');
|
||||||
const scriptService = require('../services/script');
|
const scriptService = require('../services/script.js');
|
||||||
const cls = require('../services/cls');
|
const cls = require('../services/cls.js');
|
||||||
const sql = require("../services/sql");
|
const sql = require('../services/sql.js');
|
||||||
const becca = require("../becca/becca");
|
const becca = require('../becca/becca.js');
|
||||||
|
|
||||||
function handleRequest(req, res) {
|
function handleRequest(req, res) {
|
||||||
// express puts content after first slash into 0 index element
|
// express puts content after first slash into 0 index element
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const log = require("../services/log");
|
const log = require('../services/log.js');
|
||||||
|
|
||||||
function register(app) {
|
function register(app) {
|
||||||
app.use((err, req, res, next) => {
|
app.use((err, req, res, next) => {
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const sql = require('../services/sql');
|
const sql = require('../services/sql.js');
|
||||||
const attributeService = require('../services/attributes');
|
const attributeService = require('../services/attributes.js');
|
||||||
const config = require('../services/config');
|
const config = require('../services/config.js');
|
||||||
const optionService = require('../services/options');
|
const optionService = require('../services/options.js');
|
||||||
const log = require('../services/log');
|
const log = require('../services/log.js');
|
||||||
const env = require('../services/env');
|
const env = require('../services/env.js');
|
||||||
const utils = require('../services/utils');
|
const utils = require('../services/utils.js');
|
||||||
const protectedSessionService = require("../services/protected_session");
|
const protectedSessionService = require('../services/protected_session.js');
|
||||||
const packageJson = require('../../package.json');
|
const packageJson = require('../../package.json');
|
||||||
const assetPath = require("../services/asset_path");
|
const assetPath = require('../services/asset_path.js');
|
||||||
const appPath = require("../services/app_path");
|
const appPath = require('../services/app_path.js');
|
||||||
|
|
||||||
function index(req, res) {
|
function index(req, res) {
|
||||||
const options = optionService.getOptionMap();
|
const options = optionService.getOptionMap();
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const utils = require('../services/utils');
|
const utils = require('../services/utils.js');
|
||||||
const optionService = require('../services/options');
|
const optionService = require('../services/options.js');
|
||||||
const myScryptService = require('../services/encryption/my_scrypt');
|
const myScryptService = require('../services/encryption/my_scrypt.js');
|
||||||
const log = require('../services/log');
|
const log = require('../services/log.js');
|
||||||
const passwordService = require("../services/encryption/password");
|
const passwordService = require('../services/encryption/password.js');
|
||||||
const assetPath = require("../services/asset_path");
|
const assetPath = require('../services/asset_path.js');
|
||||||
const appPath = require("../services/app_path");
|
const appPath = require('../services/app_path.js');
|
||||||
const ValidationError = require("../errors/validation_error");
|
const ValidationError = require('../errors/validation_error.js');
|
||||||
|
|
||||||
function loginPage(req, res) {
|
function loginPage(req, res) {
|
||||||
res.render('login', {
|
res.render('login', {
|
||||||
|
@ -1,75 +1,75 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const utils = require('../services/utils');
|
const utils = require('../services/utils.js');
|
||||||
const multer = require('multer');
|
const multer = require('multer');
|
||||||
const log = require('../services/log');
|
const log = require('../services/log.js');
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
const auth = require('../services/auth');
|
const auth = require('../services/auth.js');
|
||||||
const cls = require('../services/cls');
|
const cls = require('../services/cls.js');
|
||||||
const sql = require('../services/sql');
|
const sql = require('../services/sql.js');
|
||||||
const entityChangesService = require('../services/entity_changes');
|
const entityChangesService = require('../services/entity_changes.js');
|
||||||
const csurf = require('csurf');
|
const csurf = require('csurf');
|
||||||
const { createPartialContentHandler } = require("express-partial-content");
|
const { createPartialContentHandler } = require("express-partial-content");
|
||||||
const rateLimit = require("express-rate-limit");
|
const rateLimit = require("express-rate-limit");
|
||||||
const AbstractBeccaEntity = require("../becca/entities/abstract_becca_entity");
|
const AbstractBeccaEntity = require('../becca/entities/abstract_becca_entity.js');
|
||||||
const NotFoundError = require("../errors/not_found_error");
|
const NotFoundError = require('../errors/not_found_error.js');
|
||||||
const ValidationError = require("../errors/validation_error");
|
const ValidationError = require('../errors/validation_error.js');
|
||||||
|
|
||||||
// page routes
|
// page routes
|
||||||
const setupRoute = require('./setup');
|
const setupRoute = require('./setup.js');
|
||||||
const loginRoute = require('./login');
|
const loginRoute = require('./login.js');
|
||||||
const indexRoute = require('./index');
|
const indexRoute = require('./index.js');
|
||||||
|
|
||||||
// API routes
|
// API routes
|
||||||
const treeApiRoute = require('./api/tree');
|
const treeApiRoute = require('./api/tree.js');
|
||||||
const notesApiRoute = require('./api/notes');
|
const notesApiRoute = require('./api/notes.js');
|
||||||
const branchesApiRoute = require('./api/branches');
|
const branchesApiRoute = require('./api/branches.js');
|
||||||
const attachmentsApiRoute = require('./api/attachments');
|
const attachmentsApiRoute = require('./api/attachments.js');
|
||||||
const autocompleteApiRoute = require('./api/autocomplete');
|
const autocompleteApiRoute = require('./api/autocomplete.js');
|
||||||
const cloningApiRoute = require('./api/cloning');
|
const cloningApiRoute = require('./api/cloning.js');
|
||||||
const revisionsApiRoute = require('./api/revisions');
|
const revisionsApiRoute = require('./api/revisions.js');
|
||||||
const recentChangesApiRoute = require('./api/recent_changes');
|
const recentChangesApiRoute = require('./api/recent_changes.js');
|
||||||
const optionsApiRoute = require('./api/options');
|
const optionsApiRoute = require('./api/options.js');
|
||||||
const passwordApiRoute = require('./api/password');
|
const passwordApiRoute = require('./api/password.js');
|
||||||
const syncApiRoute = require('./api/sync');
|
const syncApiRoute = require('./api/sync.js');
|
||||||
const loginApiRoute = require('./api/login');
|
const loginApiRoute = require('./api/login.js');
|
||||||
const recentNotesRoute = require('./api/recent_notes');
|
const recentNotesRoute = require('./api/recent_notes.js');
|
||||||
const appInfoRoute = require('./api/app_info');
|
const appInfoRoute = require('./api/app_info.js');
|
||||||
const exportRoute = require('./api/export');
|
const exportRoute = require('./api/export.js');
|
||||||
const importRoute = require('./api/import');
|
const importRoute = require('./api/import.js');
|
||||||
const setupApiRoute = require('./api/setup');
|
const setupApiRoute = require('./api/setup.js');
|
||||||
const sqlRoute = require('./api/sql');
|
const sqlRoute = require('./api/sql.js');
|
||||||
const databaseRoute = require('./api/database');
|
const databaseRoute = require('./api/database.js');
|
||||||
const imageRoute = require('./api/image');
|
const imageRoute = require('./api/image.js');
|
||||||
const attributesRoute = require('./api/attributes');
|
const attributesRoute = require('./api/attributes.js');
|
||||||
const scriptRoute = require('./api/script');
|
const scriptRoute = require('./api/script.js');
|
||||||
const senderRoute = require('./api/sender');
|
const senderRoute = require('./api/sender.js');
|
||||||
const filesRoute = require('./api/files');
|
const filesRoute = require('./api/files.js');
|
||||||
const searchRoute = require('./api/search');
|
const searchRoute = require('./api/search.js');
|
||||||
const bulkActionRoute = require('./api/bulk_action');
|
const bulkActionRoute = require('./api/bulk_action.js');
|
||||||
const specialNotesRoute = require('./api/special_notes');
|
const specialNotesRoute = require('./api/special_notes.js');
|
||||||
const noteMapRoute = require('./api/note_map');
|
const noteMapRoute = require('./api/note_map.js');
|
||||||
const clipperRoute = require('./api/clipper');
|
const clipperRoute = require('./api/clipper.js');
|
||||||
const similarNotesRoute = require('./api/similar_notes');
|
const similarNotesRoute = require('./api/similar_notes.js');
|
||||||
const keysRoute = require('./api/keys');
|
const keysRoute = require('./api/keys.js');
|
||||||
const backendLogRoute = require('./api/backend_log');
|
const backendLogRoute = require('./api/backend_log.js');
|
||||||
const statsRoute = require('./api/stats');
|
const statsRoute = require('./api/stats.js');
|
||||||
const fontsRoute = require('./api/fonts');
|
const fontsRoute = require('./api/fonts.js');
|
||||||
const etapiTokensApiRoutes = require('./api/etapi_tokens');
|
const etapiTokensApiRoutes = require('./api/etapi_tokens.js');
|
||||||
const relationMapApiRoute = require('./api/relation-map');
|
const relationMapApiRoute = require('./api/relation-map');
|
||||||
const otherRoute = require('./api/other');
|
const otherRoute = require('./api/other.js');
|
||||||
const shareRoutes = require('../share/routes');
|
const shareRoutes = require('../share/routes.js');
|
||||||
|
|
||||||
const etapiAuthRoutes = require('../etapi/auth');
|
const etapiAuthRoutes = require('../etapi/auth.js');
|
||||||
const etapiAppInfoRoutes = require('../etapi/app_info');
|
const etapiAppInfoRoutes = require('../etapi/app_info.js');
|
||||||
const etapiAttachmentRoutes = require('../etapi/attachments');
|
const etapiAttachmentRoutes = require('../etapi/attachments.js');
|
||||||
const etapiAttributeRoutes = require('../etapi/attributes');
|
const etapiAttributeRoutes = require('../etapi/attributes.js');
|
||||||
const etapiBranchRoutes = require('../etapi/branches');
|
const etapiBranchRoutes = require('../etapi/branches.js');
|
||||||
const etapiNoteRoutes = require('../etapi/notes');
|
const etapiNoteRoutes = require('../etapi/notes.js');
|
||||||
const etapiSpecialNoteRoutes = require('../etapi/special_notes');
|
const etapiSpecialNoteRoutes = require('../etapi/special_notes.js');
|
||||||
const etapiSpecRoute = require('../etapi/spec');
|
const etapiSpecRoute = require('../etapi/spec.js');
|
||||||
const etapiBackupRoute = require('../etapi/backup');
|
const etapiBackupRoute = require('../etapi/backup.js');
|
||||||
|
|
||||||
const csrfMiddleware = csurf({
|
const csrfMiddleware = csurf({
|
||||||
cookie: true,
|
cookie: true,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const session = require("express-session");
|
const session = require("express-session");
|
||||||
const sessionSecret = require("../services/session_secret");
|
const sessionSecret = require('../services/session_secret.js');
|
||||||
const dataDir = require("../services/data_dir");
|
const dataDir = require('../services/data_dir.js');
|
||||||
const FileStore = require('session-file-store')(session);
|
const FileStore = require('session-file-store')(session);
|
||||||
|
|
||||||
const sessionParser = session({
|
const sessionParser = session({
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const sqlInit = require('../services/sql_init');
|
const sqlInit = require('../services/sql_init.js');
|
||||||
const setupService = require('../services/setup');
|
const setupService = require('../services/setup.js');
|
||||||
const utils = require('../services/utils');
|
const utils = require('../services/utils.js');
|
||||||
const assetPath = require("../services/asset_path");
|
const assetPath = require('../services/asset_path.js');
|
||||||
const appPath = require("../services/app_path");
|
const appPath = require('../services/app_path.js');
|
||||||
|
|
||||||
function setupPage(req, res) {
|
function setupPage(req, res) {
|
||||||
if (sqlInit.isDbInitialized()) {
|
if (sqlInit.isDbInitialized()) {
|
||||||
if (utils.isElectron()) {
|
if (utils.isElectron()) {
|
||||||
const windowService = require('../services/window');
|
const windowService = require('../services/window.js');
|
||||||
const {app} = require('electron');
|
const {app} = require('electron');
|
||||||
windowService.createMainWindow(app);
|
windowService.createMainWindow(app);
|
||||||
windowService.closeSetupWindow();
|
windowService.closeSetupWindow();
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
const BUILTIN_ATTRIBUTES = require("./builtin_attributes");
|
const BUILTIN_ATTRIBUTES = require('./builtin_attributes.js');
|
||||||
const fs = require("fs-extra");
|
const fs = require("fs-extra");
|
||||||
const dataDir = require("./data_dir");
|
const dataDir = require('./data_dir.js');
|
||||||
const dateUtils = require("./date_utils");
|
const dateUtils = require('./date_utils.js');
|
||||||
const Database = require("better-sqlite3");
|
const Database = require("better-sqlite3");
|
||||||
const sql = require("./sql");
|
const sql = require('./sql.js');
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
function getFullAnonymizationScript() {
|
function getFullAnonymizationScript() {
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const {ELECTRON_APP_ROOT_DIR} = require("./resource_dir");
|
const {ELECTRON_APP_ROOT_DIR} = require('./resource_dir.js');
|
||||||
const log = require("./log");
|
const log = require('./log.js');
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const config = require('./config');
|
const config = require('./config.js');
|
||||||
const utils = require('./utils');
|
const utils = require('./utils.js');
|
||||||
|
|
||||||
const template = `[Desktop Entry]
|
const template = `[Desktop Entry]
|
||||||
Type=Application
|
Type=Application
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const build = require('./build');
|
const build = require('./build.js');
|
||||||
const packageJson = require('../../package');
|
const packageJson = require('../../package.json');
|
||||||
const {TRILIUM_DATA_DIR} = require('./data_dir');
|
const {TRILIUM_DATA_DIR} = require('./data_dir.js');
|
||||||
|
|
||||||
const APP_DB_VERSION = 227;
|
const APP_DB_VERSION = 227;
|
||||||
const SYNC_VERSION = 31;
|
const SYNC_VERSION = 31;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const assetPath = require("./asset_path");
|
const assetPath = require('./asset_path.js');
|
||||||
const env = require("./env");
|
const env = require('./env.js');
|
||||||
|
|
||||||
module.exports = env.isDev()
|
module.exports = env.isDev()
|
||||||
? assetPath + "/app"
|
? assetPath + "/app"
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const searchService = require('./search/services/search');
|
const searchService = require('./search/services/search.js');
|
||||||
const sql = require('./sql');
|
const sql = require('./sql.js');
|
||||||
const becca = require('../becca/becca');
|
const becca = require('../becca/becca.js');
|
||||||
const BAttribute = require('../becca/entities/battribute');
|
const BAttribute = require('../becca/entities/battribute.js');
|
||||||
const {formatAttrForSearch} = require("./attribute_formatter");
|
const {formatAttrForSearch} = require('./attribute_formatter.js');
|
||||||
const BUILTIN_ATTRIBUTES = require("./builtin_attributes");
|
const BUILTIN_ATTRIBUTES = require('./builtin_attributes.js');
|
||||||
|
|
||||||
const ATTRIBUTE_TYPES = ['label', 'relation'];
|
const ATTRIBUTE_TYPES = ['label', 'relation'];
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const etapiTokenService = require("./etapi_tokens");
|
const etapiTokenService = require('./etapi_tokens.js');
|
||||||
const log = require('./log');
|
const log = require('./log.js');
|
||||||
const sqlInit = require('./sql_init');
|
const sqlInit = require('./sql_init.js');
|
||||||
const utils = require('./utils');
|
const utils = require('./utils.js');
|
||||||
const passwordEncryptionService = require('./encryption/password_encryption');
|
const passwordEncryptionService = require('./encryption/password_encryption.js');
|
||||||
const config = require('./config');
|
const config = require('./config.js');
|
||||||
const passwordService = require("./encryption/password");
|
const passwordService = require('./encryption/password.js');
|
||||||
|
|
||||||
const noAuthentication = config.General && config.General.noAuthentication === true;
|
const noAuthentication = config.General && config.General.noAuthentication === true;
|
||||||
|
|
||||||
|
@ -1,27 +1,27 @@
|
|||||||
const log = require('./log');
|
const log = require('./log.js');
|
||||||
const noteService = require('./notes');
|
const noteService = require('./notes.js');
|
||||||
const sql = require('./sql');
|
const sql = require('./sql.js');
|
||||||
const utils = require('./utils');
|
const utils = require('./utils.js');
|
||||||
const attributeService = require('./attributes');
|
const attributeService = require('./attributes.js');
|
||||||
const dateNoteService = require('./date_notes');
|
const dateNoteService = require('./date_notes.js');
|
||||||
const treeService = require('./tree');
|
const treeService = require('./tree.js');
|
||||||
const config = require('./config');
|
const config = require('./config.js');
|
||||||
const axios = require('axios');
|
const axios = require('axios');
|
||||||
const dayjs = require('dayjs');
|
const dayjs = require('dayjs');
|
||||||
const xml2js = require('xml2js');
|
const xml2js = require('xml2js');
|
||||||
const cloningService = require('./cloning');
|
const cloningService = require('./cloning.js');
|
||||||
const appInfo = require('./app_info');
|
const appInfo = require('./app_info.js');
|
||||||
const searchService = require('./search/services/search');
|
const searchService = require('./search/services/search.js');
|
||||||
const SearchContext = require("./search/search_context");
|
const SearchContext = require('./search/search_context.js');
|
||||||
const becca = require("../becca/becca");
|
const becca = require('../becca/becca.js');
|
||||||
const ws = require("./ws");
|
const ws = require('./ws.js');
|
||||||
const SpacedUpdate = require("./spaced_update");
|
const SpacedUpdate = require('./spaced_update.js');
|
||||||
const specialNotesService = require("./special_notes");
|
const specialNotesService = require('./special_notes.js');
|
||||||
const branchService = require("./branches");
|
const branchService = require('./branches.js');
|
||||||
const exportService = require("./export/zip");
|
const exportService = require('./export/zip.js');
|
||||||
const syncMutex = require("./sync_mutex");
|
const syncMutex = require('./sync_mutex.js');
|
||||||
const backupService = require("./backup");
|
const backupService = require('./backup.js');
|
||||||
const optionsService = require("./options");
|
const optionsService = require('./options.js');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const dateUtils = require('./date_utils');
|
const dateUtils = require('./date_utils.js');
|
||||||
const optionService = require('./options');
|
const optionService = require('./options.js');
|
||||||
const fs = require('fs-extra');
|
const fs = require('fs-extra');
|
||||||
const dataDir = require('./data_dir');
|
const dataDir = require('./data_dir.js');
|
||||||
const log = require('./log');
|
const log = require('./log.js');
|
||||||
const syncMutexService = require('./sync_mutex');
|
const syncMutexService = require('./sync_mutex.js');
|
||||||
const cls = require('./cls');
|
const cls = require('./cls.js');
|
||||||
const sql = require('./sql');
|
const sql = require('./sql.js');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
function getExistingBackups() {
|
function getExistingBackups() {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user