Files
multica/apps/mobile/package.json
Multica Eve ae27058b0a fix(attachments): unified download endpoint with mode + presign + proxy (MUL-2976) (#3747)
Fix attachment download for self-hosted deployments using private S3-compatible buckets without CloudFront. Closes #3721.

**Server**

- New unified `GET /api/attachments/{id}/download` endpoint that picks CloudFront / S3 presign / server proxy at request time.
- `ATTACHMENT_DOWNLOAD_MODE=auto|cloudfront|presign|proxy` and `ATTACHMENT_DOWNLOAD_URL_TTL` env knobs; `auto` routes Docker hostnames / localhost / private IPs through the proxy and public S3 endpoints through presign.
- `Storage.PresignGet` capability; S3 implementation generates presigned GET URLs.
- `attachmentToResponse` returns the unified relative endpoint instead of leaking raw unsigned S3 URLs when CloudFront is not configured. Proxy path streams via `io.Copy` with `Content-Disposition` / `Content-Length` / `Cache-Control: no-store` / `X-Content-Type-Options: nosniff`.

**Clients**

- CLI / Desktop / Mobile resolve relative `download_url` values against the configured API base. Desktop covers the Electron native download bridge and the media preview modal; Mobile covers `Linking.openURL`, the markdown image RN loader, and the composer's completed non-image file chip.
- Mobile gains a minimal Node-environment vitest lane wired into `mobile-verify.yml`.

**Docs**

- `.env.example`, `docker-compose.selfhost.yml`, `SELF_HOSTING_ADVANCED.md`, and the `environment-variables` doc set updated with the new env keys and the `ATTACHMENT_DOWNLOAD_MODE=proxy` recommendation for Docker / VPC-internal object stores.

**Tests**

- `internal/storage`, `internal/cli`, `internal/handler` (download endpoint, mode selection, proxy header, `/content` non-regression), `cmd/server` (trusted proxy parser).
- `packages/views/editor/use-download-attachment.test.tsx` and `attachment-preview-modal.test.tsx` exercise relative URL resolution + absolute pass-through.
- `apps/mobile/lib/attachment-url.test.ts` covers every helper branch plus the composer non-image chip case.
2026-06-04 14:52:57 +08:00

94 lines
3.5 KiB
JSON

{
"name": "@multica/mobile",
"version": "0.1.0",
"private": true,
"main": "expo-router/entry",
"scripts": {
"dev": "expo start",
"dev:staging": "dotenv -e .env.staging -- cross-env APP_ENV=staging expo start",
"dev:prod": "dotenv -e .env.production -- cross-env APP_ENV=production expo start",
"ios": "expo run:ios",
"ios:staging": "dotenv -e .env.staging -- cross-env APP_ENV=staging expo run:ios",
"ios:prod": "dotenv -e .env.production -- cross-env APP_ENV=production expo run:ios",
"ios:device": "expo run:ios --device",
"ios:device:staging": "dotenv -e .env.staging -- cross-env APP_ENV=staging expo run:ios --device",
"ios:device:staging:release": "dotenv -e .env.staging -- cross-env APP_ENV=staging expo run:ios --device --configuration Release",
"ios:device:prod": "dotenv -e .env.production -- cross-env APP_ENV=production expo run:ios --device",
"ios:device:prod:release": "dotenv -e .env.production -- cross-env APP_ENV=production expo run:ios --device --configuration Release",
"lint": "expo lint",
"typecheck": "tsc --noEmit",
"test": "vitest run"
},
"dependencies": {
"@expo/vector-icons": "^14.1.0",
"@multica/core": "workspace:*",
"@react-native-community/datetimepicker": "8.6.0",
"@react-native-community/netinfo": "11.5.2",
"@react-native-segmented-control/segmented-control": "2.5.7",
"@react-navigation/elements": "^2.9.17",
"@react-navigation/native": "^7.1.6",
"@rn-primitives/avatar": "^1.4.0",
"@rn-primitives/collapsible": "^1.4.0",
"@rn-primitives/dropdown-menu": "^1.4.0",
"@rn-primitives/portal": "^1.4.0",
"@rn-primitives/radio-group": "^1.4.0",
"@rn-primitives/separator": "^1.4.0",
"@rn-primitives/slot": "^1.4.0",
"@rn-primitives/switch": "^1.4.0",
"@rn-primitives/tabs": "^1.4.0",
"@shikijs/core": "^4.0.2",
"@shikijs/langs": "^4.0.2",
"@shikijs/themes": "^4.0.2",
"@shopify/flash-list": "2.0.2",
"@tanstack/react-query": "^5.96.2",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"expo": "~55.0.23",
"expo-build-properties": "~55.0.13",
"expo-clipboard": "~55.0.13",
"expo-constants": "~55.0.16",
"expo-dev-client": "^55.0.32",
"expo-document-picker": "~55.0.13",
"expo-haptics": "~55.0.14",
"expo-image": "^55.0.10",
"expo-image-picker": "~55.0.20",
"expo-linking": "~55.0.0",
"expo-router": "~55.0.14",
"expo-secure-store": "~55.0.13",
"expo-status-bar": "~55.0.0",
"expo-system-ui": "~55.0.0",
"input-otp-native": "^0.5.0",
"marked": "^18.0.3",
"nativewind": "^4.1.23",
"react": "19.2.0",
"react-dom": "19.2.0",
"react-native": "0.83.6",
"react-native-enriched-markdown": "^0.5.0",
"react-native-gesture-handler": "~2.30.1",
"react-native-image-viewing": "^0.2.2",
"react-native-keyboard-controller": "1.20.7",
"react-native-reanimated": "~4.2.1",
"react-native-safe-area-context": "~5.6.0",
"react-native-screens": "~4.23.0",
"react-native-shiki-engine": "^0.3.10",
"react-native-svg": "15.15.3",
"react-native-web": "~0.21.0",
"react-native-worklets": "0.7.4",
"rn-emoji-keyboard": "^1.7.0",
"tailwind-merge": "^2.5.4",
"tailwindcss": "^3.4.17",
"tailwindcss-animate": "^1.0.7",
"zod": "^4.1.5",
"zustand": "^5.0.0"
},
"devDependencies": {
"@babel/core": "^7.25.0",
"@types/react": "~19.0.0",
"cross-env": "^7.0.3",
"dotenv-cli": "^7.4.4",
"eslint-config-expo": "~55.0.0",
"typescript": "~5.9.0",
"vitest": "catalog:"
}
}