Commit Graph

40 Commits

Author SHA1 Message Date
Zorglube 6b7e6cd083 Fixed the Emotes feature 2020-10-20 20:57:05 +02:00
Zorglube 7c33ba91d1 Factorize runPath() 2020-10-20 00:45:18 +02:00
Bertrand Moreau 5fe3036e03 Very little factorize around "func runPath()" 2020-10-20 00:45:18 +02:00
Bertrand Moreau b71db84b69 Run from anywhere
Get the runpath at runtime, in order to run MovieNight from whatever
position into the filesystem.
2020-10-20 00:45:18 +02:00
Alex Dunn 677a9fd9cb allow customization of <title> 2020-06-03 12:24:07 -07:00
Zorchenhimer 8fc3f86135 Add an emote list
It's ugly, but it get's the job done.  This list will need to be
improved a lot (ie, make it searchable and maybe even clickable
emotes?).  This is for #99, but should not be considered fixed yet.
2019-11-29 12:48:17 -05:00
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
Zorchenhimer 0a4ff49cbb Trim PIN of spaces
Fixes #88
2019-04-22 11:50:42 -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
Zorchenhimer d513fe872d Remove temp connections
Temp connections were removed to reduce some complexity.  Now a
connection is a full client, even before joining chat.  A name is
required to be set to join chat and receive messages.

This change also removes the need for UUIDs on connections and clients.
2019-04-13 15:56:49 -04:00
Zorchenhimer 0c3850d2f7 Make the pin entry screen not look terrible
Change the color of the message to be readable, and some other
positioning tweaks.
2019-04-13 14:21:53 -04:00
Zorchenhimer 332dfdc9cf Fix connecting to websocket with SSL
Request a secure web socket (wss://) when connecting to the site with
https.  Fixes #61.
2019-04-13 13:47:38 -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 6b48322626 Use the logger
Replace fmt.Print[f|ln]() with the logger equivalent.
2019-03-30 16:15:22 -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 0a817eff87 Add a NoCache setting
Added this to the settings so it can be configured at runtime.  If set
to true, a Cache-Control header will be sent with the wasm file as well
as the index html.
2019-03-30 15:14:30 -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 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 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 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 f456da937b goimports fixed this 2019-03-20 21:25:01 -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
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
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 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
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
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 60dd98a1e7 Add infrastructure for the client to send formatted data to the server 2019-03-14 15:21:53 -04:00
joeyak 654d321a91 Remove testing print statements 2019-03-13 21:15:02 -04:00
joeyak 5516313c79 Allow chat to be sent before the name is sent to the server
closes #17
2019-03-13 16:47:19 -04:00
joeyak d77078edc3 divs in #messages are removed after set count maxes out. Default is 300
closes #20
2019-03-13 00:02:36 -04:00
Zorchenhimer 382b03b430 Remove anonymous functions in handler definitions
handlePublish, handlePlay, and handleDefault have been added in
handlers.go and removed as anonymous functions in main.go.  This also
required moving some struct and variable definitions around a bit.
2019-03-12 12:39:23 -04:00
joeyak 272272e29c Changed index to use templates so chat and video only versions can be made
close #1
2019-03-12 01:58:03 -04:00
joeyak 192d97727b Renamed file since handlers are not just chat only anymore 2019-03-12 01:04:16 -04:00