Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(ocr): allow manual processing of OCR
Elian Dorand8ea0c7bcf1b
diff --git a/apps/server/src/routes/api/ocr.ts b/apps/server/src/routes/api/ocr.tsindex 1efe2a93e0..6b94322ad6 100644--- a/apps/server/src/routes/api/ocr.ts+++ b/apps/server/src/routes/api/ocr.ts@@ -49,10 +49,6 @@ async function processNoteOCR(req: Request<{ noteId: string }>) {const { noteId } = req.params;const { language = 'eng', forceReprocess = false } = req.body || {};- if (!ocrService.isOCREnabled()) {- return [400, { success: false, message: 'OCR is not enabled in settings' }];- }-const note = becca.getNote(noteId);if (!note) {return [404, { success: false, message: 'Note not found' }];@@ -111,10 +107,6 @@ async function processAttachmentOCR(req: Request<{ attachmentId: string }>) {const { attachmentId } = req.params;const { language = 'eng', forceReprocess = false } = req.body || {};- if (!ocrService.isOCREnabled()) {- return [400, { success: false, message: 'OCR is not enabled in settings' }];- }-const attachment = becca.getAttachment(attachmentId);if (!attachment) {return [404, { success: false, message: 'Attachment not found' }];diff --git a/apps/server/src/services/ocr/ocr_service.ts b/apps/server/src/services/ocr/ocr_service.tsindex 47d1b88140..9eefe5dca4 100644--- a/apps/server/src/services/ocr/ocr_service.ts+++ b/apps/server/src/services/ocr/ocr_service.ts@@ -110,11 +110,6 @@ class OCRService {* Process OCR for a note (image type)*/async processNoteOCR(noteId: string, options: OCRProcessingOptions = {}): Promise<OCRResult | null> {- if (!this.isOCREnabled()) {- log.info('OCR is disabled in settings');- return null;- }-const note = becca.getNote(noteId);if (!note) {log.error(`Note ${noteId} not found`);@@ -168,11 +163,6 @@ class OCRService {* Process OCR for an attachment*/async processAttachmentOCR(attachmentId: string, options: OCRProcessingOptions = {}): Promise<OCRResult | null> {- if (!this.isOCREnabled()) {- log.info('OCR is disabled in settings');- return null;- }-const attachment = becca.getAttachment(attachmentId);if (!attachment) {log.error(`Attachment ${attachmentId} not found`);