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

add favicon support #1118

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open

add favicon support #1118

wants to merge 4 commits into from

Conversation

Sneezry
Copy link
Member

@Sneezry Sneezry commented Oct 17, 2023

This PR adds favicon support.

  1. This PR adds favicon support for MV2
  2. Firefox doesn't support to fetch favicon in MV2, and this PR disable this feature for Firefox
  3. When we migrate to MV3, chrome://favicon permission is not needed, and we need to remove it from permission list and CSP.

We read website url from issuer field. The user need to add ::<website-domain> in end of the issuer to show the favicon correctly. If the user doesn't add such an extension in the issuer, a default icon is shown.

image

image

There will be a warning to ask the user to grant extension permission to read the website favicon when enable this feature at the first time.

@mymindstorm
Copy link
Member

mymindstorm commented Oct 17, 2023 via email

@jaredzimmerman
Copy link

Is requesting permission to read favicons absolutely necessary? it seems really unnecessary from a UX perspective, even having a setting at all seems somewhat unneeded.

@Sneezry
Copy link
Member Author

Sneezry commented Oct 19, 2023

Is requesting permission to read favicons absolutely necessary? it seems really unnecessary from a UX perspective, even having a setting at all seems somewhat unneeded.

I do not want to embed favicons in the extension. That will increase the size of the package. For MV3, favicon permission is required, and chrome://favicon permission is required for MV2.

I add these new permissions as optional permission, only when this feature is enabled the extension will ask the permission.

Because this feature requires new permissions, we must have a new option to let the users disable it.

@jaredzimmerman
Copy link

How many 2FA will users have couple 100s max? even high res/svg favicons stored in local storage the size will be trivial.

@Sneezry
Copy link
Member Author

Sneezry commented Oct 19, 2023

How many 2FA will users have couple 100s max? even high res/svg favicons stored in local storage the size will be trivial.

The question is which favicons should we embed in the package? Google, Microsoft, Twitter, Facebook, GitHub... and what? And we can expect that there will be issues for missing favicons.

"Hey, please add xxx's favicon in the extension..."

We don't want to have such an issue.

@jaredzimmerman
Copy link

No, don't pre-install any favicons, get them when the user adds a site for a new code gen and store it in LocalStorage, you don't need to pre-install anything.

@Sneezry
Copy link
Member Author

Sneezry commented Oct 19, 2023

I got your point. LocalStorage has a 5MB limit, we can't store too much icons in that place. Most favicons are PNGs and ICOs, and if we want to store them in LocalStorage, we need to convert them to Base64 strings first. Again, base64 strings are ~1/3 bigger than the raw binary. Also, it can't be synced.

@jaredzimmerman
Copy link

I'm not sure that's accurate, also you don't need to sync the actual assets across installs, just the pointer, after sync on a new machine just have the local extension redownload from the synced pointers per code item. You can just grab a single variant of the favicon rather than trying to store full icos

@Sneezry
Copy link
Member Author

Sneezry commented Oct 19, 2023

you don't need to sync the actual assets across installs, just the pointer

chrome://favicon/xxx is the pointer, and it requires a new permission to access to.

@jaredzimmerman
Copy link

Use the URL matching function you already have to get the TLD for each item, on new install of the extension run the sync and redownload the favicons to that new machine, you're already storing matching URLS for each item.

@Sneezry
Copy link
Member Author

Sneezry commented Oct 19, 2023

redownload the favicons

Where should the extension download the favicons? If it downloads from chrome://favicon/xxx, this PR meets your expectation. If it downloads from <TLD>/favicon.ico, it will require <all_urls> permission, which is not acceptable.

@jaredzimmerman
Copy link

Ah! understood, my extension has <all_urls> so that's what I was comparing to. I understand what you're saying now, is there not metadata in chrome://favicon/xxx that allows you to match against the URL that your using for your site matching function? I'm not super familiar with how chrome stores favicons locally since I haven't needed to use that function.

@Sneezry
Copy link
Member Author

Sneezry commented Oct 19, 2023

For MV2, we can access to the favicons with this URL: chrome://favicon/<TLD>, for example, chrome://favicon/https://www.google.com. This requires chrome://favicon permssion.

For MV3, we can access to the favicons with this URL: <extension-url>/_favicon?pageUrl=<TLD>&size=16, for example, chrome-extension://bhghoamapcdpbohphigoooaddinpkbai/_favicon?pageUrl=https%3A%2F%2Fwww.google.com&size=16. This requires favicon permission.

@mymindstorm
Copy link
Member

Have not forgotten about this. Next available time to work on this is Wednesday .

_locales/en/messages.json Outdated Show resolved Hide resolved
manifests/manifest-chrome-testing.json Show resolved Hide resolved
src/components/Popup/EntryComponent.vue Outdated Show resolved Hide resolved
src/components/Popup/EntryComponent.vue Outdated Show resolved Hide resolved
src/components/Popup/EntryComponent.vue Outdated Show resolved Hide resolved
Sneezry and others added 4 commits November 8, 2023 13:30
Co-authored-by: Brendan <mymindstorm@evermiss.net>
Co-authored-by: Brendan <mymindstorm@evermiss.net>
@Paoapi

This comment has been minimized.

1 similar comment
@Paoapi

This comment has been minimized.

@thebigsafari

This comment has been minimized.

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.

None yet

5 participants