Commit Graph

556 Commits

Author SHA1 Message Date
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
joeyak 60dd98a1e7 Add infrastructure for the client to send formatted data to the server 2019-03-14 15:21:53 -04:00
joeyak 6a2cb3f906 Fix some linting errors with error messages 2019-03-14 15:19:36 -04:00
joeyak bb0c3ea736 Fixed printing the combined commands 2019-03-14 15:09:55 -04:00
Zorchenhimer 653ff6fc9c Some performance tweaks to the wasm code
Removed two fmt.Sprintf() calls and a fmt.Printf() call.  The Printf()
was for debugging and isn't needed anymore.  Sprintf() apparently
isn't all that performant.
2019-03-14 10:12:21 -04:00
Zorchenhimer 0effbf49b5 Rewrite ChatRoom.Broadcast()
The broadcast code would lock up eventually after a lot of messages.
It was rewritten to simplify and make it a bit more robust.  Chat
should no longer seize up for individual chatters or the entire room
after a lot of messages.
2019-03-14 10:11:14 -04:00
joeyak fc126d599e Fix broken multi alias commands
fixes #25
2019-03-14 00:21:41 -04:00
joeyak 2ef3684c14 Some linting fixes for the common package 2019-03-13 21:24:14 -04:00
joeyak 654d321a91 Remove testing print statements 2019-03-13 21:15:02 -04:00
joeyak 18465c61f5 Make the chatroom send each message individually
closes #24
2019-03-13 21:14:43 -04:00
Zorchenhimer 1cd490b04a Add single-use mod passwords
Single-use moderator passwords can only be generated by an admin with
the /modpass command.  To redeem the password and gain moderator
privileges, a user just needs to call /auth with the password.

The passwords are generated using the same function as the admin
password.  Additionally, generating passwords now uses crypto/rand
instead of math/rand.

Resolves #15
2019-03-13 16:51:07 -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 fcb966dda6 Update example settings file 2019-03-13 15:28:34 -04:00
joeyak d83d5225c8 Remove the log function which is no longer needed 2019-03-13 15:28:21 -04:00
Zorchenhimer 2517aebe92 Break long words across lines in chat 2019-03-13 15:11:04 -04:00
Zorchenhimer 447768f8dc Fix setPlaying() not clearing
Some div's were moved and renamed, but this function wasn't updated.
2019-03-13 14:56:33 -04:00
Zorchenhimer 4025622415 Wrap message lines in <div> blocks
This was changed in master, but was overwritten in the merge (html
generation moved).
2019-03-13 14:10:45 -04:00
Zorchenhimer a555e626af Merge branch 'json-communication'
# Conflicts:
#	chatclient.go
#	chatroom.go
2019-03-13 14:00:13 -04:00
Zorchenhimer bdd4e71261 Flesh out the JSON stuff a bit more
Implement some commands in the wasm client code:
  - /playing (setting and clearing)
  - /refreshplayer
Commands not yet implemented:
  - /purge (command doesn't exist yet on server)
  - /help (doesn't open window)
2019-03-13 13:42:38 -04:00
Zorchenhimer 568344a794 Fix /playing when one argument (title) is provided
If /playing was called with a single word (one-word title), it would
clear the title instead of setting the title.
2019-03-13 13:34:26 -04:00
Zorchenhimer 9c80269943 Start convert to JSON data b/t client and server
Chat and events should work.  Commands do not work yet.  Everything
also needs to be tested and cleaned up a bunch more.
2019-03-13 01:09:24 -04:00
joeyak d16839c597 Changed format tool from gofmt to goimports 2019-03-13 00:25:03 -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
joeyak 7f2c17f041 Add minor cleanups 2019-03-12 22:55:35 -04:00
joeyak 7ee1c1ffb8 Changing css to go from floats and widths to css grid
close #11
close #23
2019-03-12 18:16:35 -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
Zorchenhimer cc5e5fc4be Fix layout for title and reload player button
These should go below the video player, not above chat.
2019-03-12 12:23:07 -04:00
joeyak b0206a84c2 initPlayer() not being called 2019-03-12 10:33:04 -04:00
joeyak 91b5378c84 Removed unused video.js reference 2019-03-12 10:08:55 -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
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 2e17d92cae
Merge pull request #21 from zorchenhimer/wasm
Converted to code to using webassembly

closes #4
2019-03-11 23:32:35 -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 c0b6b3598c Update readme
Rewrote a bunch of the readme to reflect the current project instead of
the demo streaming server that the streaming code is based on.
2019-03-11 17:10:15 -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 b62b89c13e Fix formatLinks() not working
This broke when moving to the standard library for escaping and
unescaping HTML.  The original escaping code replaced "//" with
"&x2F;&x2F;" while the standard library doesn't.
2019-03-11 15:41:41 -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
Zorchenhimer 02400b667c Fix crash when trying to mod nobody
Fixes issue #12
2019-03-10 21:35:24 -04:00
Zorchenhimer 5b75615b90 Fixup the random color code
Don't allow the user to randomize their color if it was previously
changed by an mod.  And don't change to a random color if an incorrect
argument was given for the command.
2019-03-10 21:26:37 -04:00
joeyak 61643f579a Fixed bug where any mod could not change color 2019-03-10 20:47:59 -04:00
joeyak 81f02f6a51 Add debug file to gitignore 2019-03-10 20:47:39 -04:00
joeyak ae292ccb88 removed unneeded function - escaped server side 2019-03-10 19:13:28 -04:00
joeyak 08dbf73d99 fix ws connection when having the port in the url 2019-03-10 18:45:52 -04:00