pdinklag / MinecraftStats

A Minecraft player statistics browser for the web - supports 1.13 and later!
https://discord.gg/brH5PGG8By
Other
227 stars 53 forks source link

Updated to latest and my stats broke #74

Closed lukeeexd closed 4 years ago

lukeeexd commented 4 years ago

So I was going through different things to update and everything broke. So i removed everything and downloaded from github, ran the update script now I'm loading forever https://stats.tws-mc.com

edit: and nvm soon as I made this it worked lol. Except my server icon is broke and my server name displays twice

pdinklag commented 4 years ago

I get a 403 - Forbidden trying to open the server-icon.png. Did you change your .htaccess? The duplicate server name is because the icon cannot be loaded and the title of the image is displayed instead - which is the same as the server name.

lukeeexd commented 4 years ago

I did not. What should I looks like?

looks like this, whats inside my root of website, dont have one in the stats directory


RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html```
pdinklag commented 4 years ago

Hm, is there a server-icon.png file in your data directory? If not, maybe there is no read access to the server's icon file for whatever user copies it (update.py)?

lukeeexd commented 4 years ago

There is. And it opens to my servers icon. It has read, write and execute for user and group

pdinklag commented 4 years ago

Well, I don't know then.

https://stats.tws-mc.com/data/server-icon.png gives me a 403 error, which means your webserver does not allow access to it. I seriously can't help with that because it's the webserver configuration, nothing related to MinecraftStats. The only idea I got is a misconfigured .htaccess file, but yeah, nothing I can debug. Maybe check your webserver's logs, it may tell you why access is blocked.

lukeeexd commented 4 years ago

Tried to remove the server-icon line from index like I had before and it just breaks. Get a forever loading screen

pdinklag commented 4 years ago

Tried to remove the server-icon line from index like I had before and it just breaks. Get a forever loading screen

Yeah, because that breaks the script trying to access it.

lukeeexd commented 4 years ago

I fixed it by making www-data user and group own the image. It works now except running the update script shows this. Manually runing the script works but the cronjob is failing

  File "update.py", line 356, in <module>
    shutil.copy(args.server + '/server-icon.png', args.database)
  File "/usr/lib/python3.6/shutil.py", line 245, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.6/shutil.py", line 121, in copyfile
    with open(dst, 'wb') as fdst:
PermissionError: [Errno 13] Permission denied: 'data/server-icon.png'

It still updates the stat website and the icon is there.

Edit: seems to be working now when I changed the owner back

pdinklag commented 4 years ago

Edit: seems to be working now when I changed the owner back

Likely only because it's cached. Your webserver user needs to be able to read the file, but that should be enough usually. Try a chmod +r on it. Or make the owner www-data again and try chmod +w so the updater can write it.

I guess I'm starting to see the issue here. update.py writes the data directory and then naturally the executing user owns it. If your default access is very restrictive, the webserver can't read it. There's nothing I can do except put a note in the readme, which I will do.

lukeeexd commented 4 years ago

How can I remove the Icon without it breaking?

pdinklag commented 4 years ago

Use the browser console to find the code that errors when you remove it, and comment it out. But this is no solution.... something is configured badly on your webserver, you really shouldn't fix it by configuring something else badly as well.

Get your access rights correctly, then you don't need to remove it. Just make sure www-data can read the icon and update.py can write it. Try chmodding it to 777, that should usually do the trick, or make the update.py script user member of www-data and 774 will suffice. There are many options, don't pick the worst.

lukeeexd commented 4 years ago

Ok its fixed now. Now how do I make it not look like shit lol

lukeeexd commented 4 years ago

nvm broke again

pdinklag commented 4 years ago

Sorry, all I can do is stress again that you need to find out why https://stats.tws-mc.com/data/server-icon.png gives a 403. This and nothing else is what needs to be fixed. Check the webserver logs, check the access rights, not much I can do. 😕