feat: add public share page with download support (#253)
Share links now point to /s/{token} (was /api/s/{token}) and render a
proper HTML page instead of raw JSON.
Changes:
- static/share.html: standalone public share page
- static/css/views/share-public.css: share page styles
- static/js/views/public/publicShare.js: client-side logic that fetches
share metadata via /api/s/{token}, handles password-protected shares,
and renders file download / folder info
- build.rs: include share.html in the HTML embed pipeline
- web/mod.rs: serve /s/{token} route (unauthenticated)
- share_dto.rs: generate URLs as /s/{token} instead of /api/s/{token}
- share_handler.rs: new download_shared_file() handler that validates the
share token and streams file content without requiring authentication
- routes.rs: mount GET /api/s/{token}/download (public, uses AppState)
This commit is contained in:
@@ -51,6 +51,12 @@ pub fn create_public_api_routes(app_state: &Arc<AppState>) -> Router<Arc<AppStat
|
||||
.with_state(share_service);
|
||||
|
||||
router = router.nest("/s", public_share_router);
|
||||
|
||||
// Download endpoint uses full AppState (needs FileRetrievalService)
|
||||
router = router.route(
|
||||
"/s/{token}/download",
|
||||
get(share_handler::download_shared_file),
|
||||
);
|
||||
}
|
||||
|
||||
// i18n routes — no auth required (localization should be available before login)
|
||||
|
||||
Reference in New Issue
Block a user