shares
Public file shares: management for owners and anonymous download pages.
attributelogger= logging.getLogger(__name__)attributerouter= APIRouter(prefix='/api/files', dependencies=[Depends(verify_public_sharing_enabled)], route_class=EncryptedRoute)attributepublic_router= APIRouter()attributeDOWNLOAD_TOKEN_TTL= 60func_share_info(share_id, meta) -> PublicShareInfoBuild the owner-facing view of a share.
paramshare_idstrparammetaPublicShareMetadataReturns
app.models.PublicShareInfofunccreate_public_share(decrypted_body=Depends(get_decrypted_request_body), user=Depends(verify_public_sharing_enabled)) -> PublicShareInfoCopy a file into public storage and register a share for it.
paramdecrypted_bodydict[str, Any]= Depends(get_decrypted_request_body)paramuserdict[str, Any]= Depends(verify_public_sharing_enabled)Returns
app.models.PublicShareInfofunclist_public_shares(user=Depends(verify_public_sharing_enabled)) -> list[PublicShareInfo]List the caller's shares, newest first.
paramuserdict[str, Any]= Depends(verify_public_sharing_enabled)Returns
list[app.models.PublicShareInfo]funcdelete_public_share(share_id, user=Depends(verify_public_sharing_enabled)) -> ResponseDelete one of the caller's shares.
paramshare_idstrparamuserdict[str, Any]= Depends(verify_public_sharing_enabled)Returns
fastapi.Responsefunc_remove_share_file(share_id) -> NoneDelete the public copy of a shared file, logging failures.
paramshare_idstrReturns
Nonefunccleanup_expired_shares() -> NoneRemove expired shares and stale download tokens.
Returns
Nonefunc_password_page(share_id, error='') -> HTMLResponse | NoneRender the password prompt page, or None if the template is missing.
paramshare_idstrparamerrorstr= ''Returns
fastapi.responses.HTMLResponse | Nonefunc_share_or_404(share_id) -> PublicShareMetadataReturn share metadata or raise 404.
paramshare_idstrReturns
app.models.PublicShareMetadatafunc_file_response(share_id, metadata) -> FileResponseStream the shared file with its original name.
paramshare_idstrparammetadataPublicShareMetadataReturns
fastapi.responses.FileResponsefuncdownload_shared_file(token) -> FileResponseDownload a password-protected share with a one-time token.
paramtokenstrReturns
fastapi.responses.FileResponsefuncaccess_public_share_get(share_id) -> ResponseServe a share, or the password prompt when it is protected.
paramshare_idstrReturns
fastapi.Responsefuncaccess_public_share_post(share_id, password=Form(...)) -> ResponseCheck a share password and redirect to a one-time download URL.
paramshare_idstrparampasswordstr= Form(...)Returns
fastapi.Response