Commit Graph

556 Commits

Author SHA1 Message Date
joeyak 7a294ea00f Move color and whoami commands into the commands declaration 2019-03-28 18:40:49 -04:00
Zorchenhimer fb2c25dc99 Add the /addemotes command
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).
2019-03-28 16:50:24 -04:00
Zorchenhimer 6f865b7a53 Start adding support to download twitch emotes
The code has been transferred over from the utility, and should work,
but it hasn't been tested nor has it been linked to the command.
2019-03-28 16:22:08 -04:00
Zorchenhimer d12434502e Put each CN- command constant on it's own line
This will help with merges that add/remove commands.
2019-03-28 16:21:23 -04:00
Zorchenhimer a8ee9db3b8 Fix #63, case-sensitive highlight
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.
2019-03-28 15:38:00 -04:00
Zorchenhimer 64a6b2943c Fix #70, name change on cancel
Don't send the /nick command if a user clicks on the "nick" button and
cancels out of the prompt.
2019-03-28 15:19:43 -04:00
Zorchenhimer e879112b1b Add some comments clarifying some things 2019-03-28 10:18:17 -04:00
Zorchenhimer 9bcbad6a07 Expand graceful shutdown to use http.Shutdown()
Not sure if this is better or not, but I'm testing it out.
2019-03-28 10:06:18 -04:00
Zorchenhimer b03329772e Fix fmt import error
Not sure how this happened.
2019-03-26 14:30:52 -04:00
Zorchenhimer f5ea701127 Add colon to the emote trim cutset
This enables parsing emotes in the format :emote: as defined in #9.
This does not add auto-complete, just brings emote parsing up to date.
2019-03-26 12:27:18 -04:00
Zorchenhimer 857974aef3 Merge branch 'master' into room-access-restrictions
# Conflicts:
#	main.go
#	settings.go
2019-03-26 12:06:25 -04:00
Zorchenhimer 8e27ce9332 Add /iplist to admin commands
Lists all clients' UUID's, names, and IPs to console.

# Conflicts:
#	chatcommands.go
#	common/chatcommands.go
2019-03-26 11:58:46 -04:00
Zorchenhimer d2b8f3d7be Remove panic()'s from setupSettings()
Now that this is in a called function, instead of an init(), return an
error instead of panicking.
2019-03-26 11:44:19 -04:00
Zorchenhimer 6018b67c25 Add tags file to .gitignore
Add the Vim tags file to the .gitignore.  It's an auto-generated file
that doesn't need to be in git.
2019-03-26 11:43:09 -04:00
joeyak 24b5152c38 Moving suggestion code to a separate file in prep for issue #9 2019-03-25 23:32:44 -04:00
Nick 93606fc478
Merge pull request #67 from zorchenhimer/noinit
Remove inits since it is startup code
2019-03-25 00:20:51 -04:00
joeyak f60bd33011 Remove inits since it is startup code 2019-03-24 23:54:24 -04:00
joeyak 86207ecd48 Added spoilers in chat
If a user clicks the spoiler, it will change color and the background will revert.
closes #62
2019-03-24 23:43:30 -04:00
joeyak d419f64379 goimports found a line with an extra tab 2019-03-24 20:09:55 -04:00
Zorchenhimer 5d10fdfea4 Forgot to remove a DevLogLn(), and two fixes
Good news, it breaks Travis like it's supposed to! I also forgot to add
the `common` namespace during a rebase.  Whoops.

