Commit graph

2 commits

Author SHA1 Message Date
Trevin Chow
a2ddf47650 refactor(anon-chat): route upload through anonymousChatApiService
Fixes #1245. Deduplicate the anonymous-chat file upload request, which
was inlined verbatim in DocumentsSidebar.tsx and free-composer.tsx
while anonymousChatApiService.uploadDocument already existed.

Key change: service now returns a discriminated result instead of
throwing on 409. Callers need to distinguish 409 (quota exceeded, ->
gate to login) from other non-OK responses (real errors, -> throw).

  export type AnonUploadResult =
    | { ok: true; data: { filename: string; size_bytes: number } }
    | { ok: false; reason: "quota_exceeded" };

Both call sites now do:

  const result = await anonymousChatApiService.uploadDocument(file);
  if (!result.ok) {
    if (result.reason === "quota_exceeded") gate("upload more documents");
    return;
  }
  const data = result.data;

Dropped the BACKEND_URL import in both files (no longer used). Verified
zero remaining /api/v1/public/anon-chat/upload references in
surfsense_web/.
2026-04-23 03:26:42 -07:00
DESKTOP-RTLN3BA\$punk
ff4e0f9b62 feat: no login experience and prem tokens
Some checks are pending
Build and Push Docker Images / tag_release (push) Waiting to run
Build and Push Docker Images / build (./surfsense_backend, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_backend, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_web, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-24.04-arm, linux/arm64, arm64) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_web, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-latest, linux/amd64, amd64) (push) Blocked by required conditions
Build and Push Docker Images / create_manifest (backend, surfsense-backend) (push) Blocked by required conditions
Build and Push Docker Images / create_manifest (web, surfsense-web) (push) Blocked by required conditions
2026-04-15 17:02:00 -07:00