diff --git a/.gitignore b/.gitignore index e9eead8..cb26f54 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,6 @@ -# Build output & generated directories +# Build output /build/ /out/ -/corpus/ -/docs/ **/build/ **/cmake-build-*/ CMakeUserPresets.json diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 9148670..4af7c75 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -52,20 +52,14 @@ function App() { const canRedo = hist.index < hist.stack.length - 1; const preservePageRef = useRef(false); - const [isOcrDisabled, setIsOcrDisabled] = useState(false); const permissions = activeDoc?.permissions ?? null; const can = (flag: keyof PDFPermissions) => !permissions || permissions[flag] !== false; const denyToast = (_label: string) => { }; const disabledTools = new Set(); - disabledTools.add('ocr'); // OCR & Edit button is permanently disabled - if (!activeDoc) { - (['highlight', 'underline', 'strikeout', 'squiggly', 'draw', 'comment', 'textbox', 'edit_text', 'stream_edit', 'signature', 'stamp', 'watermark', 'redact'] as ToolId[]).forEach((t) => disabledTools.add(t)); - } else { - if (!can('canAnnotate')) - (['highlight', 'underline', 'strikeout', 'squiggly', 'draw', 'comment', 'textbox', 'stamp', 'signature'] as ToolId[]).forEach((t) => disabledTools.add(t)); - if (!can('canModify')) - (['edit_text', 'stream_edit', 'redact'] as ToolId[]).forEach((t) => disabledTools.add(t)); - } + disabledTools.add('ocr'); + if (!can('canAnnotate')) + (['highlight', 'underline', 'strikeout', 'squiggly', 'draw', 'comment', 'textbox', 'stamp', 'signature'] as ToolId[]).forEach((t) => disabledTools.add(t)); + if (!can('canModify')) (['edit_text', 'redact'] as ToolId[]).forEach((t) => disabledTools.add(t)); const disabledToolsRef = useRef(disabledTools); disabledToolsRef.current = disabledTools; @@ -160,11 +154,7 @@ function App() { await gatewayService.performPageOCR(activeDoc.id, currentPage); viewerRef.current?.refreshPageLayout(currentPage); } catch (err: any) { - const errMsg = err.message || String(err); - alert(`OCR processing failed: ${errMsg}`); - if (errMsg.toLowerCase().includes('not installed') || errMsg.toLowerCase().includes('not available')) { - setIsOcrDisabled(true); - } + alert(`OCR processing failed: ${err.message || err}`); } finally { setIsOCRLoading(false); } diff --git a/frontend/src/lib/gatewayService.ts b/frontend/src/lib/gatewayService.ts index 5642e0b..9bc86fa 100644 --- a/frontend/src/lib/gatewayService.ts +++ b/frontend/src/lib/gatewayService.ts @@ -727,9 +727,7 @@ class GatewayService { method: 'POST', }); if (!response.ok) { - const errJson = await response.json().catch(() => null); - const detail = errJson?.detail || response.statusText; - throw new Error(detail); + throw new Error(`OCR failed: ${response.statusText}`); } return response.json(); }