Commit Graph

37 Commits

Author SHA1 Message Date
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
joeyak
ecf64dff8a Cleaning up files and some organization 2019-03-10 16:45:10 -04:00
joeyak
df6b6da044 Some minor fixes in readme and linting errors 2019-03-10 13:41:06 -04:00
Zorchenhimer
3276295421 Initial commit
So far things work.  Needs lots of improvements.
2019-03-10 11:42:12 -04:00