qbittorrent / qBittorrent

qBittorrent BitTorrent client
https://www.qbittorrent.org
Other
26.92k stars 3.88k forks source link

qbittorrent-nox: webui theme invalid and you can no longer login #18401

Open simonbcn opened 1 year ago

simonbcn commented 1 year ago

qBittorrent & operating system versions

qbittorrent-nox: 4.5.0 x64 Operating system: Manjaro Linux Qt: 6.4.1 libtorrent-rasterbar: 2.0.8

What is the problem?

I wanted to change the webUI theme to Dracula and I followed the wrong instructions on their website: https://draculatheme.com/qbittorrent

I indicated, in the Use alternative Web UI field of the web interface, the folder as indicated in that web site, but the format thus downloaded is not valid. So I get an error message: File type not acceptable, only regular file types are accepted.

The problem is that every time I try to access the webUI I get that error and it won't let me do anything else.

The logical thing would be that if the format of the file/folder that has been indicated in this field is not valid, it returns to the previous valid configuration. Not that it shows this error without giving me the option to do anything else.

Steps to reproduce

No response

Additional context

No response

Log(s) & preferences file(s)

No response

nb-programmer commented 1 year ago

Yup, had the same problem. I found that you can do the following to undo this:

  1. Stop qbittorrent-nox
  2. Edit your ~/.config/qBittorrent/qBittorrent.conf file
  3. Find the [Preferences] section, in it there is:
    • WebUI\AlternativeUIEnabled: Set this to false
    • WebUI\RootFolder: Make this blank from whatever it was

Start qbittorrent-nox again, and it now works. Kind of strange that this is a thing tbh.

Highlighted changes:

image
glassez commented 1 year ago

The logical thing would be that if the format of the file/folder that has been indicated in this field is not valid, it returns to the previous valid configuration. Not that it shows this error without giving me the option to do anything else.

Note that it can consist of many files (.html, .css, .js, images etc.) and not all of them are used at the same time. So would be the desired behavior that qBittorrent switches back to default WebUI once any of these files failed to load?

simonbcn commented 1 year ago

Maybe you think it is better to leave the user unable to access the application without modifying the configuration file manually!

