Skip to content

[feature] get favicons without involving external companies #73

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

Open
masukomi opened this issue Aug 21, 2024 · 1 comment
Open

[feature] get favicons without involving external companies #73

masukomi opened this issue Aug 21, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@masukomi
Copy link
Owner

masukomi commented Aug 21, 2024

(currently the "favicons" BB displays are retrieved via a google api. There's a setting to turn this behavior off in v2.2.0)

As a user who doesn't like immoral corporations who sell my information for money and give it to governments that might want to hurt me, I don't wish for Google to be involved in my bookmarking, so that I might minimize their visibility of my actions.

The Goal of this Ticket is to attempt to find a way to extract "favicons" from a web site reliably. More specifically to get teh large images linked from meta tags and not the 16x16px .ico files.

this Stack Overflow answer provided the following JavaScript which looks promising.

var getFavicon = function(){
    var favicon = undefined;
    var nodeList = document.getElementsByTagName("link");
    for (var i = 0; i < nodeList.length; i++)
    {
        if((nodeList[i].getAttribute("rel") == "icon")||(nodeList[i].getAttribute("rel") == "shortcut icon"))
        {
            favicon = nodeList[i].getAttribute("href");
        }
    }
    return favicon;        
}

alert(getFavicon());

IF this proves reliable, we should

  • download the favicon
  • probably resize it to some standard (for BB) dimension
    • i'm not thrilled with the idea of this because it brings in the dependency on imagemagick, because no-ones written ruby code to do this without it AFAIK.
  • archive images locally (see Ticket #52 )
@masukomi masukomi added the enhancement New feature or request label Aug 21, 2024
@masukomi
Copy link
Owner Author

Thought:
I have two thoughts on approaching this

Initially I was oping for a small piece of JS that can run in the browser (bookmarklet & browser extensions) and can insert the url of the image we need to download into a hidden field in the add bookmark form. The back-end could then download & resize the image in a background job. I was thinking it would be good if we had reliable JS that could be inserted into the bookmarklet without making it a bazillion lines long.

But,
I'm wondering if it wouldn't be better to just have the background process do all the work.

One of the biggest benefits to this approach is that if there's a bug, or improvement, we don't need to get people to update their bookmarklets or browser extensions, although the latter should happen automatically.

Doing it on the backend means the JS doesn't have to waste time figuring out where the favicon even when we already have it, and the JS in teh bookmarklet remains easy to read for more cautious users. We could work around that by embedding hidden info in the form when its generated but then we're inspecting 1 page's contents to know if we should inspect another page's contents and that sounds silly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant