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

refactor: Proxy and cache avatar images #907

Merged
merged 16 commits into from
Sep 19, 2024

Conversation

JoaquinOlivero
Copy link
Contributor

Description

This PR changes how Jellyseerr handles profile images. Now they are proxied from the source and cached in the disk.
The caching mechanism uses the already existing "ImageProxy" class which I tweaked.

Also, I added a new endpoint "/avatarproxy" that takes the URL from the images, caches them if needed, and then returns them.

Screenshot (if UI-related)

To-Dos

  • Successful build pnpm build
  • Translation keys pnpm i18n:extract
  • Database migration (if required)

Issues Fixed or Closed

  • Fixes #XXXX

server/lib/imageproxy.ts Fixed Show fixed Hide fixed
Copy link
Collaborator

@gauthier-th gauthier-th left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done!

server/lib/imageproxy.ts Outdated Show resolved Hide resolved
server/lib/imageproxy.ts Outdated Show resolved Hide resolved
src/components/UserProfile/ProfileHeader/index.tsx Outdated Show resolved Hide resolved
server/lib/imageproxy.ts Outdated Show resolved Hide resolved
@github-actions github-actions bot added the merge conflict Cannot merge due to merge conflicts label Aug 11, 2024
Copy link

This pull request has merge conflicts. Please resolve the conflicts so the PR can be successfully reviewed and merged.

@gauthier-th gauthier-th mentioned this pull request Aug 12, 2024
10 tasks
@github-actions github-actions bot removed the merge conflict Cannot merge due to merge conflicts label Aug 13, 2024
gauthier-th
gauthier-th previously approved these changes Aug 16, 2024
@Gauvino
Copy link
Contributor

Gauvino commented Aug 17, 2024

No problem at all work's great !

src/i18n/locale/en.json Outdated Show resolved Hide resolved
gauthier-th
gauthier-th previously approved these changes Aug 20, 2024
@github-actions github-actions bot added the merge conflict Cannot merge due to merge conflicts label Aug 20, 2024
Copy link

This pull request has merge conflicts. Please resolve the conflicts so the PR can be successfully reviewed and merged.

@Fallenbagel
Copy link
Owner

Fallenbagel commented Aug 21, 2024

@JoaquinOlivero could you resolve the conflicts? So we can get this in

EDIT: its okay I have done it c:

server/routes/auth.ts Fixed Show fixed Hide fixed
server/routes/auth.ts Fixed Show fixed Hide fixed
server/routes/auth.ts Fixed Show fixed Hide fixed
server/routes/auth.ts Fixed Show fixed Hide fixed
server/routes/avatarproxy.ts Fixed Show fixed Hide fixed
server/routes/user/index.ts Fixed Show fixed Hide fixed
server/routes/user/index.ts Fixed Show fixed Hide fixed
server/routes/auth.ts Fixed Show fixed Hide fixed
server/routes/auth.ts Fixed Show fixed Hide fixed
server/routes/auth.ts Fixed Show fixed Hide fixed
server/routes/auth.ts Fixed Show fixed Hide fixed
server/routes/avatarproxy.ts Fixed Show fixed Hide fixed
server/routes/user/index.ts Fixed Show fixed Hide fixed
server/routes/user/index.ts Fixed Show fixed Hide fixed
Copy link
Collaborator

@gauthier-th gauthier-th left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you try to replace .startsWith('https://gravatar.com') with .startsWith('https://gravatar.com/') (note the / at the end) to see if it fixes the GitHub security warnings?

src/components/Common/CachedImage/index.tsx Outdated Show resolved Hide resolved
src/components/Common/CachedImage/index.tsx Outdated Show resolved Hide resolved
gauthier-th
gauthier-th previously approved these changes Sep 10, 2024
Copy link
Collaborator

@gauthier-th gauthier-th left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Owner

@Fallenbagel Fallenbagel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have not tested yet but LGTM

@Gauvino
Copy link
Contributor

Gauvino commented Sep 11, 2024

Could the action run for a docker image be done please ?

@gauthier-th
Copy link
Collaborator

Could the action run for a docker image be done please ?

Done with the preview-cache-avatar tag

@gauthier-th gauthier-th added the preview PRs deployed for testing with tag `:preview-prxx` label Sep 16, 2024
Copy link
Owner

@Fallenbagel Fallenbagel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some issues were reported (on issues index) in discord so until that is fixed

package.json Show resolved Hide resolved
Copy link
Owner

@Fallenbagel Fallenbagel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good!

@Fallenbagel Fallenbagel merged commit edfd804 into Fallenbagel:develop Sep 19, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preview PRs deployed for testing with tag `:preview-prxx`
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants