Skip to content

Feat: add og share meta#7

Merged
arabcoders merged 9 commits intomasterfrom
dev
Jan 20, 2026
Merged

Feat: add og share meta#7
arabcoders merged 9 commits intomasterfrom
dev

Conversation

@arabcoders
Copy link
Owner

This pull request introduces several improvements and bug fixes related to token validation, file sharing, and upload management in the backend FastAPI application. The most significant changes include stricter and more consistent token status checks (including admin bypass), enhanced support for public media sharing with bot detection and OpenGraph previews, improvements to upload token handling, and timezone-aware database fields.

Token validation and admin bypass:

  • Token status checks (expired/disabled) are now enforced in get_file_info and download_file endpoints, with an explicit admin bypass allowing admins to access files even if the token is expired or disabled. [1] [2] [3] [4]
  • Token status checks are removed from the general get_token endpoint, so token metadata can be queried even if the token is expired or disabled.

Public sharing and OpenGraph preview:

  • Added a /f/{token} route that detects bots (e.g., Discord, Twitter) via the User-Agent header and serves a Jinja2-rendered OpenGraph preview page for public media sharing, improving link previews on social platforms. [1] [2] [3]
  • The preview includes metadata such as media type, duration, and file size for the first multimedia file, and lists additional files if present.

Upload token and record management:

  • The _ensure_token helper is extended to accept either a token value or token ID, and is now used throughout upload-related endpoints to consistently validate token status (including for TUS protocol endpoints and upload completion). [1] [2] [3] [4] [5] [6] [7]
  • Token validation errors are now more specific (e.g., "Token expired" vs "Token disabled").

Database and model improvements:

  • All created_at and completed_at fields in UploadToken and UploadRecord models are now timezone-aware (DateTime(timezone=True)), ensuring correct handling of timestamps. [1] [2]

Documentation and minor fixes:

  • Improved docstrings and parameter names for clarity, including documenting the new is_admin parameter and clarifying token info endpoint descriptions. [1] [2] [3]

These changes collectively improve security, reliability, and user experience for file sharing and upload management in the application.

@arabcoders arabcoders merged commit 8ca8105 into master Jan 20, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant