Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding an image_details table to store image dimensions. #4704

Draft
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

dessalines
Copy link
Member

@dessalines dessalines commented May 6, 2024

This also fixed a lot of bugs, such as all link-posts breaking when using the proxy setting.

This should probably go in 0.19.4 because of all the bug fixes, and because there are no breaking API changes (only an optional joined table to PostView).

@Nutomic I'll comment on the code here, but I was very confused by the proxying of not just thumbnails and other image fields, but the post.url itself was getting rewritten before. Even if that is an image link, it should stay pure/unproxied, as the primary source of record, otherwise federation and thumbnail generation would keep chaining proxy links recursively.

- Adds an image_details table, which stores the height,
  width, and content_type for local and remote images.
- For LocalImages, this information already comes back with
  the upload.
- For RemoteImages, it calls the pictrs details endpoint.
- Fixed some issues with proxying non-image urls.
- Fixes #3328
- Also fixes #4703
@dessalines dessalines marked this pull request as ready for review May 6, 2024 16:02
api_tests/prepare-drone-federation-test.sh Show resolved Hide resolved
api_tests/src/shared.ts Show resolved Hide resolved
api_tests/src/image.spec.ts Show resolved Hide resolved
crates/api_common/src/request.rs Show resolved Hide resolved
crates/api_common/src/request.rs Show resolved Hide resolved
crates/db_schema/src/impls/images.rs Outdated Show resolved Hide resolved
crates/db_schema/src/source/images.rs Show resolved Hide resolved
crates/db_views/src/post_view.rs Show resolved Hide resolved
crates/routes/src/images.rs Show resolved Hide resolved
crates/routes/src/images.rs Show resolved Hide resolved
@dessalines dessalines marked this pull request as draft May 15, 2024 03:14
dessalines added a commit that referenced this pull request May 15, 2024
- This extracts only the proxy image fixes from #4704, leaving off
  thumbnails.
@dessalines dessalines mentioned this pull request May 15, 2024
Nutomic pushed a commit that referenced this pull request May 22, 2024
* Adding an image_details table to store image dimensions.

- Adds an image_details table, which stores the height,
  width, and content_type for local and remote images.
- For LocalImages, this information already comes back with
  the upload.
- For RemoteImages, it calls the pictrs details endpoint.
- Fixed some issues with proxying non-image urls.
- Fixes #3328
- Also fixes #4703

* Running sql format.

* Running fmt.

* Don't fetch metadata in background for local API requests.

* Dont export remote_image table to typescript.

* Cleaning up validate.

* Dont proxy url.

* Fixing tests, fixing issue with federated thumbnails.

* Fix tests.

* Updating corepack, fixing issue.

* Refactoring image inserts to use transactions.

* Use select exists again.

* Fixing imports.

* Fix test.

* Removing pointless backgrounded metadata generation version.

* Removing public pictrs details route.

* Fixing clippy.

* Fixing proxy image fetching. Fixes #4703

- This extracts only the proxy image fixes from #4704, leaving off
  thumbnails.

* Fix test.

* Addressing PR comments.

* Address PR comments 2.

---------

Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com>
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.

Include thumbnail width and height on Post [Bug]: Image proxying broken
4 participants