updated new twitch given it no longer needs a url param (#25)
This commit is contained in:
parent
06e50f956a
commit
3be2b52688
@ -213,34 +213,14 @@ func (s *Server) newYoutubeSource(w http.ResponseWriter, r *http.Request) {
|
|||||||
// NewTwitchSource
|
// NewTwitchSource
|
||||||
// @Summary Creates a new twitch source to monitor.
|
// @Summary Creates a new twitch source to monitor.
|
||||||
// @Param name query string true "name"
|
// @Param name query string true "name"
|
||||||
// @Param url query string true "url"
|
|
||||||
// @Tags Config, Source, Twitch
|
// @Tags Config, Source, Twitch
|
||||||
// @Router /config/sources/new/twitch [post]
|
// @Router /config/sources/new/twitch [post]
|
||||||
func (s *Server) newTwitchSource(w http.ResponseWriter, r *http.Request) {
|
func (s *Server) newTwitchSource(w http.ResponseWriter, r *http.Request) {
|
||||||
query := r.URL.Query()
|
query := r.URL.Query()
|
||||||
_name := query["name"][0]
|
_name := query["name"][0]
|
||||||
_url := query["url"][0]
|
|
||||||
//_tags := query["tags"][0]
|
|
||||||
|
|
||||||
if _url == "" {
|
tags := fmt.Sprintf("twitch, %v", _name)
|
||||||
http.Error(w, "url is missing a value", http.StatusBadRequest)
|
_url := fmt.Sprintf("https://twitch.tv/%v", _name)
|
||||||
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)
|
|
||||||
|
|
||||||
params := database.CreateSourceParams{
|
params := database.CreateSourceParams{
|
||||||
ID: uuid.New(),
|
ID: uuid.New(),
|
||||||
|
Loading…
Reference in New Issue
Block a user