zorchenhimer / movienight Goto Github PK
View Code? Open in Web Editor NEWSingle instance video streaming server with integrated chat.
Home Page: https://discord.gg/F2VSgjJ
License: MIT License
Single instance video streaming server with integrated chat.
Home Page: https://discord.gg/F2VSgjJ
License: MIT License
Move name checking logic into MovieNight/common so the front end can also validate name via the wasm module. This will allow the same checking on both sides and save the UI a trip via websockets and showing possible errors. Keep the validation in the server since messages can still be send directly from the js websocket.
Add the listen address and stream key to the settings.json
file. If they are provided on the command line they should override the values in the settings file.
When typing "@" w/o a partial name after it, get the list of users and suggest an autocomplete for the name.
Move the chat client logic to a webassembly file
Golang wasm info: https://github.com/golang/go/wiki/WebAssembly
Example of go wasm: https://github.com/joeyak/zorchetimer-web/blob/master/main.go
During the first run of this server, I had trouble reading the text because the words were so close together. Adding a padding or margin around the words would work. We could do it like twitch does
.chat-line__message, .chat-line__moderation, .chat-line__status {
padding: .5rem 2rem;
word-wrap: break-word;
}
It would be better to have a specific spot to store all the html message templates. Perhaps a slice or constants in another file.
Attempt to reconnect the websocket on the client side when the connection drops.
When a user types the /help
command, have one of the following occur:
Another posibility is having autocomplete for commands. If #7 and #9 work out well, then autocomplete for commands could work also. There would have to be hidden commands like /auth which do not show up in help or autocomplete.
Currently /auth shows up in the help page.
Save the color information with the ip/name. This way when someone refreshes or joins next time, the color doesn't have to be changed.
This makes the messages not work anymore. 2ef3684
For multiple option commands like w
and whoami
, and color
and colour
, the command is not recognized.
Instead of supporting three different html files, just use templates to make it one file. There could be two options: hasChat and hasVideo to decided what shows
uri | hasChat | hasVideo |
---|---|---|
/ | y | y |
/justchat | y | n |
/justvideo | n | y |
Templates information: https://golang.org/pkg/html/template/
This could be done by checking for specific sites when links are pasted, such as imgur or giphy, and then replacing them like emotes are done.
When running "/mod" the server crashes complaining about an out of range error.
Make sure backspace does not go to previous page.
Add badges for admins an moderators. Admins should have a different badge from moderators and it should show up to the left of the user's name in chat.
Auto-generate the /help
command's output from the CommandControl object. Maybe display results in a new popup window instead of in chat?
When typing @zo
and then tabbing, the result is @zoZorchenhimer
.
If the server is sitting behind an Nginx reverse proxy, all IP addresses are 127.0.0.1
. Nginx (and probably the others) can add an X_Forwarded_For
header with the client's real IP. This should be passed along to the server to check for bans.
When a user's name is mentioned, add highlighting to it, either the entire line, the name, or changing the color of the name.
Images below are from in browser editing. Color still to be determined.
Edit:
Add a way to turn off highlighting and highlight on multiple names
Putting this here as a bug so I don't forget. I don't want the favicon in this repository to be my avatar. Change it to something movie themed maybe?
The current way the infoBox layout is, makes the spacing for the UI very finicky. Perhaps having an div that is hidden at the top and shows when hovering would work better.
Add some log levels. Specifically, only print errors by default and not all the things that are being done (eg, [static] serving "js/both.js" from folder ./static/
).
This should be configurable and have more than one level available:
Optionally, the log should write to a file and should be configurable from the settings. I don't think this is something that needs a command, but I'm not opposed to adding one to change logging levels.
I have ran into an issue where the websocket connection will panic because of conncurrent reads and writes. I think the best way to fix this would be to create a SafeConn, that uses mutexes on every read and send. That way the client mutex doesn't have to be used. This also solved the problem of the connections being called as a tempConn and as a Client.
Figure out a way to tell how much the client is lagging behind the stream. Ideally, if the lag is high enough, display the amount of lag below the player next to the reload player button.
When there is an image in chat, the messages does not scroll properly since the scroll line only scrolls a specific height.
$("#messages").append("").scrollTop(9e6);
This command would clear chat for everybody and display a message along the lines of "Chat was cleared by a moderator".
The chat client will disconnect if it is behind an Nginx reverse-proxy if no messages are sent within about a minute.
The client should send a PING to the server to keep the connection alive. The server needs to read the PING from the client, but I don't think it needs to respond with a PONG to keep the connection open.
Either pull emotes from twitch itself, or download emotes on server start. I'm thinking that having a json file of accepted channels in chat could work the best since it could be too much to search all channels on twitch.
Twitch emote api docs: https://www.twitchemotes.com/apidocs
Maybe add a strawpoll popup at the top of chat? Only mods or admins could do it.
Change the layout of the index.html file to use css grid. This will avoid the need of manually keeping track of percent signs when the template generates /chat
or /video
Helpful sites:
Broadcast results of some mod/admin commands to other mods and admins:
/color #000000
should change the current user's color if they are mod or admin instead of returning an error.
When multiple users leave at the same time, the user has left message only shows for the first user.
Leave the command as is, but add a way to auth using prompt()
When typing a emote, an autocomplete should show up. Show autocomplete when a user types a colon and a letter. The letter has to be A-Za-z
. When a user tabs for autocomplete, :smiaSip
should be replaced with smiaSip
Below are the only forms an emote image should be replaced for in chat.
:smiaSip:
smiaSip
[smiaSip]
Add a chatroom count for total messages sent and total messages received. This would help with debugging stress tests, and other possible problems when the number of messages sent is large. This would be configurable via settings. Perhaps "DebugCountMessages": true
There should be three levels of access to room access:
Rabbit had the first and third, but the pin/password option would be a useful middle ground between the two. Default access level should be configurable in the settings file and modifiable by an admin via a command in chat (possibly mods too?). Changing the access level in an active room should not kick any users currently connected. Full definitions for each access type are as follows:
Allow access to anybody with the main URL. Video is loaded on page load, and is allowed to chat when a username is entered.
Landing page is a simple pin or password entry form (with a username to avoid another input step for chat). Video and chat are loaded after a correct pin or password is entered. The pin or password will be global for the room and configurable by both the settings file and a command.
Maybe add the possibility of appending the pin to the URL as a GET variable (eg, ?pin=12345
). Following the link will bring up the same landing page but with the pin pre-filled, leaving only a name to be entered.
Landing page is a simple name entry form and a button to request access to the room. Once submitted, mods and admins in the room will be notified and given the option to allow or deny access to the user requesting access, either by a pop-up of some sort or a command (command route might be a bit unwieldy for the mod/admin however).
I would personally like to use the pin/password method, but I do know some other streamers that I believe would prefer the Request/grant method instead.
Add an admin command to generate a one-time mod password. During the first movie night I had to confirm which username Mia had a few times before granting mod privileges. It would have been easier if I could have just DM'd her a password to enter.
Ideally, this would work by an admin typing /modpass
and displaying a single-use password. Putting this password in chat would probably be difficult to copy and paste, so I'm ok with popping up a window with the password.
To use the password, the user would use the /auth
command with the password. Once it is used, it should be invalidated on the server.
Allow users to use any colors for /color
from the standard color names
This relates to issue #44 filtering for specific colors.
Currently, messages are appended and never removed. This will become a problem for long sessions, as the chat will just keep growing.
Old chat messages should be removed. The cutoff should be configurable with the default probably around 100-200 messages.
Right now communication between server and client is just via text being sent. The first message is the username, and commands start with /
. It would be better to have a standard way of sending messages via objects. With the webassembly change, this will make customizable communication easier. It might be better to get this done before #17 since sending the username is the first message for now.
This would be stopping users from having unreadable colors. For example, #000000
(black) on a dark background is barely readable.
Add a pm command.
/pm [name] [message]
Example usage: /pm zorchenhimer This is a pm
Load and display chat before the user enters a username. Instead of showing the message box at the bottom, show the "Enter Username" input.
Wait until after #4 is finished to implement this.
The validation for commands would have to be moved into the common package. An example would be a user typing in /color redb
. The wasm side detection would see that the command is wrong and will warn the user. Keep the server side checks because a user can still do
ws.Send('{"Type":0, Message: "/color redb"');
in the console.
Thoughts on different font options.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.