Kareadita / Kavita

Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.
http://www.kavitareader.com
GNU General Public License v3.0
6.34k stars 329 forks source link

Base URL not respected in Library URL and smart filter hrefs #3146

Closed Fesaa closed 1 month ago

Fesaa commented 2 months ago

What happened?

The baseurl set up, is not respected/used in the library pages. Nor in the links to smart filtered in the dashboard customize page.

They're simply not used, which works fine while on the web app. But reloading the page, or opening it at a later time may cause issues.

I've made a video, with a side by side setup of the stable, and nightly branch.

https://github.com/user-attachments/assets/b318d7ef-e6d6-47ad-b499-ee53fddb1458 If you look closely, the /kavita/ part is included when going to it. But removed when the page loads, maybe this helps a bit.

The issue also occurs with the "load filter" references on this page. I've not included this in the video, as this is also an issue on the stable branch. (The code just doesn't add it) image

What did you expect?

The baseURL to be appended at all times.

Kavita Version Number - If you don not see your version number listed, please update Kavita and see if your issue still persists.

Nightly Testing Branch

What operating system is Kavita being hosted from?

Docker (Dockerhub Container)

If the issue is being seen on Desktop, what OS are you running where you see the issue?

Linux

If the issue is being seen in the UI, what browsers are you seeing the problem on?

Firefox, Chrome, Safari

If the issue is being seen on Mobile, what OS are you running where you see the issue?

iOS

If the issue is being seen on the Mobile UI, what browsers are you seeing the problem on?

No response

Relevant log output

No response

Additional Notes

Relevant discord messages;

https://discord.com/channels/821879810934439936/851515194185744464/1278814185093857280 https://discord.com/channels/821879810934439936/851515194185744464/1277175419463794690 https://discord.com/channels/821879810934439936/851515194185744464/1275565898996125737

majora2007 commented 1 month ago

I was able to reproduce this but not sure how to fix it honestly. I'm linking the way I always have, so something weird is happening. I need more time to investigate.

kayhos commented 1 month ago

I don't know if it has already been fixed as per the pull request from resterday, but under 0.8.3.0, it is still hapening. Kavita is using the correct Base Url in Home, Want to Read, Collections, Reading Lists, Bookmarks, Libraries and Smart Filters. When going in a Series from a library, Kavita redirects from the Base Url to the Stripped Url after loading the page.

I am using a docker image (image: jvmilazz0/kavita:latest) and a reverse proxy under Caddy 2.

majora2007 commented 1 month ago

Is the base URL respected when you Ctrl click a card title? I'm trying to understand which routing mechanisms respect the base URL and which don't.

Fesaa commented 1 month ago

The issue wasn't the routing, the routing works just fine. The issue was the page manually updating the url after the page had loaded to include which tab it was open on, but not using the correct url. So the base url got stripped.

As for what respects it, you can look at the other issue, which shows it clearly. Using any of angulars routing stuff appends it fine, so [routerLink], etc. But using the plain href does not. Which is what causes the issue in settings. But we couldn't use routerLink there, as it re-encodes the passed string. Breaking the url, as you pass it an already encoded part

majora2007 commented 1 month ago

Ahh I see. Let me look at the PR and test today. I'll try and see if I can get this into the hotfix.

majora2007 commented 1 month ago

Okay here is what I observed after my fixes:

  1. I can use Load filter to load a smart filter from customize and no issue
  2. I can open a smart filter bound to side nav or dashboard without any issue
  3. After any of the above, I can alter the filter and it would reflect and reload a browser refresh completely fine.

I can build a native build for anyone that is free in the next hour or 2 to test, before I ship the hotfix.

majora2007 commented 1 month ago

Got the seal of approval from Fresaa :)