feat(url-preview): Optionally download audio/video files for url preview requests #1473

Open
trashpanda wants to merge 6 commits from trashpanda/continuwuity:trashpanda/url-preview-videos into main
Contributor

This pull request adds audio and video files to URL previews and downloads them, if they are present and the config option is enabled.

Pull request checklist:

  • This pull request targets the main branch, and the branch is named something other than
    main.
  • I have written an appropriate pull request title and my description is clear.
  • I understand I am responsible for the contents of this pull request.
  • I have followed the contributing guidelines:
This pull request adds audio and video files to URL previews and downloads them, if they are present and the config option is enabled. **Pull request checklist:** - [x] This pull request targets the `main` branch, and the branch is named something other than `main`. - [x] I have written an appropriate pull request title and my description is clear. - [x] I understand I am responsible for the contents of this pull request. - I have followed the [contributing guidelines][c1]: - [x] My contribution follows the [code style][c2], if applicable. - [x] I ran [pre-commit checks][c1pc] before opening/drafting this pull request. - [x] I have [tested my contribution][c1t] (or proof-read it for documentation-only changes) myself, if applicable. This includes ensuring code compiles. - [x] My commit messages follow the [commit message format][c1cm] and are descriptive. - [ ] I have written a [news fragment][n1] for this PR, if applicable<!--(can be done after hitting open!)-->. [c1]: https://forgejo.ellis.link/continuwuation/continuwuity/src/branch/main/CONTRIBUTING.md [c2]: https://forgejo.ellis.link/continuwuation/continuwuity/src/branch/main/docs/development/code_style.mdx [c1pc]: https://forgejo.ellis.link/continuwuation/continuwuity/src/branch/main/CONTRIBUTING.md#pre-commit-checks [c1t]: https://forgejo.ellis.link/continuwuation/continuwuity/src/branch/main/CONTRIBUTING.md#running-tests-locally [c1cm]: https://forgejo.ellis.link/continuwuation/continuwuity/src/branch/main/CONTRIBUTING.md#commit-messages [n1]: https://towncrier.readthedocs.io/en/stable/tutorial.html#creating-news-fragments
feat(url-preview): Optionally download audio/video files for url preview requests
Some checks failed
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 2m34s
Checks / Prek / Clippy and Cargo Tests (pull_request) Has been cancelled
53df59b9a0
fix: Update example config
Some checks failed
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 1m28s
Checks / Prek / Clippy and Cargo Tests (pull_request) Failing after 15m53s
fa47417cdc
Henry-Hiles requested changes 2026-02-28 15:14:59 +00:00
Dismissed
Henry-Hiles left a comment
Contributor

Can we check file size against max_request_size before downloading? Just to stop someone sending, e.g. a 20gb video and filling up a servers disk space.

Can we check file size against `max_request_size` before downloading? Just to stop someone sending, e.g. a 20gb video and filling up a servers disk space.
fix: Refactor and block media downloads larger than max_request_size
Some checks failed
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Clippy and Cargo Tests (pull_request) Has been cancelled
Checks / Prek / Pre-commit & Formatting (pull_request) Has been cancelled
8e7e81453e
fix: Clippy lints
Some checks failed
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 3m21s
Checks / Prek / Clippy and Cargo Tests (pull_request) Failing after 17m54s
0b666fc948
fix: Retrieve content_type and video width/height
Some checks failed
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 3m3s
Checks / Prek / Clippy and Cargo Tests (pull_request) Failing after 17m42s
5b712416c5
trashpanda changed title from WIP: feat(url-preview): Optionally download audio/video files for url preview requests to feat(url-preview): Optionally download audio/video files for url preview requests 2026-03-02 03:40:08 +00:00
ginger force-pushed trashpanda/url-preview-videos from 5b712416c5
Some checks failed
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 3m3s
Checks / Prek / Clippy and Cargo Tests (pull_request) Failing after 17m42s
to 01d6d6e3d8
All checks were successful
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 4m22s
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 38m41s
2026-03-04 14:51:26 +00:00
Compare
ginger approved these changes 2026-03-04 14:55:33 +00:00
@ -143,2 +143,4 @@
}
pub fn url_preview_allow_audio_video(&self) -> bool {
self.server.config.url_preview_allow_audio_video
Owner

I really need to remove all these functions from globals. problems for a future PR

I really need to remove all these functions from globals. problems for a future PR
Henry-Hiles left a comment
Contributor

LGTM, but I don't really do rust so most of this is magic to me :3

LGTM, but I don't really do rust so most of this is magic to me :3
All checks were successful
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 4m22s
Required
Details
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 38m41s
Required
Details
This pull request is blocked because it's outdated.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u trashpanda/url-preview-videos:trashpanda-trashpanda/url-preview-videos
git switch trashpanda-trashpanda/url-preview-videos
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
continuwuation/continuwuity!1473
No description provided.