Commit Graph

335 Commits

Author SHA1 Message Date
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
joeyak d3334fd58c Fix broken chat scrolling again 2019-03-21 16:48:59 -04:00
joeyak fac6e285bd Add stream stats, minor changes in main, and adding ctrl+c handling
Stream statistics will now print when enabled in settings.json. There is messages in, messages out,
and total time running. The main function was changed so the server setups for the main and rtmp
are in separate functions, and both are started with their own goroutine. OS Interrupt catching was added,
and if stream stats is true, the stats will be printed.
2019-03-21 16:20:50 -04:00
joeyak bc983d9ce3 Removing unused variables and increasing queue
The UsernameMaxLength and MinLength constants were removed because common.IsValidUsername checks that.
Changed queue sizes to 1000 because if 25 people are joined and 4 say a message at the same time
it results in 100 messages.
2019-03-21 16:05:14 -04:00
joeyak 5382c8b35d Add $ back into the readme 2019-03-21 14:06:06 -04:00
joeyak 0de457d28f Change highlighting to be a box instead of the user color
This allows users with hard to read colors to still see mentions
issue #48
2019-03-21 09:27:14 -04:00
joeyak b2d62ad42b Add name highlighting
The server adds name highlighting to the message to be the same color as the user's tag.
resolves #48
2019-03-21 09:04:57 -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 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