mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
server-esm: Fix a few more import issues
This commit is contained in:
parent
ad93fe4b75
commit
8ac8f6c2df
@ -10,6 +10,9 @@ import dataDir from "./data_dir.js";
|
||||
import cls from "./cls.js";
|
||||
import fs from "fs-extra";
|
||||
import Database from "better-sqlite3";
|
||||
import ws from "./ws.js";
|
||||
import becca_loader from "../becca/becca_loader.js";
|
||||
import entity_changes from "./entity_changes.js";
|
||||
|
||||
const dbConnection: DatabaseType = new Database(dataDir.DOCUMENT_PATH);
|
||||
dbConnection.pragma('journal_mode = WAL');
|
||||
@ -248,7 +251,7 @@ function transactional<T>(func: (statement: Statement) => T) {
|
||||
const ret = (dbConnection.transaction(func) as any).deferred();
|
||||
|
||||
if (!dbConnection.inTransaction) { // i.e. transaction was really committed (and not just savepoint released)
|
||||
require('./ws').sendTransactionEntityChangesToAllClients();
|
||||
ws.sendTransactionEntityChangesToAllClients();
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -259,11 +262,11 @@ function transactional<T>(func: (statement: Statement) => T) {
|
||||
if (entityChangeIds.length > 0) {
|
||||
log.info("Transaction rollback dirtied the becca, forcing reload.");
|
||||
|
||||
require('../becca/becca_loader').load();
|
||||
becca_loader.load();
|
||||
}
|
||||
|
||||
// the maxEntityChangeId has been incremented during failed transaction, need to recalculate
|
||||
require('./entity_changes').recalculateMaxEntityChangeId();
|
||||
entity_changes.recalculateMaxEntityChangeId();
|
||||
|
||||
throw e;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import becca from "../becca/becca.js";
|
||||
import { EntityChange, EntityChangeRecord, EntityRow } from './entity_changes_interface';
|
||||
import { CookieJar, ExecOpts } from './request_interface';
|
||||
import setupService from "./setup.js";
|
||||
import consistency_checks from "./consistency_checks.js";
|
||||
|
||||
let proxyToggle = true;
|
||||
|
||||
@ -281,8 +282,7 @@ async function checkContentHash(syncContext: SyncContext) {
|
||||
|
||||
if (failedChecks.length > 0) {
|
||||
// before re-queuing sectors, make sure the entity changes are correct
|
||||
const consistencyChecks = require('./consistency_checks');
|
||||
consistencyChecks.runEntityChangesChecks();
|
||||
consistency_checks.runEntityChangesChecks();
|
||||
|
||||
await syncRequest(syncContext, 'POST', `/api/sync/check-entity-changes`);
|
||||
}
|
||||
|
@ -250,8 +250,6 @@ function register(router: Router) {
|
||||
|
||||
addNoIndexHeader(note, res);
|
||||
|
||||
const utils = require('../services/utils');
|
||||
|
||||
const filename = utils.formatDownloadTitle(note.title, note.type, note.mime);
|
||||
|
||||
res.setHeader('Content-Disposition', utils.getContentDisposition(filename));
|
||||
|
Loading…
x
Reference in New Issue
Block a user