feat: implement authenticated resource handling for image and PDF previews via AuthImage and AuthIframe components
Build and Push Multi-Platform Images / build-and-push (push) Successful in 17s

This commit is contained in:
2026-05-10 22:30:27 +02:00
parent 1ed3afd2e2
commit 76ce4cf900
5 changed files with 129 additions and 23 deletions
@@ -9,6 +9,7 @@ import type { Client } from '../api/inbox';
import { paperlessApi } from '../api/paperless';
import type { PaperlessDocType, PaperlessCorrespondent } from '../api/paperless';
import { getEnv } from '../utils/env';
import { AuthIframe, openAuthUrl } from '../utils/auth-resource';
import DocumentSearchModal from './DocumentSearchModal';
const { Option } = Select;
@@ -468,7 +469,7 @@ export default function DocumentEditModal({ documentId, document, open, onClose,
icon={<EyeOutlined />}
onClick={(e) => {
e.stopPropagation();
window.open(`${getEnv('VITE_API_URL')}/api/paperless/inbox/pdf/${currentId}`, '_blank');
openAuthUrl(`${getEnv('VITE_API_URL')}/api/paperless/inbox/pdf/${currentId}`);
}}
/>
)}
@@ -508,9 +509,9 @@ export default function DocumentEditModal({ documentId, document, open, onClose,
</Form>
</Col>
<Col span={14} style={{ height: '100%' }}>
<iframe
src={`${getEnv('VITE_API_URL')}/api/paperless/inbox/pdf/${documentId}#toolbar=0`}
style={{ width: '100%', height: '100%', border: 'none' }}
<AuthIframe
src={`${getEnv('VITE_API_URL')}/api/paperless/inbox/pdf/${documentId}#toolbar=0`}
style={{ width: '100%', height: '100%' }}
title="PDF Preview"
/>
</Col>