Fix cross-origin staging URLs, e621 UA format and IQDB queue stalls

The dev Vite proxy rewrites the request Host to 127.0.0.1:8000, so the
backend's absolute signed file URLs pointed at a different origin than the
SPA (localhost:5173). Images tolerated it, but the auth'd fetch that reads
the staging blob for IQDB was blocked ('Cross-Origin Request Blocked') and
every similarity check died before reaching e621.

apiUrl() now keeps API-built absolute URLs on the page's origin whenever the
SPA is in same-origin mode (dev proxy, deploy nginx) and leaves them
absolute when an explicit backend URL is configured. All consumers use it:
staging previews and the bulk modal, library cards, optimizer (range sniff +
worker), IQDB card, delete page, similar page.

e621 identification now follows the documented 'App/version (developer)'
form: server-side requests send 'J621/<hash> (JakeBreath)' and the browser
_client gets the same string, with the hash baked into the frontend image
(GIT_HASH build arg; guarded at runtime so the dev server still works).

IQDB stalls: requests now time out after 20s (a hung fetch used to block the
serialized e621 queue forever), and all checks run through one serial drain
so repeated 'Check similarity' clicks can no longer start overlapping runs
that re-download the same staging blobs. Auth/rate-limit/timeout/network
failures stop the queue with the reason and a retry button instead of
grinding through the rest.

Verified live: staged file URL is same-origin through the proxy and fetches
200 through it.
This commit is contained in:
2026-09-19 00:30:42 -05:00
parent 2f613b7027
commit b96c311235
14 changed files with 184 additions and 62 deletions
+2
View File
@@ -10,6 +10,8 @@
# syntax=docker/dockerfile:1
FROM node:22-alpine AS build
ARG GIT_HASH=dev
ENV GIT_HASH=$GIT_HASH
WORKDIR /app
COPY frontend/package.json frontend/package-lock.json ./
RUN npm ci --no-audit --no-fund
+1
View File
@@ -26,6 +26,7 @@ fi
echo "==> Building + pushing $PLATFORMS -> $REGISTRY:{latest,$SHA} ..."
docker buildx build --builder "$BUILDER" --push \
--platform "$PLATFORMS" \
--build-arg "GIT_HASH=$SHA" \
-f deploy/J621-Frontend \
-t "$REGISTRY:latest" \
-t "$REGISTRY:$SHA" \