From 677a9fd9cbfc014a199a23291932aa635fdcc5ce Mon Sep 17 00:00:00 2001 From: Alex Dunn Date: Wed, 3 Jun 2020 12:15:30 -0700 Subject: [PATCH 01/10] allow customization of --- handlers.go | 2 +- settings.go | 1 + settings_example.json | 1 + static/js/chat.js | 4 ++-- static/main.html | 3 ++- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/handlers.go b/handlers.go index 3cdbfad..969fa97 100644 --- a/handlers.go +++ b/handlers.go @@ -328,7 +328,7 @@ func handleIndexTemplate(w http.ResponseWriter, r *http.Request) { Video: true, Chat: true, MessageHistoryCount: settings.MaxMessageCount, - Title: "Movie Night!", + Title: settings.PageTitle, } path := strings.Split(strings.TrimLeft(r.URL.Path, "/"), "/") diff --git a/settings.go b/settings.go index fd19ac5..264e682 100644 --- a/settings.go +++ b/settings.go @@ -26,6 +26,7 @@ type Settings struct { StreamStats bool MaxMessageCount int TitleLength int // maximum length of the title that can be set with the /playing + PageTitle string // primary value for the page <title> element AdminPassword string RegenAdminPass bool // regenerate admin password on start? StreamKey string diff --git a/settings_example.json b/settings_example.json index 1352b6f..891e226 100644 --- a/settings_example.json +++ b/settings_example.json @@ -1,5 +1,6 @@ { "MaxMessageCount": 300, + "PageTitle": "Movie Night", "TitleLength": 50, "AdminPassword": "", "RegenAdminPass": true, diff --git a/static/js/chat.js b/static/js/chat.js index 8093cea..3a16a50 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -23,10 +23,10 @@ function deleteCookie(cname) { function setPlaying(title, link) { if (title !== "") { $('#playing').text(title); - document.title = "Movie Night | " + title; + document.title = pageTitle + " | " + title; } else { $('#playing').text(""); - document.title = "Movie Night"; + document.title = pageTitle; } $('#playing').removeAttr('href'); diff --git a/static/main.html b/static/main.html index 4a49acc..b2cd83f 100644 --- a/static/main.html +++ b/static/main.html @@ -1,4 +1,5 @@ {{define "header"}} +<script>pageTitle = {{ .Title }}</script> {{if .Chat}} <script type="application/javascript" src="/static/js/wasm_exec.js"></script> <script type="application/javascript" src="/static/js/chat.js"></script> @@ -124,4 +125,4 @@ </div> </div> {{end}} -{{end}} \ No newline at end of file +{{end}} From d28d6e7635d6ac805d67ae7a80072e4f1436e0d7 Mon Sep 17 00:00:00 2001 From: Alex Dunn <dunn.alex@gmail.com> Date: Wed, 3 Jun 2020 19:44:59 -0700 Subject: [PATCH 02/10] sort settings.json --- settings.go | 23 +++++++++++------------ settings_example.json | 26 +++++++++++++------------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/settings.go b/settings.go index 264e682..ab5d3a8 100644 --- a/settings.go +++ b/settings.go @@ -23,24 +23,23 @@ type Settings struct { cmdLineKey string // stream key from the command line // Saved settings - StreamStats bool - MaxMessageCount int - TitleLength int // maximum length of the title that can be set with the /playing - PageTitle string // primary value for the page <title> element AdminPassword string - RegenAdminPass bool // regenerate admin password on start? - StreamKey string - ListenAddress string ApprovedEmotes []string // list of channels that have been approved for emote use. Global emotes are always "approved". - TwitchClientID string // client id from twitch developers portal - SessionKey string // key for session data Bans []BanInfo - LogLevel common.LogLevel + ListenAddress string LogFile string + LogLevel common.LogLevel + MaxMessageCount int + NewPin bool // Auto generate a new pin on start. Overwrites RoomAccessPin if set. + PageTitle string // primary value for the page <title> element + RegenAdminPass bool // regenerate admin password on start? RoomAccess AccessMode RoomAccessPin string // The current pin - NewPin bool // Auto generate a new pin on start. Overwrites RoomAccessPin if set. - + SessionKey string // key for session data + StreamKey string + StreamStats bool + TitleLength int // maximum length of the title that can be set with the /playing + TwitchClientID string // client id from twitch developers portal WrappedEmotesOnly bool // only allow "wrapped" emotes. eg :Kappa: and [Kappa] but not Kappa // Rate limiting stuff, in seconds diff --git a/settings_example.json b/settings_example.json index 891e226..04ec2c3 100644 --- a/settings_example.json +++ b/settings_example.json @@ -1,20 +1,20 @@ { - "MaxMessageCount": 300, - "PageTitle": "Movie Night", - "TitleLength": 50, "AdminPassword": "", - "RegenAdminPass": true, - "Bans": [], - "StreamKey": "ALongStreamKey", - "ListenAddress": ":8089", "ApprovedEmotes": null, - "LogLevel": "debug", + "Bans": [], + "ListenAddress": ":8089", "LogFile": "thelog.log", - "RateLimitChat": 1, - "RateLimitNick": 300, - "RateLimitColor": 60, - "RateLimitAuth": 5, - "RateLimitDuplicate": 30, + "LogLevel": "debug", + "MaxMessageCount": 300, "NoCache": false, + "PageTitle": "Movie Night", + "RateLimitAuth": 5, + "RateLimitChat": 1, + "RateLimitColor": 60, + "RateLimitDuplicate": 30, + "RateLimitNick": 300, + "RegenAdminPass": true, + "StreamKey": "ALongStreamKey", + "TitleLength": 50, "WrappedEmotesOnly": false } From 9b85475fe429f7c9e45c46ed6418f1edb7971a01 Mon Sep 17 00:00:00 2001 From: Alex Dunn <dunn.alex@gmail.com> Date: Wed, 3 Jun 2020 19:47:57 -0700 Subject: [PATCH 03/10] add new setting to suppress join/leave announcements --- chatroom.go | 9 ++++++--- settings.go | 1 + settings_example.json | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/chatroom.go b/chatroom.go index 5632bb8..00d4b68 100644 --- a/chatroom.go +++ b/chatroom.go @@ -109,8 +109,9 @@ func (cr *ChatRoom) Join(conn *chatConnection, data common.JoinData) (*Client, e } else { client.Send(playingCommand) } - cr.AddEventMsg(common.EvJoin, data.Name, data.Color) - + if !settings.LetThemLurk { + cr.AddEventMsg(common.EvJoin, data.Name, data.Color) + } sendHiddenMessage(common.CdJoin, nil) sendHiddenMessage(common.CdEmote, common.Emotes) @@ -135,7 +136,9 @@ func (cr *ChatRoom) Leave(name, color string) { client.conn.Close() cr.delClient(id) - cr.AddEventMsg(common.EvLeave, name, color) + if !settings.LetThemLurk { + cr.AddEventMsg(common.EvLeave, name, color) + } common.LogChatf("[leave] %s %s\n", host, name) } diff --git a/settings.go b/settings.go index ab5d3a8..a96a442 100644 --- a/settings.go +++ b/settings.go @@ -26,6 +26,7 @@ type Settings struct { AdminPassword string ApprovedEmotes []string // list of channels that have been approved for emote use. Global emotes are always "approved". Bans []BanInfo + LetThemLurk bool // whether or not to announce users joining/leaving chat ListenAddress string LogFile string LogLevel common.LogLevel diff --git a/settings_example.json b/settings_example.json index 04ec2c3..53b35e5 100644 --- a/settings_example.json +++ b/settings_example.json @@ -2,6 +2,7 @@ "AdminPassword": "", "ApprovedEmotes": null, "Bans": [], + "LetThemLurk": false, "ListenAddress": ":8089", "LogFile": "thelog.log", "LogLevel": "debug", From c8fba1dc5b290b92656504e3227a9271b248a35b Mon Sep 17 00:00:00 2001 From: Alex Dunn <dunn.alex@gmail.com> Date: Wed, 3 Jun 2020 22:27:15 -0700 Subject: [PATCH 04/10] colors: each on one line --- common/colors.go | 156 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 130 insertions(+), 26 deletions(-) diff --git a/common/colors.go b/common/colors.go index 5b2312e..0fddda9 100644 --- a/common/colors.go +++ b/common/colors.go @@ -18,32 +18,136 @@ func init() { // the values in colors must be lowercase so it matches with the color input // this saves from having to call strings.ToLower(color) every time to check var Colors = []string{ - "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", - "beige", "bisque", "blanchedalmond", "blueviolet", "brown", - "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", - "cornflowerblue", "cornsilk", "crimson", "cyan", "darkcyan", - "darkgoldenrod", "darkgray", "darkkhaki", "darkmagenta", "darkolivegreen", - "darkorange", "darkorchid", "darksalmon", "darkseagreen", "darkslateblue", - "darkslategray", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", - "dimgray", "dodgerblue", "firebrick", "floralwhite", "forestgreen", - "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", - "gray", "greenyellow", "honeydew", "hotpink", "indigo", - "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", - "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", - "lightgrey", "lightgreen", "lightpink", "lightsalmon", "lightseagreen", - "lightskyblue", "lightslategray", "lightsteelblue", "lightyellow", "lime", - "limegreen", "linen", "magenta", "mediumaquamarine", "mediumorchid", - "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", - "mediumvioletred", "mintcream", "mistyrose", "moccasin", "navajowhite", - "oldlace", "olive", "olivedrab", "orange", "orangered", - "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", - "papayawhip", "peachpuff", "peru", "pink", "plum", - "powderblue", "purple", "rebeccapurple", "red", "rosybrown", - "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", - "seashell", "sienna", "silver", "skyblue", "slateblue", - "slategray", "snow", "springgreen", "steelblue", "tan", - "teal", "thistle", "tomato", "turquoise", "violet", - "wheat", "white", "whitesmoke", "yellow", "yellowgreen", + "aliceblue", + "antiquewhite", + "aqua", + "aquamarine", + "azure", + "beige", + "bisque", + "blanchedalmond", + "blueviolet", + "brown", + "burlywood", + "cadetblue", + "chartreuse", + "chocolate", + "coral", + "cornflowerblue", + "cornsilk", + "crimson", + "cyan", + "darkcyan", + "darkgoldenrod", + "darkgray", + "darkkhaki", + "darkmagenta", + "darkolivegreen", + "darkorange", + "darkorchid", + "darksalmon", + "darkseagreen", + "darkslateblue", + "darkslategray", + "darkturquoise", + "darkviolet", + "deeppink", + "deepskyblue", + "dimgray", + "dodgerblue", + "firebrick", + "floralwhite", + "forestgreen", + "fuchsia", + "gainsboro", + "ghostwhite", + "gold", + "goldenrod", + "gray", + "greenyellow", + "honeydew", + "hotpink", + "indigo", + "ivory", + "khaki", + "lavender", + "lavenderblush", + "lawngreen", + "lemonchiffon", + "lightblue", + "lightcoral", + "lightcyan", + "lightgoldenrodyellow", + "lightgreen", + "lightgrey", + "lightpink", + "lightsalmon", + "lightseagreen", + "lightskyblue", + "lightslategray", + "lightsteelblue", + "lightyellow", + "lime", + "limegreen", + "linen", + "magenta", + "mediumaquamarine", + "mediumorchid", + "mediumpurple", + "mediumseagreen", + "mediumslateblue", + "mediumspringgreen", + "mediumturquoise", + "mediumvioletred", + "mintcream", + "mistyrose", + "moccasin", + "navajowhite", + "oldlace", + "olive", + "olivedrab", + "orange", + "orangered", + "orchid", + "palegoldenrod", + "palegreen", + "paleturquoise", + "palevioletred", + "papayawhip", + "peachpuff", + "peru", + "pink", + "plum", + "powderblue", + "purple", + "rebeccapurple", + "red", + "rosybrown", + "royalblue", + "saddlebrown", + "salmon", + "sandybrown", + "seagreen", + "seashell", + "sienna", + "silver", + "skyblue", + "slateblue", + "slategray", + "snow", + "springgreen", + "steelblue", + "tan", + "teal", + "thistle", + "tomato", + "turquoise", + "violet", + "wheat", + "white", + "whitesmoke", + "yellow", + "yellowgreen", } var ( From 086d22a9411739d8c763fe6c37933eb9e27d1e8a Mon Sep 17 00:00:00 2001 From: Alex Dunn <dunn.alex@gmail.com> Date: Wed, 3 Jun 2020 22:30:45 -0700 Subject: [PATCH 05/10] colors: remove colors that aren't AA accessible per https://webaim.org/resources/contrastchecker/ --- common/colors.go | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/common/colors.go b/common/colors.go index 0fddda9..a89fc86 100644 --- a/common/colors.go +++ b/common/colors.go @@ -26,8 +26,6 @@ var Colors = []string{ "beige", "bisque", "blanchedalmond", - "blueviolet", - "brown", "burlywood", "cadetblue", "chartreuse", @@ -35,29 +33,19 @@ var Colors = []string{ "coral", "cornflowerblue", "cornsilk", - "crimson", "cyan", "darkcyan", "darkgoldenrod", "darkgray", "darkkhaki", - "darkmagenta", - "darkolivegreen", "darkorange", - "darkorchid", "darksalmon", "darkseagreen", - "darkslateblue", - "darkslategray", "darkturquoise", - "darkviolet", "deeppink", "deepskyblue", - "dimgray", "dodgerblue", - "firebrick", "floralwhite", - "forestgreen", "fuchsia", "gainsboro", "ghostwhite", @@ -67,7 +55,6 @@ var Colors = []string{ "greenyellow", "honeydew", "hotpink", - "indigo", "ivory", "khaki", "lavender", @@ -98,7 +85,6 @@ var Colors = []string{ "mediumslateblue", "mediumspringgreen", "mediumturquoise", - "mediumvioletred", "mintcream", "mistyrose", "moccasin", @@ -119,26 +105,19 @@ var Colors = []string{ "pink", "plum", "powderblue", - "purple", - "rebeccapurple", "red", "rosybrown", - "royalblue", - "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", - "sienna", "silver", "skyblue", - "slateblue", "slategray", "snow", "springgreen", "steelblue", "tan", - "teal", "thistle", "tomato", "turquoise", From 391db3f0bfa3f033b4bb62ff46b8ffe80df3b0c0 Mon Sep 17 00:00:00 2001 From: Alex Dunn <dunn.alex@gmail.com> Date: Thu, 4 Jun 2020 00:32:01 -0700 Subject: [PATCH 06/10] emotes: send OAuth secret token to Twitch when fetching emotes As of last month, requests made to the Twitch Helix API require an OAuth token as well as the Client ID: https://discuss.dev.twitch.tv/t/requiring-oauth-for-helix-twitch-api-endpoints/23916 --- emotes.go | 1 + settings.go | 39 ++++++++++++++++++++------------------- settings_example.json | 2 ++ 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/emotes.go b/emotes.go index d8fd00b..f9d117c 100644 --- a/emotes.go +++ b/emotes.go @@ -168,6 +168,7 @@ func getUserIDs(names []string) []TwitchUser { log.Fatalln("Error generating new request:", err) } request.Header.Set("Client-ID", settings.TwitchClientID) + request.Header.Set("Authorization", fmt.Sprintf("Bearer %s", settings.TwitchClientSecret)) client := http.Client{} resp, err := client.Do(request) diff --git a/settings.go b/settings.go index a96a442..059d921 100644 --- a/settings.go +++ b/settings.go @@ -23,25 +23,26 @@ type Settings struct { cmdLineKey string // stream key from the command line // Saved settings - AdminPassword string - ApprovedEmotes []string // list of channels that have been approved for emote use. Global emotes are always "approved". - Bans []BanInfo - LetThemLurk bool // whether or not to announce users joining/leaving chat - ListenAddress string - LogFile string - LogLevel common.LogLevel - MaxMessageCount int - NewPin bool // Auto generate a new pin on start. Overwrites RoomAccessPin if set. - PageTitle string // primary value for the page <title> element - RegenAdminPass bool // regenerate admin password on start? - RoomAccess AccessMode - RoomAccessPin string // The current pin - SessionKey string // key for session data - StreamKey string - StreamStats bool - TitleLength int // maximum length of the title that can be set with the /playing - TwitchClientID string // client id from twitch developers portal - WrappedEmotesOnly bool // only allow "wrapped" emotes. eg :Kappa: and [Kappa] but not Kappa + AdminPassword string + ApprovedEmotes []string // list of channels that have been approved for emote use. Global emotes are always "approved". + Bans []BanInfo + LetThemLurk bool // whether or not to announce users joining/leaving chat + ListenAddress string + LogFile string + LogLevel common.LogLevel + MaxMessageCount int + NewPin bool // Auto generate a new pin on start. Overwrites RoomAccessPin if set. + PageTitle string // primary value for the page <title> element + RegenAdminPass bool // regenerate admin password on start? + RoomAccess AccessMode + RoomAccessPin string // The current pin + SessionKey string // key for session data + StreamKey string + StreamStats bool + TitleLength int // maximum length of the title that can be set with the /playing + TwitchClientID string // client id from twitch developers portal + TwitchClientSecret string // OAuth from twitch developers portal: https://dev.twitch.tv/docs/authentication/getting-tokens-oauth#oauth-client-credentials-flow + WrappedEmotesOnly bool // only allow "wrapped" emotes. eg :Kappa: and [Kappa] but not Kappa // Rate limiting stuff, in seconds RateLimitChat time.Duration diff --git a/settings_example.json b/settings_example.json index 53b35e5..620f2e0 100644 --- a/settings_example.json +++ b/settings_example.json @@ -17,5 +17,7 @@ "RegenAdminPass": true, "StreamKey": "ALongStreamKey", "TitleLength": 50, + "TwitchClientID": "", + "TwitchClientSecret": "", "WrappedEmotesOnly": false } From d4d513420c72226e468702f21fbfe249f7626742 Mon Sep 17 00:00:00 2001 From: Alex Dunn <dunn.alex@gmail.com> Date: Sat, 6 Jun 2020 15:55:03 -0700 Subject: [PATCH 07/10] extract inlined css into conditional classes --- static/base.html | 6 ++---- static/css/site.css | 33 ++++++++++++++++++++++++++------- static/help.html | 2 +- static/main.html | 29 ++++++++++------------------- 4 files changed, 39 insertions(+), 31 deletions(-) diff --git a/static/base.html b/static/base.html index 8bc8225..a2b2251 100644 --- a/static/base.html +++ b/static/base.html @@ -15,9 +15,7 @@ <body class="scrollbar"> <img id="remote" src="/static/img/remote.png" onclick="flipRemote();" /> <div id="devKeys"></div> - <div class="root"> - {{template "body" .}} - </div> + {{template "body" .}} </body> -</html> \ No newline at end of file +</html> diff --git a/static/css/site.css b/static/css/site.css index 47f8193..bf966ef 100644 --- a/static/css/site.css +++ b/static/css/site.css @@ -56,12 +56,13 @@ input[type=text] { font-weight: bold; } -.root { - max-width: var(--var-max-width); - max-height: var(--var-max-height); - height: var(--var-max-height); - width: var(--var-max-width); - margin: 0px 1vw; +.grid-root { + display: grid; + height: var(--var-max-height); + margin: 0px 1vw; + max-height: var(--var-max-height); + max-width: var(--var-max-width); + width: var(--var-max-width); } .pretty-button { @@ -200,7 +201,7 @@ input[type=text] { height: 100%; width: 100%; position: absolute; - background-color: rgb(0, 0, 0, 0.75); + background-color: rgba(0, 0, 0, 0.75); z-index: 3; text-align: center; vertical-align: middle; @@ -400,3 +401,21 @@ input[type=text] { z-index: 99; color: var(--var-contrast-color); } + +/* ------------------- */ +/* CONDITIONAL CLASSES */ +/* ------------------- */ + +/* ------------- */ +/* COMBINED MODE */ +/* ------------- */ +.combined { + grid-template-columns: 5fr 1fr; +} + +/* --------------- */ +/* VIDEO ONLY MODE */ +/* --------------- */ +.video-only #videoElement { + height: 99vh; +} diff --git a/static/help.html b/static/help.html index 83ecb99..92ac6de 100644 --- a/static/help.html +++ b/static/help.html @@ -29,4 +29,4 @@ </dl> {{end}} </div> -{{end}} \ No newline at end of file +{{end}} diff --git a/static/main.html b/static/main.html index b2cd83f..ac16236 100644 --- a/static/main.html +++ b/static/main.html @@ -6,35 +6,26 @@ <script> maxMessageCount = {{.MessageHistoryCount }} </script> -<style> - .root { - display: grid; - } -</style> {{end}} {{if .Video}} <script type="application/javascript" src="/static/js/flv.min.js"></script> <script type="application/javascript" src="/static/js/video.js"></script> -{{if not .Chat}} -<style> - #videoElement { - height: 99vh; - } -</style> -{{end}} {{end}} -{{if and .Video .Chat}} -<style> - .root { - grid-template-columns: 5fr 1fr; - } -</style> -{{end}} +{{/* end define header */}} {{end}} {{define "body"}} + +{{ if and .Chat .Video }} +<div class="grid-root combined"> +{{ else if .Video }} +<div class="grid-root video-only"> +{{ else }} +<div class="grid-root"> +{{ end }} + {{if .Video}} <div id="videoWrapper"> <div id="videoOverlay"> From 25890d22c76cf4bdd541bc15e5a346f8490556b2 Mon Sep 17 00:00:00 2001 From: Alex Dunn <dunn.alex@gmail.com> Date: Sun, 7 Jun 2020 14:36:14 -0700 Subject: [PATCH 08/10] emotes: display in grid instead of one per line --- static/css/site.css | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/static/css/site.css b/static/css/site.css index 47f8193..76b1b68 100644 --- a/static/css/site.css +++ b/static/css/site.css @@ -110,16 +110,17 @@ input[type=text] { } #emotesbody { - color: var(--var-message-color); + color: var(--var-message-color); } .emotedef { - display: flex; - flex-direction: row; + float: left; + padding: 5px 5px 15px 5px; } -.emotedef div { - padding: 5px; +.emotedef img { + height: 112px; + width: 112px; } .notice { From 43e70eb9affecb6c5e9a8a48fc58a71d169b54ab Mon Sep 17 00:00:00 2001 From: Alex Dunn <dunn.alex@gmail.com> Date: Mon, 8 Jun 2020 19:29:50 -0700 Subject: [PATCH 09/10] readme: document settings.json --- readme.md | 111 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 75 insertions(+), 36 deletions(-) diff --git a/readme.md b/readme.md index 14b53ba..ebf1224 100644 --- a/readme.md +++ b/readme.md @@ -20,7 +20,7 @@ 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 the newer version. -## Install +### Compile and install To just download and run: @@ -31,6 +31,43 @@ $ make $ ./MovieNight ``` +### Docker build +MovieNight provides a Dockerfile and a docker-compose file to run MovieNight using Docker. + +#### Building the Container +Install Docker, clone the repository and build: + +```shell +docker build -t movienight . +``` + +#### Running the Container +Run the image once it's built: + +```shell +docker run -d -p 8089:8089 -p 1935:1935 [-v ./settings.json:/config/settings.json] movienight +``` + +Explanation: +- **-d** runs the container in the background. +- **-p 8089:8089** maps the MovieNight web interface to port 8089 on the server. +- **-p 1935:1935** maps the RTMP port for OBS to port 1935 (default RTMP port) on the server. +- **-v ./settings.json:/config/settings.json** maps the file *settings.json* into the container. [OPTIONAL] + +#### docker-compose +docker-compose will automatically build the image, no need to build it manually. + +Install Docker and docker-compose, clone the repository and change into the directory *./docker*. Then run: + +```shell +docker-compose up -d +``` + +This docker-compose file will create a volume called *movienight-config* and automatically add the standard *settings.json* file to it. It also maps port 8089 and 1935 to the same ports of the host. + +#### Notes for Running Using docker-compose +The container needs to be restarted to apply any changes you make to *settings.json*. + ## Usage Now you can use OBS to push a stream to the server. Set the stream URL to @@ -70,40 +107,42 @@ Usage of .\MovieNight.exe: host:port of the MovieNight (default ":8089") ``` -## Docker -MovieNight provides a Dockerfile and a docker-compose file to run MovieNight using Docker. +## Configuration -### Dockerfile -#### Building the Container -Install Docker, clone the repository and build: +MovieNight’s configuration is controlled by `settings.json`: -```shell -docker build -t movienight . -``` - -#### Running the Container -Run the image once it's built: - -```shell -docker run -d -p 8089:8089 -p 1935:1935 [-v ./settings.json:/config/settings.json] movienight -``` - -Explanation: -- **-d** runs the container in the background. -- **-p 8089:8089** maps the MovieNight web interface to port 8089 on the server. -- **-p 1935:1935** maps the RTMP port for OBS to port 1935 (default RTMP port) on the server. -- **-v ./settings.json:/config/settings.json** maps the file *settings.json* into the container. [OPTIONAL] - -### docker-compose -docker-compose will automatically build the image, no need to build it manually. - -Install Docker and docker-compose, clone the repository and change into the directory *./docker*. Then run: - -```shell -docker-compose up -d -``` - -This docker-compose file will create a volume called *movienight-config* and automatically add the standard *settings.json* file to it. It also maps port 8089 and 1935 to the same ports of the host. - -#### Notes for Running Using docker-compose -The container needs to be restarted to apply any changes you make to *settings.json*. +- `AdminPassword`: users can enter `/auth <value>` into chat to grant themselves + admin privileges. This value is automatically regenerated unless + `RegenAdminPass` is false. +- `ApprovedEmotes`: list of Twitch users whose emotes can be imported into + MovieNight. Using `/addemotes <username>` in chat will add to this list. +- `Bans`: list of banned users. +- `LetThemLurk`: if false, announces when a user enters and leaves chat. +- `ListenAddress`: the port that MovieNight listens on, formatted as `:8089`. +- `LogFile`: the path of the MovieNight logfile, relative to the executable. +- `LogLevel`: the log level, defaults to `debug`. +- `MaxMessageCount`: the number of messages displayed in the chat window. +- `NewPin`: if true, regenerates `RoomAccessPin` when the server starts. +- `PageTitle`: The base string used in the `<title>` element of the page. When + the stream title is set with `/playing`, it is appended; e.g., `Movie Night | The Man Who Killed Hitler and Then the Bigfoot` +- `RegenAdminPass`: if true, regenerates `AdminPassword` when the server starts. +- `RoomAccess`: the access policy of the chat room; this is managed by the + application and should not be edited manually. +- `RoomAccessPin`: if set, serves as the password required to enter the chatroom. +- `SessionKey`: key used for storing session data (cookies etc.) +- `StreamKey`: the key that OBS will use to connect to MovieNight. +- `StreamStats`: if true, prints statistics for the stream on server shutdown. +- `TitleLength`: the maximum allowed length for the stream title (set with `/playing`). +- `TwitchClientID`: OAuth client ID for the Twitch API, used for fetching emotes +- `TwitchClientSecret`: OAuth client secret for the Twitch API; [can be generated locally with curl](https://dev.twitch.tv/docs/authentication/getting-tokens-oauth#oauth-client-credentials-flow). +- `WrappedEmotesOnly`: if true, requires that emote codes be wrapped in colons + or brackets; e.g., `:PogChamp:` +- `RateLimitChat`: the number of seconds between each message a non-privileged + user can post in chat. +- `RateLimitNick`: the number of seconds before a user can change their nick again. +- `RakeLimitColor`: the number of seconds before a user can change their color again. +- `RateLimitAuth`: the number of seconds between each allowed auth attempt +- `RateLimitDuplicate`: the numeber of seconds before a user can post a + duplicate message. +- `NoCache`: if true, set `Cache-Control: no-cache, must-revalidate` in the HTTP + header, to prevent caching responses. From e8833b16e1a6b70117593b25bcffcfb2cab42ace Mon Sep 17 00:00:00 2001 From: Alex Dunn <dunn.alex@gmail.com> Date: Mon, 8 Jun 2020 19:33:48 -0700 Subject: [PATCH 10/10] readme: add table of contents --- readme.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/readme.md b/readme.md index ebf1224..c7e75be 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1,19 @@ +<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-refresh-toc --> +**Table of Contents** + +- [MovieNight stream server](#movienight-stream-server) + - [Build requirements](#build-requirements) + - [Older Go Versions](#older-go-versions) + - [Compile and install](#compile-and-install) + - [Docker build](#docker-build) + - [Building the Container](#building-the-container) + - [Running the Container](#running-the-container) + - [docker-compose](#docker-compose) + - [Notes for Running Using docker-compose](#notes-for-running-using-docker-compose) + - [Usage](#usage) + - [Configuration](#configuration) + +<!-- markdown-toc end --> # MovieNight stream server [![Build status](https://api.travis-ci.org/zorchenhimer/MovieNight.svg?branch=master)](https://travis-ci.org/zorchenhimer/MovieNight)