updated new twitch given it no longer needs a url param (#25)

This commit is contained in:
James Tombleson 2022-08-21 11:18:28 -07:00 committed by GitHub
parent 06e50f956a
commit 3be2b52688
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -213,34 +213,14 @@ func (s *Server) newYoutubeSource(w http.ResponseWriter, r *http.Request) {
// NewTwitchSource
// @Summary Creates a new twitch source to monitor.
// @Param name query string true "name"
// @Param url query string true "url"
// @Tags Config, Source, Twitch
// @Router /config/sources/new/twitch [post]
func (s *Server) newTwitchSource(w http.ResponseWriter, r *http.Request) {
query := r.URL.Query()
_name := query["name"][0]
_url := query["url"][0]
//_tags := query["tags"][0]
if _url == "" {
http.Error(w, "url is missing a value", http.StatusBadRequest)
return
}
if !strings.Contains(_url, "twitch.tv") {
http.Error(w, "invalid url", http.StatusBadRequest)
return
}
var tags string
/*
if _tags == "" {
tags = fmt.Sprintf("twitch, %v", _name)
} else {
}
*/
//tags = fmt.Sprintf("twitch, %v, %v", _name, _tags)
tags = fmt.Sprintf("twitch, %v", _name)
tags := fmt.Sprintf("twitch, %v", _name)
_url := fmt.Sprintf("https://twitch.tv/%v", _name)
params := database.CreateSourceParams{
ID: uuid.New(),