Fix name highlighting when emotes are involved. When the emotes were
moved to subfolders the channel name was put into the URL of the emote
image. If a user with that name joined the chat, all of the emotes in
that folder highlighted the name in the URL, breaking the <img> tag.
This change removes the regex used to identify and replace the user's
name and instead works on whole words delimited by spaces.
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.
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.
Make the name highlight code case-insensitive, and only match whole
words.
This fixes an unreported issue with emotes. If a user's name was in
an emote, the emote image was broken by placing the highlight span in
the image's url attribute.
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.
The processing of ChatData was changed so ChatData has a DataInterface object, which will be converted to a
ChatDataJSON that will have the DataInterface field converted to a json.RawMessage field. This change allows
greater customizability in the chat messages, since the Data field can still be read and modified.
Parse the X-Forwarded-For header if it exists in the connection. This
will allow bans to work if the server is sitting behind an Nginx
reverse proxy (that has been configured to add the header).
Also added a safe-guard to disallow bans for localhost so you cannot
accidentally ban everybody from connecting if the server is behind a
reverse proxy.
This should resolve#49
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
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().
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)
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.