feat: add custom username suggestions pool (#1644)

*  add custom username suggestions pool

* 🚸 add minimum of 10 suggested usernames until custom pool is used
This commit is contained in:
Jannik
2022-01-12 19:18:08 +01:00
committed by GitHub
parent 814c65eeb7
commit d3cfc40b5c
6 changed files with 71 additions and 11 deletions

View File

@ -17,6 +17,7 @@ import (
func GetServerConfig(w http.ResponseWriter, r *http.Request) {
ffmpeg := utils.ValidatedFfmpegPath(data.GetFfMpegPath())
usernameBlocklist := data.GetForbiddenUsernameList()
usernameSuggestions := data.GetSuggestedUsernamesList()
videoQualityVariants := make([]models.StreamOutputVariant, 0)
for _, variant := range data.GetStreamOutputVariants() {
@ -64,6 +65,7 @@ func GetServerConfig(w http.ResponseWriter, r *http.Request) {
SupportedCodecs: transcoder.GetCodecs(ffmpeg),
VideoCodec: data.GetVideoCodec(),
ForbiddenUsernames: usernameBlocklist,
SuggestedUsernames: usernameSuggestions,
}
w.Header().Set("Content-Type", "application/json")
@ -89,6 +91,7 @@ type serverConfigAdminResponse struct {
SupportedCodecs []string `json:"supportedCodecs"`
VideoCodec string `json:"videoCodec"`
ForbiddenUsernames []string `json:"forbiddenUsernames"`
SuggestedUsernames []string `json:"suggestedUsernames"`
}
type videoSettings struct {