Resolves #46
2019-03-24 19:03:19 -04:00
Zorchenhimer fdbf39f00c Add some logging
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.
2019-03-24 18:58:59 -04:00
joeyak cd34480bba Change auth level checking to be on command level
The server sends new auth level to user when modded
closes #60
2019-03-24 17:27:04 -04:00
joeyak 5c87d70d3e Change unlock to be consistant with the message break if 2019-03-24 17:12:04 -04:00
Zorchenhimer 60f3ade2ee Fix clientsMtx lock without unlock in Broadcast()
Reorganize the lock/unlock pairs to be more consistent and to fix a
case with an uneven lock/unlock.
2019-03-24 16:38:42 -04:00
Zorchenhimer 2f252d5ae8 Strip @ prefix on names in commands
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
2019-03-24 15:16:01 -04:00
Zorchenhimer 87f8839a33 Only send Chat and Event messages to temp clients
These should be the only messages that need to be sent to temp clients
for now.
2019-03-23 23:27:56 -04:00
Zorchenhimer f5f95efbcd Merge in some fixes from master 2019-03-23 18:14:57 -04:00
Zorchenhimer 37cf2f7811 Fix auto-scrolling with emotes
All emotes are set to have a height of 28px.  This fixes the
auto-scroll on message when the message has emotes, but it also forces
all emotes to be 28px high.
2019-03-23 18:13:55 -04:00
Zorchenhimer b4ae3fa9f8 Fix non-chat empty messages
Only refuse to send empty message data to the server if it is chat
data.  All other data types can be sent with an empty message (eg,
ping).
2019-03-23 18:10:32 -04:00
Zorchenhimer 07589e7099 Don't allow banning admins 2019-03-23 18:09:27 -04:00
Zorchenhimer 44e8947329 Print the new modes and pins to the console
- 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
2019-03-23 18:08:22 -04:00
Zorchenhimer 7448876299 Merge branch 'master' into room-access-restrictions
# Conflicts:
#	chatcommands.go
#	common/chatcommands.go
#	connection.go
#	static/css/site.css
#	static/main.html
2019-03-23 17:03:28 -04:00
Zorchenhimer d734ec110e Remove error'd temp connections
If there's an error writing to a temp connection, remove it from the
chatroom.
2019-03-23 16:54:05 -04:00
Zorchenhimer 88365b6df5 Add /iplist to admin commands
Lists all clients' UUID's, names, and IPs to console.
2019-03-23 16:53:36 -04:00
Zorchenhimer 6ef0d6f1a5 Add some debugging info to the client connection 2019-03-23 16:10:04 -04:00
joeyak 4864669df6 Add color checking and removed autoreconnect
closes issue #44
2019-03-23 15:37:48 -04:00
Zorchenhimer 8e39585968 Prevent some zero length stuff
Don't send zero length messages to the server, and ignore the /me
command without any arguments.
2019-03-23 15:16:02 -04:00
Zorchenhimer c0d3731b84 Write correct IP in WriteData() error
Return the correct IP address on error during
chatConnection.WirteData().  If the server is behind a reverse proxy,
the connection object will have "127.0.0.1" as the remote address.
2019-03-23 14:53:41 -04:00
Zorchenhimer f36a51bf2b Fix clearing the title
If no title is given with the /playing command, clear the title.
2019-03-23 14:53:29 -04:00
Zorchenhimer 62afc2eef9 Fixup ChatRoom.Broadcast()
Use an RW Mutex for chatConnection and use some goroutines when sending
data to clients in Broadcast().  This should prevent blocking on
unresponsive clients.
2019-03-23 14:50:47 -04:00
Zorchenhimer 0036dde265 Fix some typos
BroadCast() -> Broadcast()
startRmptServer() -> startRmtpServer()
2019-03-23 14:46:49 -04:00
Zorchenhimer 5c1fbe2a0b Write correct IP in WriteData() error
Return the correct IP address on error during
chatConnection.WirteData().  If the server is behind a reverse proxy,
the connection object will have "127.0.0.1" as the remote address.
2019-03-23 13:30:04 -04:00
joeyak da21234fca Fix formatting of golang template to be consistant. 2019-03-23 08:49:38 -04:00
joeyak a480c51454 Added reconnecting when websocket connection closes or errors
resolves #38
2019-03-22 23:32:52 -04:00
joeyak 970321b92a Adding example template of access requests and css 2019-03-22 22:38:58 -04:00
Zorchenhimer 82149cda0c Start adding room access restrictions
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.
2019-03-22 21:39:55 -04:00
joeyak bdfa75f8bc Added nick button and some cleanup
resolves #55
2019-03-21 23:01:21 -04:00
joeyak e770c0cb62 Remove vscode setup section and rename main_wasm.go back to main.go 2019-03-21 21:34:16 -04:00
joeyak 53e103302a Make messages div scroll all the way to the bottom
resolves #18
2019-03-21 21:20:29 -04:00
joeyak d13de4213f Fix chat width 2019-03-21 18:07:48 -04:00