Wrapping the connection with a mutex prevents the "concurrent write to
websocket connection" panic. The new functions are ReadData() and
WriteData so as to not collide with ReadJSON() and WriteJSON().
When typing @ a div will show up with all the chat names that match.
When up or down arrow keys are pressed, the highlight changes.
Tab handling is currently incomplete but the event is prevented.
issue #7
These messages are only sent to mods and admins for certain events:
- User gains mod/admin privileges
- User attempts to gain mod/admin privileges unsuccessfully
- Mod/Admin uses the /sv command
- Mod/Admin uses the /playing command
- Mod unmods themselves
- Mod/Admin mods/unmods a user
- Mod/Admin uses the /reloademotes command
- Mod/Admin uses the /reloadplayer command
A separate message queue is used for these messages, and they are only
sent to clients that are either a mod or an admin. They are sent
with the same call to ChatRoom.Broadcast(), but after all the normal
messages are sent.
Resolves#3
Removed two fmt.Sprintf() calls and a fmt.Printf() call. The Printf()
was for debugging and isn't needed anymore. Sprintf() apparently
isn't all that performant.
The broadcast code would lock up eventually after a lot of messages.
It was rewritten to simplify and make it a bit more robust. Chat
should no longer seize up for individual chatters or the entire room
after a lot of messages.
Single-use moderator passwords can only be generated by an admin with
the /modpass command. To redeem the password and gain moderator
privileges, a user just needs to call /auth with the password.
The passwords are generated using the same function as the admin
password. Additionally, generating passwords now uses crypto/rand
instead of math/rand.
Resolves#15
Implement some commands in the wasm client code:
- /playing (setting and clearing)
- /refreshplayer
Commands not yet implemented:
- /purge (command doesn't exist yet on server)
- /help (doesn't open window)
handlePublish, handlePlay, and handleDefault have been added in
handlers.go and removed as anonymous functions in main.go. This also
required moving some struct and variable definitions around a bit.
Instead of using a GET value in the URL, split on the path separators
and use the second element of the path as the key. This enables
putting the stream key in the appropriate settings in OBS, instead of
appending it to the stream URL manually.
This broke when moving to the standard library for escaping and
unescaping HTML. The original escaping code replaced "//" with
"&x2F;&x2F;" while the standard library doesn't.