Commit Graph

73 Commits

Author SHA1 Message Date
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
Zorchenhimer 653ff6fc9c Some performance tweaks to the wasm code
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.
2019-03-14 10:12:21 -04:00
joeyak fc126d599e Fix broken multi alias commands
fixes #25
2019-03-14 00:21:41 -04:00
joeyak 2ef3684c14 Some linting fixes for the common package 2019-03-13 21:24:14 -04:00
Zorchenhimer 4025622415 Wrap message lines in <div> blocks
This was changed in master, but was overwritten in the merge (html
generation moved).
2019-03-13 14:10:45 -04:00
Zorchenhimer bdd4e71261 Flesh out the JSON stuff a bit more
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)
2019-03-13 13:42:38 -04:00
Zorchenhimer 9c80269943 Start convert to JSON data b/t client and server
Chat and events should work.  Commands do not work yet.  Everything
also needs to be tested and cleaned up a bunch more.
2019-03-13 01:09:24 -04:00