Commit Graph

53 Commits

Author SHA1 Message Date
Zorchenhimer d06e2251a4 Separate /live and / http handlers
Separate the /live and / (main) http handlers.  This cleans up the
related code a little bit and makes it a lot easier to follow.
2021-01-16 15:29:23 -05:00
Zorchenhimer ebc51f938c Remove the /pin endpoint
This was never supposed to be in there.
2021-01-10 20:09:30 -05:00
Bertrand Moreau 516b9a212b Run from anywhere
Get the runpath at runtime, in order to run MovieNight from whatever
position into the filesystem.
2020-10-20 01:01:55 +02:00
Zorglube b3dc13affb Relative running 2020-10-20 00:59:57 +02:00
Zorglube 8c7a303e14 absolut dir 2020-10-20 00:56:52 +02:00
Zorglube 304e4751e2 Relative dir 2020-10-20 00:56:47 +02:00
Bertrand Moreau 9e9e075e0f settings.json default value 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
Zorglube 462363c6f6 Relative running 2020-10-20 00:45:17 +02:00
Zorglube 9d16f2407e absolut dir 2020-10-20 00:45:17 +02:00
Zorglube 9671f77826 Relative dir 2020-10-20 00:45:17 +02:00
Zorglube dc1413ba6b Add conf file var 2020-10-20 00:45:17 +02:00
Zorchenhimer 630abfe474 Add option to change the RTMP listen address
A new setting has been added to change the address and port that the
RTMP server listens on.  `RtmpListenAddress` in the settings json and
`-r` on the command line.  Both options use the same format:
`host:port`.
2020-06-12 23:58:45 -04:00
Zorchenhimer ce2150f719 Add ability to set admin password at startup
The -a flag has been added to allow specifying a new admin password on
the command line.  This password will only be used for the current
session and will not be written to the configuration file.  If the
password contains spaces, wrap it in quotes on the command line.  The
quotes should be omitted with the /auth command.

Eg, starting the server with:
    ./MovieNight -a "the admin password"
the auth command in chat would be:
    /auth the admin password
2020-04-18 16:02:41 -04: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
joeyak 7962fad02e commiting so zorch can do my work 2019-06-01 19:41:28 -04:00
joeyak 61dd64182e Fix port not being set with command flag 2019-05-05 13:35:36 -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 38f2ca9972 Merge branch 'master' into room-access-restrictions
This is mainly for the server-shutdown merge revert.

# Conflicts:
#	main.go
2019-03-31 00:09:42 -04:00
Zorchenhimer 9c559c3818 Revert "Merge branch 'server-shutdown'"
This reverts commit 13d74faf01, reversing
changes made to ec0c6752bc.

These changes completely broke the RTMP stream.  Reverting until I
figure out why.
2019-03-31 00:07:19 -04:00
Zorchenhimer 34d8fbf20c Merge branch 'master' into room-access-restrictions
# Conflicts:
#	main.go
2019-03-30 17:45:39 -04:00
Zorchenhimer 13d74faf01 Merge branch 'server-shutdown' 2019-03-30 16:22:21 -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 e7cfcd8688 Move logging setup to LoadSettings() 2019-03-30 15:14:30 -04:00
Zorchenhimer e879112b1b Add some comments clarifying some things 2019-03-28 10:18:17 -04:00
Zorchenhimer 9bcbad6a07 Expand graceful shutdown to use http.Shutdown()
Not sure if this is better or not, but I'm testing it out.
2019-03-28 10:06:18 -04:00
Zorchenhimer b03329772e Fix fmt import error
Not sure how this happened.
2019-03-26 14:30:52 -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 d2b8f3d7be Remove panic()'s from setupSettings()
Now that this is in a called function, instead of an init(), return an
error instead of panicking.
2019-03-26 11:44:19 -04:00
joeyak f60bd33011 Remove inits since it is startup code 2019-03-24 23:54:24 -04:00
Zorchenhimer 5d10fdfea4 Forgot to remove a DevLogLn(), and two fixes
Good news, it breaks Travis like it's supposed to! I also forgot to add
the `common` namespace during a rebase.  Whoops.

Resolves #46
2019-03-24 19:03:19 -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
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 0036dde265 Fix some typos
BroadCast() -> Broadcast()
startRmptServer() -> startRmtpServer()
2019-03-23 14:46:49 -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 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
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 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
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 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 5516313c79 Allow chat to be sent before the name is sent to the server
closes #17
2019-03-13 16:47:19 -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
Zorchenhimer 1a217775ff Fix stream key loading
Somehow I broke this without noticing.  Also, If a stream key is
provided as a command line flag, load it but do not save it to
settings.json.
2019-03-11 23:45:23 -04:00
joeyak 5544ac817f Converted to code to using webassembly 2019-03-11 23:15:42 -04:00
Zorchenhimer 2879ab2c95 Add stream key and listen address to settings.json
This resolves #14.  If the stream key or address are passed on the
command line, those values take precedence over whatever is in the
settings file.
2019-03-11 23:05:01 -04:00
Zorchenhimer a1a7f8aa3b Rework stream key parsing
Instead of using a GET value in the URL, split on the path separators
and use the second element of the path as the key.  This enables
putting the stream key in the appropriate settings in OBS, instead of
appending it to the stream URL manually.
2019-03-11 17:09:12 -04:00
Zorchenhimer 86ba07b4f7 Write the /help command
This still needs a bunch of work, but this should be OK until the UI is
rewritten.

The command injects a <script> tag to open up a new window.  Mod and
admin commands are only shown to mods and admins (no authentication
happens for this).

Resolves #8 for now.
2019-03-11 12:06:45 -04:00