JohnXLivingston / peertube-plugin-livechat

GNU Affero General Public License v3.0
90 stars 26 forks source link

Participants list shows recent chatters instead of only room occupants #506

Open vencabot opened 3 weeks ago

vencabot commented 3 weeks ago

Describe the bug Users who are not in the XMPP room show in the Participants list if they have a message in the loaded chat history. This is why it is regularly populated by many usernames of users who are not actually present.

To Reproduce Steps to reproduce the behavior:

  1. Go to an offline video / live with a chat which no one is watching, but where users were chatting previously.
  2. Observe that the participants list shows an entry for everyone who has messages in the chat history.
  3. Scroll the chat up to load more messages (if the configured chat history is long enough).
  4. If loading older messages shows posts from users who were not in the Participants list before, they suddenly appear there.

Expected behavior The participants list should be a list of XMPP users in the room. They should be removed from the room if their client doesn't respond to a regular ping.

Screenshots I've recorded a very short video demonstrating the issue.

https://tube.vencabot.com/w/8LcVq1ffUpuVjECYsqyh5U

Server (please complete the following information):

Desktop (please complete the following information):

Additional context I've been writing my own XMPP bot to interact with the livechat and doing lots of tests. I noticed that, when my bot users 'join' the room, they appear in the list of participants -- and when they 'leave' the room, they disappear from the list -- but then, when I reload the page, they're back in the participants list. I was trying to figure out why this is, and that's when I discovered this behavior. So, it does seem that the 'Participants' list includes users as they enter the room (I don't think they need to send a message) and it DOES remove them when they leave, but the bug seems to be that it adds users to the participants list when their chat messages are loaded, even if the actual user is long gone, so reloading the page populates the participants list with lots of users who have already left.

Maybe you're already familiar with this issue, in which case I apologize. I've become quite familiar with XMPP and Prosody by now, so if I can help in any way by doing more tests, trying different configurations, etc., please let me know. As always, thank you for everything that you've done for many instances like mine.

JohnXLivingston commented 3 weeks ago

Maybe you're already familiar with this issue, in which case I apologize. I've become quite familiar with XMPP and Prosody by now, so if I can help in any way by doing more tests, trying different configurations, etc., please let me know. As always, thank you for everything that you've done for many instances like mine.

Yes, I knew about this bug. In the coming v11, this will be usefull for moderators (because of 2 new features: "search all participant messages", and "add notes to participant". The v11 will also include filters: you will be able to filter on the nickname, or on the online status.

Maybe i will make the "online" filter active by default.

You can test that here: https://videos.john-livingston.fr/p/livechat/room?room=c5d20adf-1088-4d40-bbfc-1abb42d20b05

(the filter option is in the menu at the top of participant list)

vencabot commented 3 weeks ago

Oh, I see! Yes, having a list of all of the recent chatters isn't a bad thing at all. Having it default to only showing 'online' chatters would be great, and I can definitely see how being able to change the filter to show all recent poster's would be good, too, especially if you could do moderation actions in that pane (which I presume is what this update will be implementing).

As always, thank you for everything, sir!

JohnXLivingston commented 2 weeks ago

I've been writing my own XMPP bot to interact with the livechat and doing lots of tests

How do you connect your bot to the chat? Did you notice that you can now generate a password to connect it as a Peertube user?

This is not documented yet, but it is working.

If your bot can use websocket connection (Client 2 Server connections), nothing to do on the server (just use wss://example.com/plugins/livechat/ws/xmpp-websocket as server url).

To get the credentials: the new OBS Dock feature (https://livingston.frama.io/peertube-plugin-livechat/documentation/user/obs/#obs-dock) can be used to get some long term login/password to connect to your Peertube account. You can simply click on the button, and copy the login/password from the generated url.

There is an issue with this: if you generate multiple tokens, you have a risk to delete the one you are using by accident. To prevent that, you can change the name of the token: inspect your browser network request when you create a token, use the "copy as curl" function of your browser, paste the curl command in a terminal, and just change the label of the token.

For example, in my testing env, i added a token named "XMPP client".

vencabot commented 2 weeks ago

This sounds like a super useful feature!

In my case, I'm connecting my bot as an 'external component', since an external component can send messages 'from' any account -- including, crucially, accounts that don't exist.

So, when "JohnXLivingston" sends a message to the Twitch chat, my bot:

Since my bot is an external component, Prosody doesn't check to see if JohnXLivingston@bridge.tube.vencabot.com exists or anything like that. It's very convenient!

Now I'm working on a feature to download user's avatars from Twitch to use them as their Peertube livechat avatars, too! :D Once the bot is complete, I'll publish the source code. Since it requires having 'external component' access to Prosody and it requires a Twitch bot developer access token, I don't know how useful it would be to other streamers, but maybe!

JohnXLivingston commented 2 weeks ago

Now I'm working on a feature to download user's avatars from Twitch to use them as their Peertube livechat avatars, too! :D Once the bot is complete, I'll publish the source code. Since it requires having 'external component' access to Prosody and it requires a Twitch bot developer access token, I don't know how useful it would be to other streamers, but maybe!

Once it is published, don't hesitate to add a page in the livechat documentation.

For the record, i recently heard about Biboumi, a XMPP>IRC gateway. It is also an XMPP external component. Maybe another way to bridge to twitch (if i remember correctly, twitch uses IRC).