Commit Graph

300 Commits

Author SHA1 Message Date
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 33163a3392 Fix some minor readme linting errors 2019-03-20 23:50:18 -04:00
joeyak 3915c3491c Add setup information for vscode 2019-03-20 23:45:22 -04:00
joeyak f456da937b goimports fixed this 2019-03-20 21:25:01 -04:00
Zorchenhimer 990060fb31 Fix removing clients from the clients map
ChatRoom.delClient() wasn't updated to use UUID's instead of names.
The calling functions were passing in a name instead of a suid, so
attempting to delete the client silently failed.

Fixes #52
2019-03-20 20:41:11 -04:00
Zorchenhimer f7b362519d Parse X-Forwarded-For header if provided
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
2019-03-20 16:57:29 -04:00
Zorchenhimer 7164f26f4e Add Cache-Control header to main.wasm response
Added the "Cache-Control" header to responses for the main.wasm file.
This should help with debugging and updates by telling the browser not
to cache the web assembly binary.
2019-03-20 10:59:28 -04:00
joeyak 53410bea40 Fixing scrollbar showing up again when notify box is mroe than one line 2019-03-20 00:08:08 -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
joeyak 7ce4c04942 Fixed autocomplete and positioning of suggestions
closes #41
2019-03-19 15:15:11 -04:00
Zorchenhimer 1f217c56a9 Replace favicon with something else
This is an icon that I threw together in a few minutes.  I don't want
my avatar as the favicon for this repository.

Also, the favicon.png has moved to the root directory as it is
something that is meant to be customized along with the settings that
is also in the root.
2019-03-18 11:21:17 -04:00
joeyak e42c7d14cc Minor UI changes
Changed playing div to be outside of hidden and the color to be darker
Make the notifyBox a smaller font to not be as imposing
Changed joinbox to have a better style that matches the rest of the website
2019-03-17 22:35:07 -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
joeyak 708056a86e Formatting html files 2019-03-17 17:31:48 -04:00
joeyak 417db785ce Add chat and video urls to readme 2019-03-17 02:01:13 -04:00
joeyak 7dca3be538 UI Changes
Changed UI to scale better
Moved info box into a hidden div that shows when the notifyBox is hovered
Added a color button that sends the /color command
Split client.js into separate files that the video and chat call separatly
The reload player button only shows up in chat when there is a video
added references to other code so code complete can work in js files

Fixes #40
2019-03-17 01:55:50 -04:00
Zorchenhimer 13f45e5b3a Link build status image to travis page 2019-03-16 22:35:48 -04:00
joeyak c1dd9168b2 Update build scripts
Moved all the go gets into the makefile to add version wasm support
Added get to update all dependencies and removed unneeded make rules
2019-03-16 22:24:35 -04:00
Zorchenhimer 2ea02fcd27 Add Travis-CI 2019-03-16 21:57:41 -04:00
Zorchenhimer b30202441a Add a limit to the title length
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
2019-03-16 21:06:16 -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
joeyak 1b8dd76a45 Add help button 2019-03-16 17:59:10 -04:00
joeyak ff1590d972 Added command buttons section
closes #39
2019-03-16 17:57:58 -04:00
Zorchenhimer d984269407 Add mod notice to /modpass command 2019-03-16 16:59:12 -04:00
Zorchenhimer 224fdd96c8 Don't use different port for websocket
Use the same port for the websocket that is being used for everything
else.
2019-03-16 16:53:22 -04:00
Zorchenhimer 7de20f6145 Allow unmodding yourself if you give your name
Don't deny unmodding yourself if you also provide your name to the
/unmod command.
2019-03-16 16:49:02 -04:00
Zorchenhimer 01219fffa1 Fix help popup
Properly call the open() function in the web assembly to open a new
popup.
2019-03-16 16:40:39 -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
joeyak c4507cc496 Ignore those evil backspaces 2019-03-16 16:01:54 -04:00
joeyak 30d480d878 Change heartbeat to be send only when in chat 2019-03-16 15:47:48 -04:00
joeyak b38542333a Add a debug message to print values 2019-03-16 14:59:30 -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
joeyak f9fa44ea77 Add enter for keys to autocomplete name 2019-03-16 14:27:13 -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
Zorchenhimer 75946b600b Move clients mutex lock in ChatRoom.Broadcast()
Don't lock the clients map while sleeping in ChatRoom.Broadcast().
2019-03-16 14:09:58 -04:00
Zorchenhimer f18b790c4d Wrap connection reads and writes with a mutex
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().
2019-03-16 13:44:18 -04:00
Zorchenhimer 5986b6d663 Move fmt before vet in Makefile 2019-03-16 13:42:17 -04:00
Zorchenhimer c8d39f7e4c Update readme to remove some incorrect info
The "download for development" section was wrong.  Removed until I
figure it out, lol.
2019-03-16 12:47:14 -04:00
joeyak ad4186a279 Added completion on tab for autocompleting name
closes  #7
2019-03-16 11:56:43 -04:00
joeyak 57e1f3863a Added popup box and arrow controls
When typing @ a div will show up with all the chat names that match.
When up or down arrow keys are pressed, the highlight changes.
Tab handling is currently incomplete but the event is prevented.

issue #7
2019-03-16 11:40:39 -04:00
joeyak 7297e01ab5 Add hack css font 2019-03-16 10:10:00 -04:00
joeyak bc90744798 Move broadcast logic to be self contained in the function 2019-03-15 18:57:50 -04:00
joeyak a3d3c170c9 Add more information to error output 2019-03-15 18:57:12 -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