zadam / trilium

Build your personal knowledge base with Trilium Notes
GNU Affero General Public License v3.0
26.91k stars 1.88k forks source link

(Bug report) "Add to homescreen" on Android sets wrong url if Trilium is run in sub-directory via reverse proxy #4702

Open nimonimonimo opened 6 months ago

nimonimonimo commented 6 months ago

Trilium Version

0.62.4

What operating system are you using?

Other (specify below)

What is your setup?

Local + server sync

Operating System Version

FreeBSD 13.2

Description

Hi,

Thanks for an amazing app.

I have been using Trilium for several months now and likes it very much. I run it on my FreeBSD server behind a reverse proxy via nginx. I run it in a sub-directory similar to the example in the documentation:

location /trilium/ {
    proxy_pass http://127.0.0.1:8080/;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
} 

I have no problem connecting to it -- either from client on linux or mac os laptop -- as well as via webbrowser on any platform.

My only problem is that when I from my Android phone wants to add it as a shortcut via the browser menu: "Add to homescreen" it will be added with url consisting of only the domain name without the sub-directory. I believe this is because the generated "manifest.webmanifest"-file which looks like this:

{
  "name": "Trilium Notes",
  "short_name": "Trilium",
  "description": "Trilium Notes is a hierarchical note taking application with focus on building large personal knowledge bases.",
  "theme_color": "#333333",
  "background_color": "#1F1F1F",
  "display": "standalone",
  "scope": "/",
  "start_url": "/",
  "icons": [
    {
      "src": "/assets/vX/images/app-icons/ios/apple-touch-icon.png",
      "sizes": "180x180",
      "type": "image/png"
    },
    {
      "src": "/assets/vX/images/app-icons/png/512x512.png",
      "sizes": "512x512",
      "type": "image/png"
    }
  ]

I suspect that "scope" or "start_url" should include "/trilium".

Would it be possible to add support for this?

Thanks in advance!

Error logs

No response

Nriver commented 6 months ago

Samsung browser works fine. This should be an issue with your browser app.

nimonimonimo commented 6 months ago

This is with the Chrome browser. Tried on two different Android phones.

@Nriver are you also running it in a sub-directory? Could you paste the manifest.webmanifest-file?

Nriver commented 6 months ago

I believe I've identified the issue. It seems to be related to the Android launcher. Currently, I'm using a third-party launcher called "Nova Launcher," and the shortcuts function smoothly with both the Samsung browser and Chrome browser. However, when I switch back to the default launcher on my phone, the shortcuts behave as you described.

So, you might want to change your launcher app now :)

JIeJaitt commented 3 months ago

hi, Can Trilium be deployed on freebsd systems?