- Move mutex into Settings struct
- Replace sync.Mutex with a sync.RWMutex
- Move adding approved emotes into a Settings method
- Save settings after adding emotes
- Wrap saving in a lock
It's ugly, but it get's the job done. This list will need to be
improved a lot (ie, make it searchable and maybe even clickable
emotes?). This is for #99, but should not be considered fixed yet.
Don't reload emotes directly into the global common.Emotes variable.
Instead, load them into a new variable and write that to common.Emotes
after the search for new emotes completes. Emotes should no longer
duplicate for each run of `/reloademotes`.
Also tweaked `/addemotes` to automatically reload emotes if nothing went
wrong downloading a new set.
This reworks how emotes are cached in relation to their physical
location on disk. Functionally, they should be the same from the user
perspective but it sets up some stuff that will make it easier to add
emotes from various sources.
Added a few more stats to keep track of:
- Max users in chat
- Stream start
Also added a `/stats` command to list the user count (current and max),
as well as uptime (sever and stream, separately).
Resolves#85
Temp connections were removed to reduce some complexity. Now a
connection is a full client, even before joining chat. A name is
required to be set to join chat and receive messages.
This change also removes the need for UUIDs on connections and clients.
Change the function signature for commands to return a string as well as
an error. Currently, errors are handled no differently than normal
response messages.
Also removed the redundant `/setpin` command.
Merge in the room access restrictions changes into master. Currently,
only the PIN/Password method is implemented, and it's not all that
secure. Some more work needs to be done in planning before really
moving forward, but this should be fine for now.
Issue #28 should not be considered finished with this merge.
This should fix#65, although it may be expanded in the future.
Default settings for limits can be changed or disabled in the settings.
Default values:
- Chat: 1 second
- Duplicate chat: 30 seconds
- /nick: 5 minutes
- /auth: 5 seconds
- /color: 1 minute
Creation of the chat Client object has been moved from ChatRoom.Join()
to NewClient(). This function also handles setting the initial name.
This command launches a goroutine that does the actual downloading of
the emotes so the client doesn't hang until the process is finished.
subscribers.json needs to be manually downloaded and added next to the
main executable for now. Eventually, it will download and cache this
file (for 24 hours, at a minimum).
Issue #10 should not be considered finished yet. This needs to be
tested a bit more with multiple channels. Ideally, some that exist and
some that don't to verify that it fails gracefully (ie, adds the emotes
it was able to download).
Functions added:
- LogErrorf()
- LogErrorln()
- LogChatf()
- LogChatln()
- LogInfof()
- LogInfoln()
- LogDebugf()
- LogDebugln()
- LogDevf()
- LogDevln()
New settings configure the logging: LogLevel and LogFile. LogLevel can
be set to one of: error, chat, info, or debug and will default to
error. LogFile is an optional file to write to. Providing a file will
not prevent output in the console.
LogDevf() and LogDevln() only compile when the "dev" flag passed to
build. This will cause Travis-CI to fail the build if it finds any
calls to either function.
Names can be passed to commands with @ prefixed to them.
When forcing a color change on another user the @ explicitly defines
the name, instead of simply being stripped off. This will allow the
a user named "red" to have their color changed: `/color @red blue`
A bunch of the color command code has changed with this to make things
less ambiguous and to add some other checks. `/color red #FF0000` and
`/color @red red` will change the color of the user "red" to the color
red while `/color red red`will return with an error. Note that the
color an name arguments can be in any order.
Resolves#64
- When the access mode changes, print the new mode (and pin, if
applicable) to the server console.
- Don't return an HTTP error when getting a session fails, just make a
new session.
- Save pins to the settings
So far only PIN and Open modes are implemented. It uses a session
cookie to store the validity of the pin/password.
The "Enter pin" page has some unreadable messages on it right now, but
it kinda works.
Moved to common/utils.go:
- IsValidName() (function replaces direct calls to regexp.MatchString())
- RandomColor()
Moved to common/emotes.go:
- LoadEmotes()
Using this command will change the current user's nickname in chat.
It has an alias of /name.
An admin can force a name change by supplying the current name and a new
name. If a name has been changed by an admin, that user can no longer
change their name (similar to forced color change).
Resolves#42
Added a limit to how long the title can be when set from the /playing
command. The default value is 50 if it is not in the settings file or
if the value in the settings is below zero.
Resolves#43
Move the help html to a template and populate the lists dynamically.
This also splits out the base HTML stuff (eg, the <html> and <body>
tags) to a base template file.
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
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