Browser console errors regarding ynh_portal on publicly exposed apps

My YunoHost server

Hardware: VPS bought online
YunoHost version:
I have access to my server : Through SSH | through the webadmin
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no

Description of my issue

On all publicly exposed websites hosted with yunohost I do have console errors when accessing them without being logged in into yunohost portal. This looks pretty unprofessional as my clients use these publicly exposed sites without being logged in into yunohost portal of course. This applies for the following apps:

  • WordPress
  • Matomo
  • InvoiceNinja

I believe, this happens as /etc/nginx/conf.d/ is included in those app’s nginx configs which is basically correct for showing the overlay for a yunohost logged-in user. I looked at this file and l.2 seems to cause the issue:

sub_filter </head> '
<script type="text/javascript" src="/ynh_portal.js"></script>
<link type="text/css" rel="stylesheet" href="/ynh_overlay.css">
<script type="text/javascript" src="/ynhtheme/custom_portal.js"></script>
<link type="text/css" rel="stylesheet" href="/ynhtheme/custom_overlay.css">

Of course those files don’t exist when the visitor is not logged in as yunohost user. So, the loading fails with displaying the browser console errors. However, I would prefer a conditonal logic that checks if the stylesheets / scripts exist and only attempts to load them if they exist. Perhaps with one of the methods mentioned here. I wanted to open an issue for this in yunohost github repository. However, I can’t see the issue tab there. Can anybody implement this suggestion? I would also be willing to create a pull request for this myself when I find the time.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.