aunefyren / wrapperr

Website based application that summarizes Plex statistics from a given period and displays it in a nice format. Similar to the Spotify Wrapped concept.
314 stars 22 forks source link

Session is not an admin session #79

Closed hjspencer closed 11 months ago

hjspencer commented 11 months ago

After creating an admin user I try to log in but I get the "Session is not an admin session" message I can see the admin.json file contains the admin username and I'm assuming the password has been encrypted

Running v3.2.2

My docker-compose contains the following wrapperr: container_name: wrapperr image: ghcr.io/aunefyren/wrapperr:latest hostname: wrapper restart: unless-stopped ports:

The wrapper.log contains the following root@wrapper:/app/config# cat wrapperr.log 2023/12/06 15:20:12 Config file does not exist. Creating. 2023/12/06 15:20:12 Running version v3.2.2. 2023/12/06 15:20:12 Starting Wrapperr on port 8282. 2023/12/06 15:20:12 Starting using HTTP. 2023/12/06 15:21:49 Admin config file does not exist. Creating. 2023/12/06 15:21:49 Retrieved Wrapperr version. - Origin: 192.168.1.131 2023/12/06 15:21:52 Retrieved Wrapperr version. - Origin: 192.168.1.131 2023/12/06 15:21:53 Retrieved Wrapperr admin state. - Origin: 192.168.1.131 2023/12/06 15:22:17 New admin account created. Server is now claimed. 2023/12/06 15:22:17 Retrieved Wrapperr version. - Origin: 192.168.1.131 2023/12/06 15:22:17 Retrieved Wrapperr admin state. - Origin: 192.168.1.131 2023/12/06 15:22:23 Created and retrieved admin login JWT Token. - Origin: 192.168.1.131 2023/12/06 15:22:23 Retrieved Wrapperr version. - Origin: 192.168.1.131 2023/12/06 15:22:23 Retrieved Wrapperr admin state. - Origin: 192.168.1.131

aunefyren commented 11 months ago

Hey, thanks for opening an issue.

Where exactly does it say session is not an admin session? Is it when logging in using your newly created admin account on the /admin page?

hjspencer commented 11 months ago

Hi, I created a new container and as soon as I create an admin user it prompts for the admin credentials. It's when I supply these and try to login. Got a feeling it's more to do with the docker instance as I've just tried it on a different docker host and it worked fine

hjspencer commented 11 months ago

I've just fully removed the container and image and re-created them. same thing on this docker host. The logs from the container

Log file set. 2023/12/07 15:12:09 Running version v3.2.2. 2023/12/07 15:12:09 Starting Wrapperr on port 8282. 2023/12/07 15:12:09 Starting using HTTP. 2023/12/07 15:12:29 Admin config file does not exist. Creating. 2023/12/07 15:12:29 Retrieved Wrapperr version. - Origin: 192.168.1.131 [GIN] 2023/12/07 - 15:12:29 | 200 | 3.869262ms | 192.168.1.131 | POST "/api/get/wrapperr-version" [GIN] 2023/12/07 - 15:12:35 | 200 | 693.145µs | 192.168.1.131 | GET "/admin" [GIN] 2023/12/07 - 15:12:36 | 200 | 16.325452ms | 192.168.1.131 | GET "/assets/css/admin.css" 2023/12/07 15:12:36 Retrieved Wrapperr version. - Origin: 192.168.1.131 [GIN] 2023/12/07 - 15:12:36 | 200 | 2.109565ms | 192.168.1.131 | POST "/api/get/wrapperr-version" 2023/12/07 15:12:36 Retrieved Wrapperr admin state. - Origin: 192.168.1.131 [GIN] 2023/12/07 - 15:12:36 | 200 | 727.794µs | 192.168.1.131 | POST "/api/get/admin-state" 2023/12/07 15:12:46 New admin account created. Server is now claimed. [GIN] 2023/12/07 - 15:12:46 | 201 | 6.660769ms | 192.168.1.131 | POST "/api/create/admin" [GIN] 2023/12/07 - 15:12:46 | 200 | 297.48µs | 192.168.1.131 | GET "/admin" 2023/12/07 15:12:46 Retrieved Wrapperr version. - Origin: 192.168.1.131 [GIN] 2023/12/07 - 15:12:46 | 200 | 3.897096ms | 192.168.1.131 | POST "/api/get/wrapperr-version" 2023/12/07 15:12:46 Retrieved Wrapperr admin state. - Origin: 192.168.1.131 [GIN] 2023/12/07 - 15:12:46 | 200 | 474.221µs | 192.168.1.131 | POST "/api/get/admin-state" 2023/12/07 15:12:53 Created and retrieved admin login JWT Token. - Origin: 192.168.1.131 [GIN] 2023/12/07 - 15:12:53 | 200 | 6.267864ms | 192.168.1.131 | POST "/api/login/admin" [GIN] 2023/12/07 - 15:12:53 | 200 | 330.072µs | 192.168.1.131 | GET "/admin" 2023/12/07 15:12:53 Retrieved Wrapperr version. - Origin: 192.168.1.131 [GIN] 2023/12/07 - 15:12:53 | 200 | 3.556541ms | 192.168.1.131 | POST "/api/get/wrapperr-version" 2023/12/07 15:12:53 Retrieved Wrapperr admin state. - Origin: 192.168.1.131 [GIN] 2023/12/07 - 15:12:53 | 200 | 334.036µs | 192.168.1.131 | POST "/api/get/admin-state" [GIN] 2023/12/07 - 15:12:53 | 401 | 2.462675ms | 192.168.1.131 | POST "/api/validate/admin"

aunefyren commented 11 months ago

Huh, very odd. That error should only happen when the login JWT is valid, but not created as an admin, therefore not for the admin page.

The only thing suspicious of your docker compose is that you do not mount the /app/config, meaning a restart deletes your config. But it should work initially.

Can you post a redacted version of your config.json? Can you confirm admin.json is filled with username and a hashed password?

hjspencer commented 11 months ago

Hi, I had config mounted using a previous version and that all worked fine. It's just when I updated the container to the latest version Though checking the docker info in teh wiki I've noticed I had the config folder mounted as /config not /app/config Updated this and it's sorted. Sorry for any confusion

hjspencer commented 11 months ago

Down to my stupidity for not checking docker config

aunefyren commented 11 months ago

No worries, I've been there 😁