Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Your New SJW Waifu 2020-10-17 19:36:45 -05:00
commit da0e74fcf7
6 changed files with 55 additions and 16 deletions

4
.dockerignore Normal file
View File

@ -0,0 +1,4 @@
*~
settings.json
static/subscriber.json
subscribers.json

19
license.md Normal file
View File

@ -0,0 +1,19 @@
Copyright 2020 Zorchenhimer
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

12
main.go
View File

@ -16,6 +16,7 @@ import (
var (
pullEmotes bool
addr string
rtmpAddr string
sKey string
stats = newStreamStats()
sAdminPass string
@ -47,7 +48,8 @@ func setupSettings() error {
}
func main() {
flag.StringVar(&addr, "l", "", "host:port of the MovieNight")
flag.StringVar(&addr, "l", "", "host:port of the HTTP server")
flag.StringVar(&rtmpAddr, "r", "", "host:port of the RTMP server")
flag.StringVar(&sKey, "k", "", "Stream key, to protect your stream")
flag.StringVar(&sAdminPass, "a", "", "Set admin password. Overrides configuration in settings.json. This will not write the password to settings.json.")
flag.BoolVar(&pullEmotes, "e", false, "Pull emotes")
@ -90,8 +92,8 @@ func main() {
addr = settings.ListenAddress
}
if addr[0] != ':' {
addr = ":" + addr
if rtmpAddr == "" {
rtmpAddr = settings.RtmpListenAddress
}
// A stream key was passed on the command line. Use it, but don't save
@ -102,7 +104,8 @@ func main() {
common.LogInfoln("Stream key: ", settings.GetStreamKey())
common.LogInfoln("Admin password: ", settings.AdminPassword)
common.LogInfoln("Listen and serve ", addr)
common.LogInfoln("HTTP server listening on: ", addr)
common.LogInfoln("RTMP server listening on: ", rtmpAddr)
common.LogInfoln("RoomAccess: ", settings.RoomAccess)
common.LogInfoln("RoomAccessPin: ", settings.RoomAccessPin)
@ -116,6 +119,7 @@ func startRmtpServer() {
server := &rtmp.Server{
HandlePlay: handlePlay,
HandlePublish: handlePublish,
Addr: rtmpAddr,
}
err := server.ListenAndServe()
if err != nil {

View File

@ -30,7 +30,7 @@ online.
### Older Go Versions
You can install a newer version of Go alongside your OS's distribution by
following the guide here: [https://golang.org/doc/install#extra_versions](https://golang.org/doc/install#extra_versions)
following the guide here: [https://golang.org/doc/manage-install](https://golang.org/doc/manage-install)
Once you have that setup add an enviromnent variable named `GO_VERSION` and
set it to the version you installed (eg, `1.14.1`). The Makefile will now use
@ -117,10 +117,14 @@ at startup:
```text
Usage of .\MovieNight.exe:
-e bool
Whether or not to download approved emotes on startup (default "false")
-k string
Stream key, to protect your stream
Stream key, to protect your stream (default: "")
-l string
host:port of the MovieNight (default ":8089")
-r string
host:port of the RTMP server (default ":1935")
```
## Configuration
@ -162,3 +166,7 @@ MovieNights configuration is controlled by `settings.json`:
duplicate message.
- `NoCache`: if true, set `Cache-Control: no-cache, must-revalidate` in the HTTP
header, to prevent caching responses.
## License
`flv.js` is Licensed under the Apache 2.0 license. This project is licened under the MIT license.

View File

@ -36,6 +36,7 @@ type Settings struct {
RegenAdminPass bool // regenerate admin password on start?
RoomAccess AccessMode
RoomAccessPin string // The current pin
RtmpListenAddress string // host:port that the RTMP server listens on
SessionKey string // key for session data
StreamKey string
StreamStats bool
@ -102,34 +103,36 @@ func LoadSettings(filename string) (*Settings, error) {
}
}
// Set to -1 to reset
if s.RateLimitChat == -1 {
s.RateLimitChat = 0
} else if s.RateLimitChat <= 0 {
s.RateLimitChat = 1
} else if s.RateLimitChat < 0 {
s.RateLimitChat = 0
}
if s.RateLimitNick == -1 {
s.RateLimitNick = 0
} else if s.RateLimitNick <= 0 {
s.RateLimitNick = 300
} else if s.RateLimitNick < 0 {
s.RateLimitNick = 0
}
if s.RateLimitColor == -1 {
s.RateLimitColor = 0
} else if s.RateLimitColor <= 0 {
s.RateLimitColor = 60
} else if s.RateLimitColor < 0 {
s.RateLimitColor = 0
}
if s.RateLimitAuth == -1 {
s.RateLimitAuth = 0
} else if s.RateLimitAuth <= 0 {
s.RateLimitAuth = 5
} else if s.RateLimitAuth < 0 {
common.LogInfoln("It's not recommended to disable the authentication rate limit.")
s.RateLimitAuth = 0
}
if s.RateLimitDuplicate == -1 {
s.RateLimitDuplicate = 0
} else if s.RateLimitDuplicate <= 0 {
s.RateLimitDuplicate = 30
} else if s.RateLimitDuplicate < 0 {
s.RateLimitDuplicate = 0
}
if s.WrappedEmotesOnly {

View File

@ -15,6 +15,7 @@
"RateLimitDuplicate": 30,
"RateLimitNick": 300,
"RegenAdminPass": true,
"RtmpListenAddress": ":1935",
"StreamKey": "ALongStreamKey",
"TitleLength": 50,
"TwitchClientID": "",