feat(admin): issue #146 — photo upload with sharp crop/optimization (restore old behavior)

- POST /api/upload: FormData, 10MB limit, sharp resize 800px inside + webp@80, saves to /app/uploads, returns /uploads/url
- GET /uploads/[...path]: serves files with Content-Type, path traversal protected
- compose: ./uploads mounted in tg_shop_admin
- Dockerfile: /app/uploads created + chown nextjs
- catalog-page: file input + thumbnail preview + remove for photoUrl/hiddenPhotoUrl
- Bot resolvePhotoSource already supports /uploads/ paths — no bot changes
This commit is contained in:
NW
2026-08-10 09:38:31 +01:00
parent 792efc07ce
commit 301763f428
5 changed files with 176 additions and 11 deletions

View File

@@ -54,8 +54,8 @@ COPY --from=builder /app/.next/standalone/.next ./.next
# Copy Prisma schema for potential migrations
COPY --from=builder /app/prisma ./prisma/
# Create db directory
RUN mkdir -p /app/db && chown nextjs:nodejs /app/db
# Create db and uploads directories
RUN mkdir -p /app/db /app/uploads && chown nextjs:nodejs /app/db /app/uploads
# Switch to non-root
USER nextjs