mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-09 14:53:00 +03:00
[PR #933] [MERGED] chore: minify background image #541
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/pocket-id/pocket-id/pull/933
Author: @ItalyPaleAle
Created: 9/11/2025
Status: ✅ Merged
Merged: 9/14/2025
Merged by: @ItalyPaleAle
Base:
main← Head:background-img-webp📝 Commits (10+)
70a8e09chore: minify background image76f4206Add missing mime typesebc590bAdd missing mime types to clientc113978Make image 1440p9abbec2Add test for data28880b0fix linterd9dbfbfMerge branch 'main' into background-img-webp37c08fbremove sizefaf6191Merge branch 'main' of https://github.com/pocket-id/pocket-id into background-img-webpd84f4earemove unnecessary image data type📊 Changes
11 files changed (+195 additions, -22 deletions)
View changed files
📝
backend/internal/bootstrap/application_images_bootstrap.go(+81 -11)➕
backend/internal/bootstrap/application_images_bootstrap_test.go(+61 -0)📝
backend/internal/service/app_config_service.go(+1 -1)📝
backend/internal/utils/email/email_service_templates.go(+3 -3)📝
backend/internal/utils/file_util.go(+27 -4)📝
backend/internal/utils/hash_util.go(+19 -0)➖
backend/resources/images/background.jpg(+0 -0)➕
backend/resources/images/background.webp(+0 -0)📝
frontend/src/lib/components/form/profile-picture-settings.svelte(+1 -1)📝
frontend/src/routes/settings/admin/application-configuration/application-image.svelte(+1 -1)📝
frontend/src/routes/settings/admin/oidc-clients/oidc-client-form.svelte(+1 -1)📄 Description
The current background image is a very large JPEG file that is ove 3MB in size. That is a lot of data, especially for users that are not in the LAN.
This PR converts the background image to a smaller one (1440p) and uses the WebP format (supported by all browsers that support WebAuthn). This reduces the size of the background image to just 292KB. That's a 92% reduction!
Because we did not have code in place to replace existing images only if they were the default, I added some support code that checks if file on disk represent legacy default images and deletes them - but only if they were the default ones (hashes are hardcode in the application)
Tested:
���� This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.