feat(pass): custom icon images for Pass items#476
feat(pass): custom icon images for Pass items#476wiland99 wants to merge 1 commit intoProtonMail:mainfrom
Conversation
Allow users to upload custom icon images on login items, leveraging the existing file attachments infrastructure with a filename convention (__pass_custom_icon__) to distinguish icons from regular attachments. - Add image processing helper (resize to 64x64 PNG) - Add useCustomIcon hook to download and display icon attachments - Integrate custom icon display in SafeItemIcon (list + detail views) - Add CustomIconField upload component to Login create/edit forms - Filter icon files from regular file attachments display Closes ProtonMail#475 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Have you managed to run the code locally and if that's the case, can you put some screenshots of how the feature look here please? |
|
It looks like the web client makes an extra API request to get file attachments for each item with them, which would quickly become a lot of request. I think it would be better to store the icon as a item field instead, that way it would be retrieved in the same request as the rest item. A text field should be able to contain an SVG file, since it's just XML (and generally quite small, KB's), if people upload a png/jpeg/webp it could be base64 encoded and stored as an SVG, see https://en.wikipedia.org/wiki/Data_URI_scheme#SVG For people who upload a SVG icon, keeping it as an vector image (SVG) would also avoid losing details, in the process of converting a vector image to a low resolution raster image. |
Summary
Proof of concept for allowing users to upload custom icon images on Proton Pass items, as proposed in #475.
Approach: Leverages the existing file attachments infrastructure — no backend API or protobuf schema changes needed. Custom icons are stored as encrypted file attachments with a filename convention (
__pass_custom_icon__) to distinguish them from regular files.What's included:
useCustomIconhook — downloads and decrypts the icon attachment, providing an object URL for renderingSafeItemIconintegration — custom icons display in both list and detail views, taking priority over domain faviconsCustomIconFieldform component — clickable icon area next to the title field for uploading/removing iconsScope (PoC):
Files changed:
packages/pass/lib/file-attachments/custom-icon.tspackages/pass/hooks/files/useCustomIcon.tspackages/pass/components/Form/Field/CustomIconField.tsxpackages/pass/components/Layout/Icon/ItemIcon.tsxpackages/pass/components/Item/Login/Login.new.tsxpackages/pass/components/Item/Login/Login.edit.tsxpackages/pass/components/FileAttachments/FileAttachmentsFieldEdit.tsxpackages/pass/components/FileAttachments/FileAttachmentsView.tsxTest plan
🤖 Generated with Claude Code