Commit Graph

56 Commits

Author SHA1 Message Date
Zorchenhimer a73375f152 Fix emotes
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.
2019-06-18 22:13:53 -04:00
joeyak 7962fad02e commiting so zorch can do my work 2019-06-01 19:41:28 -04:00
joeyak c3f2c20e4e Add rand seed so the colors aren't the same 2019-04-14 21:02:44 -04:00
joeyak 7b5f77a14a Get rid of dependency on go-colorful
closes #84
2019-04-14 01:46:24 -04:00
Zorchenhimer 607e61234c Add some more stats
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
2019-04-14 00:25:49 -04:00
Zorchenhimer 83477dc0eb Start abstracting template stuff
This is for #32.

This adds a starting framework for loading, caching, and executing
templates on the server and the client.  Currently only the server uses
this functionality.
2019-04-13 17:29:30 -04:00
joeyak ad2579d59a Adding some hardening to user joining
Client sends the server a object to join instead of a message
server can send a message to notify the user

closes #57
2019-04-13 13:12:08 -04:00
Zorchenhimer 81e647c1c8 Handle command errors differently than responses
Make them red.
2019-04-11 22:01:10 -04:00
Zorchenhimer 5508dc3f1c Return errors from commands
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.
2019-04-11 21:10:04 -04:00
Zorchenhimer 34d8fbf20c Merge branch 'master' into room-access-restrictions
# Conflicts:
#	main.go
2019-03-30 17:45:39 -04:00
Zorchenhimer 2acf382f1f Add some tests for emote parsing 2019-03-30 17:19:14 -04:00
joeyak e5f1598cd0 Add color dropdown
issue #69
2019-03-30 17:01:44 -04:00
Zorchenhimer 4e35418a79 Merge branch 'master' into room-access-restrictions
# Conflicts:
#	common/chatcommands.go
#	main.go
#	settings.go
2019-03-30 16:04:06 -04:00
Zorchenhimer 0ff872065f Fix trimming characters on non-emote words
Don't trim anything from non-emote words when parsing emotes.
2019-03-30 15:41:33 -04:00
joeyak ca72dc28c0 Add autocomplete for emotes
closes #9
2019-03-30 15:23:54 -04:00
joeyak 10092e1dd5 Change wrappers to div so client can add to beginning and end of message
issue #66
2019-03-28 20:25:46 -04:00
joeyak 8e4ac4d600 Add color cookies
closes #6
2019-03-28 20:01:48 -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 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
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
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
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 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 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 88365b6df5 Add /iplist to admin commands
Lists all clients' UUID's, names, and IPs to console.
2019-03-23 16:53:36 -04:00
joeyak 4864669df6 Add color checking and removed autoreconnect
closes issue #44
2019-03-23 15:37:48 -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 355f09bd48 Refactoring of ChatData
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.
2019-03-21 08:47:40 -04:00
joeyak 1cfa040f7b Added color names as possible arguements for /color
Did some linting fixing too.
Closes #45
2019-03-19 22:56:01 -04:00
Zorchenhimer 49e997c5ff Move some stuff to MovieNight.common
Moved to common/utils.go:
- IsValidName() (function replaces direct calls to regexp.MatchString())
- RandomColor()

Moved to common/emotes.go:
- LoadEmotes()
2019-03-19 17:25:49 -04:00
Zorchenhimer 1c6c23da3e Add /nick command
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
2019-03-19 17:13:20 -04:00
Zorchenhimer 0b05a7aea6 Add the /purge command
This is a moderator command that clears chat for everybody.

Resolves #5
2019-03-17 22:30:00 -04:00
Zorchenhimer 7dff29b152 Add user badges
Add badges for admins and mods.  Admins get a red badge, and mods get a
green one.

Normal users do not get a badge.
2019-03-16 18:11:27 -04:00
Zorchenhimer d0cd90e7af Properly implement the help popup
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.
2019-03-16 16:15:55 -04:00
Zorchenhimer e94ceda655 Fix the command response
Respond to commands with the output of the command, not the command
received.  Also, don't use the server message formatting.
2019-03-16 14:37:34 -04:00
Zorchenhimer 80be38128f Wasm client pings the server every second
This prevents disconnects when the server is behind Nignx.  Resolves
#35.
2019-03-16 14:12:25 -04:00
joeyak a717c6ef38 Converting from conn.WriteMessage to conn.WriteJson
This takes away some of the work on the developers side to worry about parsing the object as a json string.
Backend work for issue #7
2019-03-15 17:28:29 -04:00
Zorchenhimer 28d43a726a Add Mod notice messages
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
2019-03-15 16:03:31 -04:00
joeyak 678ccab95c Add some backend infrastructure
The server can now send the client objects with data for the client to process.
issue #7
2019-03-15 02:19:16 -04:00
joeyak 5554780438 More cleanup and organizing of code to ease with readability
move encode funcs to be with structs
moved constants to a separate file
2019-03-14 23:13:42 -04:00
joeyak 7ce14819e8 moved funcs to be with corresponding structs 2019-03-14 23:08:22 -04:00
joeyak 60dd98a1e7 Add infrastructure for the client to send formatted data to the server 2019-03-14 15:21:53 -04:00