Skip to content

Commit f7d0877

Browse files
committed
overlay: force proxy opens with debug logging; bump v0.1.9
1 parent 74069d2 commit f7d0877

File tree

5 files changed

+44
-8
lines changed

5 files changed

+44
-8
lines changed

.env.portainer.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Portainer stack environment (example values). Copy to `.env.portainer` for Portainer UI deployment.
22

33
# GHCR images to deploy (choose tags built by CI) — default to a pinned release tag
4-
PDF_PROXY_IMAGE=ghcr.io/joonsoome/on-prem-zotero-webui/pdf-proxy:v0.1.8
5-
WEB_LIBRARY_IMAGE=ghcr.io/joonsoome/on-prem-zotero-webui/web-library:v0.1.8
4+
PDF_PROXY_IMAGE=ghcr.io/joonsoome/on-prem-zotero-webui/pdf-proxy:v0.1.9
5+
WEB_LIBRARY_IMAGE=ghcr.io/joonsoome/on-prem-zotero-webui/web-library:v0.1.9
66

77
# Host path for Zotero WebDAV data mounted into the proxy container
88
ZOTERO_ROOT_HOST_PATH=/volume1/Reference/zotero

.env.stage.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Staging/NAS environment configuration (example values). Copy to `.env.stage` on the staging host.
22

33
# GHCR images to deploy (choose tags built by CI) — default to a pinned release tag
4-
PDF_PROXY_IMAGE=ghcr.io/joonsoome/on-prem-zotero-webui/pdf-proxy:v0.1.8
5-
WEB_LIBRARY_IMAGE=ghcr.io/joonsoome/on-prem-zotero-webui/web-library:v0.1.8
4+
PDF_PROXY_IMAGE=ghcr.io/joonsoome/on-prem-zotero-webui/pdf-proxy:v0.1.9
5+
WEB_LIBRARY_IMAGE=ghcr.io/joonsoome/on-prem-zotero-webui/web-library:v0.1.9
66

77
# Host path for Zotero WebDAV data mounted into the proxy container
88
ZOTERO_ROOT_HOST_PATH=/volume1/Reference/zotero

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
**Self-hosted Zotero WebUI Opensource Library + WebDAV-based PDF viewer **Avoid storage fees, keep privacy, and still enjoy a full browser-based Zotero library.
44

55
## It is PoC
6-
It(v0.1.8) is still fully not properly works, please keep on watching to be ready for production.
6+
It(v0.1.9) is still fully not properly works, please keep on watching to be ready for production.
77

88
---
99

app/web-library-overlay/src/js/actions/items-read.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,13 @@ const getAttachmentUrl = (itemKey, forceFresh = false) => {
248248
const base = pdfProxyBaseUrl.replace(/\/$/, '');
249249
const url = `${base}/${itemKey}`;
250250

251+
console.log('[proxy-debug] getAttachmentUrl', {
252+
itemKey,
253+
pdfProxyBaseUrl,
254+
libraryKey,
255+
forceFresh,
256+
});
257+
251258
dispatch({
252259
type: RECEIVE_ATTACHMENT_URL,
253260
libraryKey,

app/web-library-overlay/src/js/component/item-details/attachments.jsx

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ const AttachmentActions = memo(props => {
8282
const canReparent = !isReadOnly && !isTrash && !isMyPublications;
8383
const isReaderCompatible = Object.keys(READER_CONTENT_TYPES).includes(attachment.contentType);
8484
const isPDF = attachment.contentType === 'application/pdf';
85+
const proxyHref = pdfProxyBaseUrl ? `${pdfProxyBaseUrl.replace(/\/$/, '')}/${itemKey}` : null;
8586
const canDownload = (
86-
(pdfProxyBaseUrl && isPDF) ||
87+
(proxyHref && isPDF) ||
8788
(attachment.linkMode.startsWith('imported') && attachment[Symbol.for('links')].enclosure)
8889
) && !isUploading;
8990

@@ -110,8 +111,15 @@ const AttachmentActions = memo(props => {
110111
return;
111112
}
112113

114+
console.log('[proxy-debug] toolbar click', { key, proxyHref, isPDF, urlIsFresh, isFetchingUrl });
115+
// If proxy URL is available, let the browser open it directly to ensure network request fires.
116+
if (proxyHref) {
117+
window.open(proxyHref, '_blank');
118+
return;
119+
}
120+
113121
openDelayedURL(dispatch(tryGetAttachmentURL(key)));
114-
}, [dispatch, isFetchingUrl]);
122+
}, [dispatch, isFetchingUrl, proxyHref, isPDF, urlIsFresh]);
115123

116124
const handleExportClick = useCallback(ev => {
117125
ev.stopPropagation();
@@ -151,7 +159,7 @@ const AttachmentActions = memo(props => {
151159
{isReaderCompatibleBrowser() && isReaderCompatible && (
152160
<a
153161
className="btn btn-icon"
154-
href={openInReaderPath}
162+
href={proxyHref || openInReaderPath}
155163
onClick={stopPropagation}
156164
rel="noreferrer"
157165
role="button"
@@ -204,6 +212,8 @@ const AttachmentActions = memo(props => {
204212
) : (
205213
<a
206214
className="btn btn-icon"
215+
href={proxyHref || undefined}
216+
target={proxyHref ? "_blank" : undefined}
207217
onClick={handleClick}
208218
role="button"
209219
tabIndex={-3}
@@ -348,6 +358,24 @@ const Attachment = memo(props => {
348358

349359
dragRef(ref);
350360

361+
const proxyHref = pdfProxyBaseUrl ? `${pdfProxyBaseUrl.replace(/\/$/, '')}/${attachment.key}` : null;
362+
363+
const handleDoubleClick = useCallback(ev => {
364+
ev.stopPropagation();
365+
ev.preventDefault();
366+
console.log('[proxy-debug] row double-click', {
367+
key: attachment.key,
368+
proxyHref,
369+
linkMode: attachment.linkMode,
370+
contentType: attachment.contentType,
371+
});
372+
if (proxyHref) {
373+
window.open(proxyHref, '_blank');
374+
return;
375+
}
376+
openDelayedURL(dispatch(tryGetAttachmentURL(attachment.key)));
377+
}, [attachment.key, attachment.linkMode, attachment.contentType, proxyHref, dispatch]);
378+
351379
return (
352380
<li
353381
aria-labelledby={id.current}
@@ -356,6 +384,7 @@ const Attachment = memo(props => {
356384
data-key={attachment.key}
357385
onBlur={handleBlur}
358386
onClick={handleAttachmentSelect}
387+
onDoubleClick={handleDoubleClick}
359388
onFocus={handleFocus}
360389
onKeyDown={handleKeyDown}
361390
tabIndex={-2}

0 commit comments

Comments
 (0)