Skip to content

Commit 74069d2

Browse files
committed
overlay: add proxy debug routing and bump v0.1.8
1 parent e55d3b8 commit 74069d2

File tree

4 files changed

+36
-16
lines changed

4 files changed

+36
-16
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.7
5-
WEB_LIBRARY_IMAGE=ghcr.io/joonsoome/on-prem-zotero-webui/web-library:v0.1.7
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
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.7
5-
WEB_LIBRARY_IMAGE=ghcr.io/joonsoome/on-prem-zotero-webui/web-library:v0.1.7
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
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.7) is still fully not properly works, please keep on watching to be ready for production.
6+
It(v0.1.8) 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/attachments.js

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,17 @@ const tryGetAttachmentURL = attachmentItemKey => {
3232
return async (dispatch, getState) => {
3333
const state = getState();
3434
const item = get(state, ['libraries', state.current.libraryKey, 'items', attachmentItemKey], null);
35+
const proxyBase = state.config?.pdfProxyBaseUrl;
3536

3637
// If a proxy base URL is configured, bypass Storage/enclosure links and use the proxy.
37-
if (state.config?.pdfProxyBaseUrl) {
38+
if (proxyBase) {
39+
// Debug: trace when proxy URL is requested.
40+
console.log('[proxy-debug] tryGetAttachmentURL using proxy', {
41+
attachmentItemKey,
42+
linkMode: item?.linkMode,
43+
contentType: item?.contentType,
44+
proxyBase,
45+
});
3846
return dispatch(getAttachmentUrl(attachmentItemKey));
3947
}
4048

@@ -111,17 +119,29 @@ const pickBestItemAction = itemKey => {
111119
const pickBestAttachmentItemAction = attachmentItemKey => {
112120
return async (dispatch, getState) => {
113121
const state = getState();
114-
const current = state.current;
115-
const item = get(state, ['libraries', state.current.libraryKey, 'items', attachmentItemKey], null);
116-
117-
const isFile = item && item.linkMode && item.linkMode.startsWith('imported') && item[Symbol.for('links')].enclosure;
118-
const isLink = item && item.linkMode && item.linkMode === 'linked_url';
122+
const current = state.current;
123+
const item = get(state, ['libraries', state.current.libraryKey, 'items', attachmentItemKey], null);
124+
const proxyBase = state.config?.pdfProxyBaseUrl;
125+
126+
const isFile = item && item.linkMode && item.linkMode.startsWith('imported') && item[Symbol.for('links')].enclosure;
127+
const isLink = item && item.linkMode && item.linkMode === 'linked_url';
128+
129+
if (isFile) {
130+
if (Object.keys(READER_CONTENT_TYPES).includes(item.contentType)) {
131+
// If proxy is available, prefer proxy URL to force PDF fetch even when reader path is used.
132+
if (proxyBase) {
133+
console.log('[proxy-debug] pickBestAttachmentItemAction -> proxy open', {
134+
attachmentItemKey,
135+
linkMode: item.linkMode,
136+
contentType: item.contentType,
137+
proxyBase,
138+
});
139+
return openDelayedURL(dispatch(getAttachmentUrl(attachmentItemKey)));
140+
}
119141

120-
if (isFile) {
121-
if (Object.keys(READER_CONTENT_TYPES).includes(item.contentType)) {
122-
const readerPath = makePath(state.config, {
123-
attachmentKey: null,
124-
collection: current.collectionKey,
142+
const readerPath = makePath(state.config, {
143+
attachmentKey: null,
144+
collection: current.collectionKey,
125145
items: [attachmentItemKey],
126146
library: current.libraryKey,
127147
noteKey: null,

0 commit comments

Comments
 (0)