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