RblSb / SyncTube

Synchronized video viewing with chat and other features (one-channel web service)
MIT License
247 stars 52 forks source link

Docker WebUI: State reset after container stopped #43

Open mm10079 opened 1 year ago

mm10079 commented 1 year ago

I set "admins": ["username"] in config.json but when use webUI login admin user, I still cant do anything. This is my config.json setting: { "permissions": { "banned": [], "guest": ["writeChat"], "user": ["guest"], "leader": ["user"], "admin": ["user", "clearChat", "setLeader", "lockPlaylist", "banClient"] }, "admins": ["username"] } I use synctube on Turenas scale docker I tried to set admin user in user.josn,but user.json will reset when docker reboot.

RblSb commented 1 year ago

Can you use server console after running synctube? If you run node build/server.js in synctube folder, synctube should start, and you will see synctube cli, where you can send any text to see list of server commands. If you run here /addAdmin Name password, then it should add admin to user/users.json

image
mm10079 commented 1 year ago

Add Admin successful,but still appear Access Error on the webUI. image image maybe I should change or should not change something in config.json

RblSb commented 1 year ago

You probably trying to make action that is out of your user group permissions (I will make errors more verbose). Is this error happens when you trying to write to chat or something else? You can send me your user/config.json, so i will try to reproduce this problem and say whats wrong here.

mm10079 commented 1 year ago

I'm trying to make the administrator the only one who has permission to control video playback and add videos So I removed the rest of the privileges for normal users, like in config.json image I don't understand how to divide the privileges of administrators and general users Maybe remove the guest's permissions is a mistake

RblSb commented 1 year ago

You need to move guest privileges to level up, so they will be available for admin, for example:

    "permissions": {
        "banned": [],
        "guest": ["writeChat"],
        "user": ["guest"],
        "leader": ["user"],
        "admin": ["user", "addVideo", "removeVideo", "changeOrder", "toggleItemType", "requestLeader", "rewind", "clearChat", "setLeader", "lockPlaylist", "banClient"]
    },

So in this case you should not get Access error when you add video as admin. Remember to restart server after changing config. Also remember that you can be detected as admin (blue nickname in userlist) when you run server locally, and you ip is equal to server ip. This can be disabled with "localAdmins": false in config.

mm10079 commented 1 year ago

After I restart docker on webUI, user.json will lost all change. I tried use cli to kill old pod and start new pod, but it will make docker crush.

RblSb commented 1 year ago

I think you are running container without v (volume) argument, that mounts folder to keep data, instead of cleaning it at container exit. Not sure how to web ui works, but in cli container start is: docker run --rm -it -p 4200:4200 -v ${PWD}/user:/usr/src/app/user synctube So there is user folder mounted to write server state outside of temp container. If chat messages are keeped in history after container restart, then it working.

mm10079 commented 1 year ago

I have been set this host path setting for volume, so my config.json not be remove. Just user.json be reset image

RblSb commented 1 year ago

I think there is no volume to user folder outside of container, so you are:

I just tested run instructions, and they works for me. I'm a not docker user, since it eats 10 GB for nothing, when you can have 60 MB node server setup. Have no idea if something should be changed to support WebUI too.

mm10079 commented 1 year ago

I think I set the right volume on the webUI, I can see the new admin have been add in myPC/user/user.json. The user.json will be reset when I stop container not after run container. Maybe this is a bug of turecharts docker setting. I will try other way. Thank your help a lot.