From 3be2b52688d0eb129e73f8ffd73bbf6a63700cf9 Mon Sep 17 00:00:00 2001 From: James Tombleson Date: Sun, 21 Aug 2022 11:18:28 -0700 Subject: [PATCH] updated new twitch given it no longer needs a url param (#25) --- routes/sources.go | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/routes/sources.go b/routes/sources.go index 839b1ed..f033409 100644 --- a/routes/sources.go +++ b/routes/sources.go @@ -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(),