I just tried another theme (https://github.com/WDaan/VueTorrent) and same error: File type not acceptable, only regular file types are accepted.:

❯ grep WebUI .config/qBittorrent/qBittorrent.conf
.....
WebUI\AlternativeUIEnabled=true
....
WebUI\RootFolder=/home/juan/fuentes/VueTorrent/public
....

❯ ls -1 /home/juan/fuentes/VueTorrent/public
 assets
 favicon.ico
 icons
 img
 index.html
 manifest.webmanifest
 registerSW.js
robots.txt
 sw.js
 workbox-3625d7b0.js

What am I doing wrong for it to fail the 2 times I have tried? The 2 themes I have tried are recently updated.

Note that it can consist of many files (.html, .css, .js, images etc.) and not all of them are used at the same time. So would be the desired behavior that qBittorrent switches back to default WebUI once any of these files failed to load?

@glassez I'm not talking about a file failing, I'm talking about it failing completely when trying to load a different theme for the webUI. It is at that point when not being able to CHANGE webUI that it should return to the previous one, not leave the user stranded without being able to access the program or the configuration. It is more correct would be to make a check of the contents of that folder before trying to load it without further ado.

On the other hand, the error message doesn't add up and makes me think that something is not working as it should: File type not acceptable, only regular file types are accepted.. only regular file types? Isn't there supposed to be a folder (the one containing the theme: js, html, css,...) and not just a filename?

2023-01-21_14-32

simonbcn commented 1 year ago

Ok, the problem is that I have to indicate the parent folder to the one called "public"! It is nonsense that this should fail like this.

rudak commented 1 year ago

i had the same problem... for info when I modify qbittorrent.conf it doesn't work even if I restart. you have to stop the service, make the modification and start after saving. hoping it's of use to someone

stefan11111 commented 1 year ago

Who thought this was a good idea? I tried to apply the dark theme from the sticky post on the forum: https://forum.qbittorrent.org/viewtopic.php?t=10068

And I got it to fail like this. Somehow, not even stopping qbittorrent-nox(don't have a service for it, I start it with a hook), editing the config file and restarting did nothing. I had to rebuild qbittorrent with the gui and edit it from it's settings. But what if this had happened on a nas or another type of headless server? What should I have done in that case? Do a clean reinstall of qbittorrent? Switch to something else? I have 50 torrents right now, totaling about 4TB. It would mean more than a day of downtime if I had to do that. Do y'all really think that "fallback to the default theme" is a worse outcome than "lock the user out, unable to fix the problem"?

luzpaz commented 1 year ago

@stefan11111 what version of qbittorrent are you reporting about ?

stefan11111 commented 1 year ago

qbittorrent 4.5.4

luzpaz commented 1 year ago

This should be an urgent status ticket

stefan11111 commented 1 year ago

This should be an urgent status ticket

I agree. But that's up to the devs to decide.

glassez commented 1 year ago

@glassez I'm not talking about a file failing, I'm talking about it failing completely when trying to load a different theme for the webUI.

First of all, what is "theme for the webUI" do you talk about? It isn't theme, skin, etc. It IS (alternative) webUI (i.e. client web application).

What do you mean by "failing completely"? As I said above, from the qBittorrent server side perspective alternative webUI is just a set of files. We know nothing about its layout. We know nothing of what files there should be. When client side requests some file we don't know anything about its purpose etc. When there is no such file server just returns error code, since we know nothing why such a file is requested by client.

The only thing we know is qBittorrent implementation details, i.e. that valid webUI should most likely have both public folder (since it is used for "unauthorized" access, e.g. to provide login page) and private folder (since it is used for "authorized" access, e.g. to provide any resources when user is logged in). We can also assume that both of these folders should contain at least some files, i.e. be non-empty. So all we could do is check the above conditions, and if they are not satisfied, then fallback to the built-in WebUI.

Since I am not a web developer, I do not pretend that I fully correctly assess this problem. If someone has better ideas, then please express them.

stefan11111 commented 1 year ago

@glassez

The theme in question is: https://forum.qbittorrent.org/viewtopic.php?t=10068. I know it's under the windows section, but I decided to try it out anyway. I never expected the price for trying and failing to be getting locked out and having to rebuild qbittorrent with it's gui.

So all we could do is check the above conditions, and if they are not satisfied, then fallback to the built-in WebUI.

Yes, do that. It's way better that locking the user out, unable to fix the problem.

As I read your comment, the reason for keeping things so broken, to the point of potentially having to cleanly reinstall qbittorrent on a headless server, having to then re-add and recheck torrents, annoyance and time wasted be damned is... ...we couldn't/didn't want to implement a proper mechanism to check webui themes, so we just lock the user out with a check and ignore the bad case in the rest of the code(I tried patching the check out, it didn't work).

It's like saying: We can't/won't implement a check to see if the cd the user inserts into the car radio is good, so we just brick the radio if the user inserts a bad cd and just ignore the bad case.

This is how your comment looks.

glassez commented 1 year ago

I never expected the price for trying and failing to be getting locked out and having to rebuild qbittorrent with it's gui.

https://github.com/qbittorrent/qBittorrent/issues/18401#issuecomment-1694502723

stefan11111 commented 1 year ago

I never expected the price for trying and failing to be getting locked out and having to rebuild qbittorrent with it's gui.

#18401 (comment)

Did that. Didn't work for some reason. As stated before, I don't use a service for it, so I did:

pkill qbittorrent-nox(made sure it was really killed). edit config restart qbittorrent nox.

Didn't work.

glassez commented 1 year ago

pkill qbittorrent-nox(made sure it was really killed). edit config restart qbittorrent nox.

What exactly did you edit? And what happens when you try to access it after restart?

stefan11111 commented 1 year ago

What exactly did you edit? And what happens when you try to access it after restart?

Edited ~/.config/qBittorrent/qBittorrent.conf Changed WebUI\AlternativeUIEnabled=true to WebUI\AlternativeUIEnabled=false Changed WebUI\RootFolder= to WebUI\RootFolder=

After starting qbittorrent again, I was prompted with the same "File type not acceptable, only regular file types are accepted." message.

keepso commented 6 months ago

What exactly did you edit? And what happens when you try to access it after restart?

Edited ~/.config/qBittorrent/qBittorrent.conf Changed WebUI\AlternativeUIEnabled=true to WebUI\AlternativeUIEnabled=false Changed WebUI\RootFolder= to WebUI\RootFolder=

After starting qbittorrent again, I was prompted with the same "File type not acceptable, only regular file types are accepted." message.

looks correct, I fixed same way when I was messing around a docker install. Trying to edit it with portainer console was not working. Thanks to this post, first I "stop" it from portainer interface. And then I find the .conf file from the host VM system and then it worked.

Now I know how to fix it, it's time to mess around more and try to install different themes.