rommapp / romm

A beautiful, powerful, self-hosted rom manager
https://romm.app
GNU Affero General Public License v3.0
2.52k stars 103 forks source link

[Bug] Custom Covers not saved #1169

Closed Skeeve closed 2 months ago

Skeeve commented 2 months ago

RomM version

# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
rommapp/romm        latest              ecf0a0def09b        3 days ago          289MB
mariadb             latest              92520f86618b        2 weeks ago         407MB

Describe the bug I'm trying to set a cover of a game but it's not saved.

To Reproduce Steps to reproduce the behavior:

  1. Go to a game
  2. Click on "Edit"
  3. Click on the "pencil" of the cover
  4. Select an image
  5. See the image as the new cover
  6. Click "Save"
  7. Note the "success"-message
  8. Wonder why no cover is shown

Expected behavior After saving the cover should be shown

Screenshots

Here are the logs of my action:

romm       | 192.168.192.72:0 - "GET /api/roms/230 HTTP/1.0" 200
romm       | INFO:    [nginx][2024-09-04 13:03:31]  192.168.192.72 - - "GET /api/roms/230 HTTP/1.1" 200 1365 "http://kodiwyse.local:6464/rom/230" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36" rt=0.141 uct="0.000" uht="0.140" urt="0.141"
romm       | 192.168.192.72:0 - "GET /api/platforms/95 HTTP/1.0" 200
romm       | INFO:    [nginx][2024-09-04 13:03:32]  192.168.192.72 - - "GET /api/platforms/95 HTTP/1.1" 200 217 "http://kodiwyse.local:6464/rom/230" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36" rt=0.060 uct="0.000" uht="0.060" urt="0.060"
romm       | 2024/09/04 13:03:32 [error] 27#27: *273 directory index of "/var/www/html/assets/romm/resources/" is forbidden, client: 192.168.192.72, server: localhost, request: "GET /assets/romm/resources/?ts=2024-09-04T13:02:30 HTTP/1.1", host: "kodiwyse.local:6464", referrer: "http://kodiwyse.local:6464/rom/230"
romm       | INFO:    [nginx][2024-09-04 13:03:32]  192.168.192.72 - - "GET /assets/romm/resources/?ts=2024-09-04T13:02:30 HTTP/1.1" 403 555 "http://kodiwyse.local:6464/rom/230" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36" rt=0.000 uct="-" uht="-" urt="-"
romm       | INFO:    [nginx][2024-09-04 13:03:32]  192.168.192.72 - - "GET /assets/platforms/undefined.ico HTTP/1.1" 404 555 "http://kodiwyse.local:6464/rom/230" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36" rt=0.000 uct="-" uht="-" urt="-"
romm       | WARNING:  [RomM][2024-09-04 13:03:59] Couldn't remove cover from 'In the Dark 2' since '/romm/resources/roms/95/230/cover' doesn't exists.
romm       | 192.168.192.72:0 - "PUT /api/roms/230?rename_as_source=false&remove_cover=true&unmatch_metadata=false HTTP/1.0" 200
romm       | INFO:    [nginx][2024-09-04 13:03:59]  192.168.192.72 - - "PUT /api/roms/230?rename_as_source=false&remove_cover=true&unmatch_metadata=false HTTP/1.1" 200 1366 "http://kodiwyse.local:6464/rom/230" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36" rt=0.241 uct="0.000" uht="0.216" urt="0.216"
romm       | 2024/09/04 13:03:59 [error] 28#28: *269 directory index of "/var/www/html/assets/romm/resources/" is forbidden, client: 192.168.192.72, server: localhost, request: "GET /assets/romm/resources/?ts=2024-09-04T13:03:59 HTTP/1.1", host: "kodiwyse.local:6464", referrer: "http://kodiwyse.local:6464/rom/230"
romm       | INFO:    [nginx][2024-09-04 13:03:59]  192.168.192.72 - - "GET /assets/romm/resources/?ts=2024-09-04T13:03:59 HTTP/1.1" 403 555 "http://kodiwyse.local:6464/rom/230" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36" rt=0.000 uct="-" uht="-" urt="-"

Desktop (please complete the following information):

Smartphone (please complete the following information):

Not used

gantoine commented 2 months ago

romm | WARNING: [RomM][2024-09-04 13:03:59] Couldn't remove cover from 'In the Dark 2' since '/romm/resources/roms/95/230/cover' doesn't exists.

That's a new one, usually it needs to delete the old image before uploading a new one, but it can't seem to find it. Between this and your other issue, there might be something wonky with your setup. Can you verify that the perms for the resources mount is correct?

Skeeve commented 2 months ago

What should the permissions be?

My setup is like this:

/media/INTSENSO as a vfat mount on a machine running LibreElec with the Docker-Plugin.

Everything is owned by root.

Maybe that's not a good idea?

gantoine commented 2 months ago

No that should be fine, though libreelec is an interesting choice! Can you post your docker compose here, hiding any sensitive info/keys?

Skeeve commented 2 months ago
volumes:
  mysql_data:
  romm_resources:
  romm_redis_data:

