kiwix / kiwix-tools

Command line Kiwix tools: kiwix-serve, kiwix-manage, ...
https://download.kiwix.org/release/kiwix-tools/
GNU General Public License v3.0
435 stars 85 forks source link

kiwix-serve: favicon #159

Open nobicycle opened 6 years ago

nobicycle commented 6 years ago

Hi, I would like kiwix-server to have a favicon in the browser 3109afed-2885-4821-befa-8a0d58ce2ea4 The black icon is what represents kiwix-serve at the moment. How to change it? (under Linux, if that is relevant)

kelson42 commented 6 years ago

The favicon should come from the zim file. Which ZIM file do you tals about?

nobicycle commented 6 years ago

Hello kelson42, Both the main page http://127.0.0.1:8086 and wikipedia for schools have the icon mentioned above. 56abed01-e0a0-4f85-a484-9385889a7a26

OmegaPhil commented 6 years ago

Confirmed using kiwix-serve built from c6ace1eafc06bbe52d596f0905e50dac47000a7a (Tue Mar 27 12:03:21 2018 +0200), browsing into all ZIMs (old directory style and new single ZIM file) have no favicon in Pale Moon 27.9. An example ZIM would be 'askubuntu.com_en_all_2017-10.zim'. On the library page the relevant sites have the correct icons associated with their boxes.

I'm guessing that since I'm browsing one domain name (which in the kiwix sense hosts multiple ZIMs), PM will request the favicon just once for the library page, which won't have one?

kelson42 commented 2 years ago

https://github.com/kiwix/libkiwix/issues/471 secures we will have a favicon in kiwix-serve welcome page. But the favicon for each content should be managed in each ZIM. An here there is a lot to do as well. For the moment this is really not done properly in zimcheck and not in the scrapers either. We will have to improve that, but not sure exactly how. I will think about it in the next days.

aritroCoder commented 2 years ago

Hello, I am a beginner and would like to work on this issue, please guide me how set up a development environment and check out this issue

kelson42 commented 2 years ago

@veloman-yunkan Do you know how we could have a proper favicon for the browser with the iframe based viewer?

veloman-yunkan commented 2 years ago

@veloman-yunkan Do you know how we could have a proper favicon for the browser with the iframe based viewer?

@kelson42 No. I don't think it's possible (at least, not easy) to have a content dependent favicon in iframe based viewer.

JensKorte commented 1 year ago

But the favicon for each content should be managed in each ZIM. An here there is a lot to do as well. For the moment this is really not done properly in zimcheck and not in the scrapers either. We will have to improve that, but not sure exactly how. I will think about it in the next days.

Where is the icon at https://library.kiwix.org taken from?

kelson42 commented 1 year ago

@JensKorte Honestly not sure, from commons.wikimedia.org probably. Any problem with it?

JensKorte commented 1 year ago

@JensKorte Honestly not sure, from commons.wikimedia.org probably. Any problem with it?

No, I like them.

But the favicon for each content should be managed in each ZIM. An here there is a lot to do as well. For the moment this is really not done properly in zimcheck and not in the scrapers either. We will have to improve that, but not sure exactly how. I will think about it in the next days.

I thought the icons at the library site could be used in the zim file.

rgaudin commented 1 year ago

@veloman-yunkan Do you know how we could have a proper favicon for the browser with the iframe based viewer?

@kelson42 No. I don't think it's possible (at least, not easy) to have a content dependent favicon in iframe based viewer.

It's possible to retrieve the <iframe>'s icon and apply it to the main page, using JS. That's what zimit does. It's using a SW message but that's not required. Code can register a handler for the load event then query its DOM.

Where is the icon at https://library.kiwix.org/ taken from?

library.kiwix.org has a default icon (/favicon.ico) so whenever there's no semantic icon defined, it displays it.

kelson42 commented 1 year ago

Where is the icon at https://library.kiwix.org/ taken from?

library.kiwix.org has a default icon (/favicon.ico) so whenever there's no semantic icon defined, it displays it.

Welcome page favicon(s) have been fixed recently, see https://github.com/kiwix/libkiwix/pull/805. That part works fine IMO. The problem is once we move to ZIM content.

rgaudin commented 1 year ago

Where is the icon at https://library.kiwix.org/ taken from?

library.kiwix.org has a default icon (/favicon.ico) so whenever there's no semantic icon defined, it displays it.

Welcome page favicon(s) have been fixed recently, see kiwix/libkiwix#805. That part works fine IMO. The problem is once we move to ZIM content.

As I wrote, favicon.ico is a default that browsers tries in case there's no better option. So kiwix-serve could simply respond to favicon.ico with its favicon and that would mean all pages (content or not) would have a favicon.

kelson42 commented 1 year ago

As I wrote, favicon.ico is a default that browsers tries in case there's no better option. So kiwix-serve could simply respond to favicon.ico with its favicon and that would mean all pages (content or not) would have a favicon.

Not in favour of that. Would be better than what we have today, but is not what I expect.

rgaudin commented 1 year ago

I don't think you've expressed what you expect. This trick is super cheap and would bring some value.

Now if you want to have meaningful icons for content, because of how the player works it's easy to:

None of this prevent the side effort of improving scrapers to make sure they provide favicons.

veloman-yunkan commented 1 year ago

@kelson42 No. I don't think it's possible (at least, not easy) to have a content dependent favicon in iframe based viewer.

It's possible to retrieve the <iframe>'s icon and apply it to the main page, using JS. That's what zimit does. It's using a SW message but that's not required. Code can register a handler for the load event then query its DOM.

@rgaudin Thanks! At the time I couldn't figure out a way of dynamically changing the favicon. I looked for standardized JS API and didn't find one. I completely neglected the possibility that it could be done by manipulating links in the <head> section.