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

Google icons do not belong to the right web #49

Open
cdiazbas opened this issue Apr 26, 2023 · 2 comments · May be fixed by #65
Open

Google icons do not belong to the right web #49

cdiazbas opened this issue Apr 26, 2023 · 2 comments · May be fixed by #65

Comments

@cdiazbas
Copy link

Info:

  • OS: 12.6.5
  • Logseq ver: 0.9.4
  • Plugin ver: v1.15.16
  • Theme name: any theme

Description:
All the link regarding google.com (documents, presentations, spreadsheets, etc) have the same icon. It looks like they are taking it from the last google page or something like that. When I open the app, they look right, but after going to any page, they update is wrong. Moreover, google drive have the "Google" icon instead of the google-drive icon.

Screenshots
Screenshot 2023-04-26 at 14 13 07

@dwradcliffe
Copy link

I'm still seeing this too

@gabetax
Copy link

gabetax commented May 22, 2024

The source of the bug is that the favIconsCache uses the link's "hostname" as a cache key:

if (globals.favIconsCache.has(hostname)) {
// try from cache
faviconData = globals.favIconsCache.get(hostname);
} else {
// no? get fresh + save to cache
faviconData = await getFaviconData(url);
globals.favIconsCache.set(hostname, faviconData);
}

When there's a cache hit, it skips the special-cased path checks specific to Google Docs at:

if (url.includes('docs.google.com/document')) {
return favIcon = {
format: 'img',
src: await getBase64FromUrl(`https://ssl.gstatic.com/docs/documents/images/kix-favicon7.ico`)
}
}
if (url.includes('docs.google.com/spreadsheets')) {
return favIcon = {
format: 'img',
src: await getBase64FromUrl(`https://ssl.gstatic.com/docs/spreadsheets/favicon3.ico`)
}
}
if (url.includes('docs.google.com/presentation')) {
return favIcon = {
format: 'img',
src: await getBase64FromUrl(`https://ssl.gstatic.com/docs/presentations/images/favicon5.ico`)
}
}

I also observed that if you refresh the Logseq window (e.g. Cmd+R) we display the correct icons, because there's a race with the cache being empty.

I'm not clear on whether the intent of the favIconsCache is to exclusively skip the HTTP fetches, or if there's observable compute savings for the local inlined <svg ... tags too. But if not, maybe the cache concern could be lifted into getBase64FromUrl, so the cache key could just be the URL of the favicon instead of the hostname of the link?

Thoughts @yoyurec?

@gabetax gabetax linked a pull request May 26, 2024 that will close this issue
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 a pull request may close this issue.

3 participants