services:
  romm:
    image: rommapp/romm:latest
    container_name: romm
    restart: unless-stopped
    environment:
      - DB_HOST=romm-db
      - DB_NAME=romm # Should match MYSQL_DATABASE in mariadb
      - DB_USER=romm-user # Should match MYSQL_USER in mariadb
      - DB_PASSWD=***
      - ROMM_AUTH_SECRET_KEY=*** # Generate a key with `openssl rand -hex 32`
      - IGDB_CLIENT_ID=*** # Generate an ID and SECRET in IGDB app:igdb_***
      - IGDB_CLIENT_SECRET=*** # https://api-docs.igdb.com/#account-creation
      - MOBYGAMES_API_KEY=moby_*** # https://www.mobygames.com/info/api/
      - STEAMGRIDDB_API_KEY # https://github.com/rommapp/romm/wiki/Generate-API-Keys#steamgriddb
    volumes:
      - romm_resources:/romm/resources # Resources fetched from IGDB (covers, screenshots, etc.)
      - romm_redis_data:/redis-data # Cached data for background tasks
      - /media/INTENSO/romm/library:/romm/library # Your game library
      - /media/INTENSO/romm/assets:/romm/assets # Uploaded saves, states, etc.
      - /media/INTENSO/romm/config:/romm/config # Path where config.yml is stored
    ports:
      - 6464:8080
    depends_on:
      - romm-db

  romm-db:
    image: mariadb:latest # if you experience issues, try: linuxserver/mariadb:latest
    container_name: romm-db
    restart: unless-stopped
    environment:
      - MYSQL_ROOT_PASSWORD=***
      - MYSQL_DATABASE=romm
      - MYSQL_USER=romm-user
      - MYSQL_PASSWORD=***
    volumes:
      - mysql_data:/var/lib/mysql
Skeeve commented 2 months ago

libreelec is an interesting choice!

It's a machine (a wyse thin client) I got cheap and which is running 24/7. So it seemed to me like a logical choice.

I could have used my QNAP NAS as well…

Skeeve commented 2 months ago

The funny(?) thing is: There is no cover-info for that game in the database as far as I can tell:

id igdb_id sgdb_id file_name file_name_no_tags file_extension file_path name slug summary path_cover_s path_cover_l revision tags multi files url_cover url_screenshots path_screenshots regions languages file_name_no_ext file_size_bytes igdb_metadata platform_id moby_id moby_metadata created_at updated_at crc_hash md5_hash sha1_hash
230 56978 (null) In the Dark 2.zip In the Dark 2 zip roms/gbc In the Dark 2 (null) [] false [{"filename": "In the Dark 2.zip", "size": 619348, "last_modified": 1725440980.0}] [] [] [] [] In the Dark 2 619348 {} 95 (null) {} 2024-09-04 09:10:01 2024-09-04 13:31:38 6bf67f40 38107b482050376f7b92fbf1ffb512a5 3115a7831a69cebeff5e7a2377f2ca6fd15bfe47

(BTW: I removed the wrong tags mentioned in #1170.)

Skeeve commented 2 months ago

I created /romm/resources/roms/95/255/cover and the error message is gone when saving the custom cover.

But still the custom cover is not saved.

Also /romm/resources/roms/95/255/cover is gone after saving the custom cover.

$ docker exec -it 22f03bdd7bf6 sh
/romm # ls -al /romm/resources/roms/95/255/cover
ls: /romm/resources/roms/95/255/cover: No such file or directory
/romm # mkdir /romm/resources/roms/95/255/cover
/romm # ls -al /romm/resources/roms/95/255/cover
total 8
drwxr-xr-x    2 root     root          4096 Sep  5 12:55 .
drwxr-xr-x    3 root     root          4096 Sep  5 12:55 ..

Saving custom cover here

romm       | 192.168.192.72:0 - "PUT /api/roms/255?rename_as_source=false&remove_cover=true&unmatch_metadata=false HTTP/1.0" 200
romm       | INFO:    [nginx][2024-09-05 12:55:30]  192.168.192.72 - - "PUT /api/roms/255?rename_as_source=false&remove_cover=true&unmatch_metadata=false HTTP/1.1" 200 555 "http://kodiwyse.local:6464/rom/255" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36" rt=0.216 uct="0.000" uht="0.208" urt="0.209"

Looking into container:

/romm # ls -al /romm/resources/roms/95/255/cover
ls: /romm/resources/roms/95/255/cover: No such file or directory
Skeeve commented 2 months ago

Seems the image file is not even sent to the server!

I overlooked "artwork: (binary)".

image

So no wonder nothing is saved.

Skeeve commented 2 months ago

I tried matching the game against any other game so that I have any cover at all.

Then I tried to replace the cover with the one I really want to have and I noticed in the web console of my browser a 403 forbidden:

image

Not to mention: The new cover wasn't stored at all.

adamantike commented 2 months ago

I found the issue, but with different steps than what you reported.

If I go to a game, click on "Edit", then click on "Delete cover" (trash icon), and after that I click on the pencil and add a new image, I get the behavior you are experiencing.

The key here is that clicking on the "Delete cover" button first sets "remove_cover = true" to be sent in the request. When that parameter is received by the backend, it deletes the existing cover, and doesn't set a new one, even if it received it.

Can you confirm if you get the right behavior, if you do not use "Delete cover", and just click on the pencil, add a new cover, and click "Save"?

I'll upload a fix so that using the pencil button restarts the removeCover attribute to false.

Skeeve commented 2 months ago

I never clicked "Delete cover" as I had none.

When doing the experiment with matching with any game I alos didn't click delete if I remember correctly.

But I will test it anyway now again.

Tested and not clicking the trash icon made no difference.

remove_cover=true is set. In the web console as well as in the logs.

Skeeve commented 2 months ago

Works!