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

newmail_notifier does not revert to correct favicon (+ feature request to customize the favicon) #9575

Open
2 tasks done
CombeeMike opened this issue Aug 8, 2024 · 1 comment

Comments

@CombeeMike
Copy link

Prerequisites

  • I have searched for duplicate or closed issues
  • I can recreate the issue with all plugins disabled

Describe the issue

I have my own skin which provides a custom favicon using the following section in its meta.json:

{
  // ...
  "links": {
    "icon": [
      { "type": "image/png", "sizes": "16x16", "href": "/images/favicon.svg" },
      { "type": "image/png", "sizes": "32x23", "href": "/images/favicon.svg" }
    ]
  }
  // ...
}

Bug

When a new mail arrives, the notifier plugin removes this favicon and shows its own "new mail" favicon from /plugins/newmail_notifier/favicon.ico which is what it should do.

However, when marking all unread emails as read, the default icon from /skins/elastic/images/favicon.ico is loaded instead of the one from my skin.

In the source code of the plugin I've seen that it loads the default icon from rcmail.env.favicon_href but I don't see where this gets its value from. Is there some kind of config which I can adjust to set it to the correct favicon from my skin?

Feature request

Besides that bug, I'd love to see some setting which allows me to tell the plugin which icon to show when new messages arrive instead of the default /plugins/newmail_notifier/favicon.ico.

Workaround

For the time being, I managed to set some hard redirects in my apache site config which solve both, the bug and the feature request:

<VirtualHost _default_:443>
  
  // ...
  
  Redirect permanent /plugins/newmail_notifier/favicon.ico /skins/my-skin/images/favicon_new_mail.svg
  Redirect permanent /skins/elastic/images/favicon.ico /skins/my-skin/images/favicon.svg

  // ...

</VirtualHost>

What browser(s) are you seeing the problem on?

Firefox

What version of PHP are you using?

8.1.2

What version of Roundcube are you using?

1.6.8

JavaScript errors

No response

PHP errors

No response

@alecpl
Copy link
Member

alecpl commented Aug 8, 2024

rcmail.env.favicon_href is being set in newmail_notifier.js. I see that with skin configuration like above there's a problem:

  1. The code looks for link[rel="shortcut icon"] elements, but your icons will have rel="icon" attribute.
  2. The code does not work properly with multiple link elements anyway.

You can probably workaround the first issue by using "shortcut icon" instead of "icon" in your skin config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants