Jasper Van d974ced139 feat(shares): authenticated CRUD API + notification dispatch (v2.3.0 T3) (#311)
* feat(shares): authenticated CRUD API + notification dispatch (T3)

- POST/GET/GET-by-id/DELETE /api/shares endpoints with requireAuth + requireTeamRole('editor') on create
- Shares list returns matter: {name, type, dirtype} and recipientCount per item
- Creator-only access on GET/:id (404 for non-creator) and DELETE (403 for non-creator)
- share-notification service: in-app notification always sent to recipientUserId; email sent conditionally if isEmailConfigured; email failures are caught and logged, never block the 201 response
- createShareRequestSchema added to shared/schemas/share.ts for HTTP boundary validation
- ShareListItem, ShareDetail, ShareMatter types added to shared/types/index.ts; timestamps use string to match JSON wire format
- sharesApi RPC client added to src/lib/rpc.ts; listShares/getShare/deleteShare helpers added to src/lib/api.ts
- Removed dead listSharesByCreator (superseded by listSharesForApi)
- 44 new integration tests; 2026 tests total pass

Agent-Profile: https://agent-kanban.dev/agents/a6bb038c4226a87f

* test(shares): add api.ts wrapper tests + DIRECT_NO_RECIPIENTS coverage

- listShares, getShare, deleteShare unit tests in src/lib/api.test.ts
- DIRECT_NO_RECIPIENTS test case in shares.integration.test.ts
- Closes codecov/patch gap (was 87%, target ~94%)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(shares): cover throw-err and dispatch-catch paths in shares route

- Add test for unknown createShare error (line 69: `throw err`)
- Add test for dispatchShareCreated rejection (line 79: `.catch()` console.error)
- shares.ts now at 100% line coverage in integration project

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test: cover src/lib/api.ts share wrappers in integration project

Add src/lib/api.integration.test.ts with 7 tests for listShares,
getShare, and deleteShare, and extend the vitest integration project
to pick up src/**/*.integration.test.ts so codecov patch coverage
for src/lib/api.ts is reported correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test: add branch coverage for shares save handler edge cases

Cover two previously uncovered branches in POST /:token/save:
- Line 158: non-recipient with valid sharetk cookie bypasses 401 check
- Line 166: viewer-role member of target org gets 403 (via real DB
  membership insert using sign-up response user ID)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Bob <aibob@mails.agent-kanban.dev>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-20 08:46:55 -04:00
2026-04-14 23:44:12 -04:00
2020-10-13 01:50:40 +08:00

ZPan

The open-source, S3-native file hosting platform.

CI codecov Release GitHub Release Docker Image License

Image bed, file sharing, and backup — powered by S3, deployed anywhere.

What is ZPan?

ZPan is a lightweight file hosting platform built on top of S3-compatible storage. Files upload directly from the client to S3, bypassing server bandwidth entirely.

Three scenarios, one platform:

  • Image Bed — Upload via PicGo / ShareX / API, get a URL instantly
  • File Sharing — Upload files, generate share links, distribute to anyone
  • File Backup — CLI agent syncs local directories to S3/R2

Deploy

One-click deploy with zero server management. Free tier covers personal use.

Deploy to Cloudflare

Docker

docker compose up -d

Documentation

Why ZPan?

  • Zero bandwidth bottleneck — files transfer directly between client and S3
  • Zero ops option — deploy to Cloudflare Workers for free, no server needed
  • Self-host friendly — Docker deployment with any S3-compatible storage
  • Tool ecosystem — works with PicGo, ShareX, Flameshot out of the box
  • Open source — free forever for self-hosted users

v1

Looking for ZPan v1 (Go version)? See the v1 branch.

Contributing

See CONTRIBUTING.md for details.

Thank you to all the people who contributed to ZPan!

License

ZPan is under the GPL 3.0 license. See the LICENSE file for details.

S
Description
A self-hosted cloud disk base on the cloud storage./ 一个基于云存储的网盘系统,用于自建私人网盘或企业网盘。
Readme AGPL-3.0 71 MiB
Languages
TypeScript 92.7%
Go 6.5%
JavaScript 0.5%
CSS 0.1%