Simplify channel update
This commit is contained in:
parent
9d3a23e5e4
commit
19ee6c927a
|
@ -626,42 +626,25 @@ func (h *mainHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
} else if r.URL.Path == "/settings/channel" {
|
} else if r.URL.Path == "/settings/channel" {
|
||||||
defer h.Backend.save()
|
defer h.Backend.save()
|
||||||
uid := r.FormValue("uid")
|
uid := r.FormValue("uid")
|
||||||
// name := r.FormValue("name")
|
|
||||||
excludeRegex := r.FormValue("exclude_regex")
|
excludeRegex := r.FormValue("exclude_regex")
|
||||||
|
|
||||||
if setting, e := h.Backend.Settings[uid]; e {
|
|
||||||
setting.ExcludeRegex = excludeRegex
|
|
||||||
h.Backend.Settings[uid] = setting
|
|
||||||
} else {
|
|
||||||
setting = channelSetting{
|
|
||||||
ExcludeRegex: excludeRegex,
|
|
||||||
}
|
|
||||||
h.Backend.Settings[uid] = setting
|
|
||||||
}
|
|
||||||
|
|
||||||
includeRegex := r.FormValue("include_regex")
|
includeRegex := r.FormValue("include_regex")
|
||||||
|
|
||||||
if setting, e := h.Backend.Settings[uid]; e {
|
|
||||||
setting.IncludeRegex = includeRegex
|
|
||||||
h.Backend.Settings[uid] = setting
|
|
||||||
} else {
|
|
||||||
setting = channelSetting{
|
|
||||||
IncludeRegex: includeRegex,
|
|
||||||
}
|
|
||||||
h.Backend.Settings[uid] = setting
|
|
||||||
}
|
|
||||||
|
|
||||||
channelType := r.FormValue("type")
|
channelType := r.FormValue("type")
|
||||||
|
|
||||||
if setting, e := h.Backend.Settings[uid]; e {
|
if setting, e := h.Backend.Settings[uid]; e {
|
||||||
|
setting.ExcludeRegex = excludeRegex
|
||||||
|
setting.IncludeRegex = includeRegex
|
||||||
setting.ChannelType = channelType
|
setting.ChannelType = channelType
|
||||||
h.Backend.Settings[uid] = setting
|
h.Backend.Settings[uid] = setting
|
||||||
} else {
|
} else {
|
||||||
setting = channelSetting{
|
setting = channelSetting{
|
||||||
ChannelType: channelType,
|
ExcludeRegex: excludeRegex,
|
||||||
|
IncludeRegex: includeRegex,
|
||||||
|
ChannelType: channelType,
|
||||||
}
|
}
|
||||||
h.Backend.Settings[uid] = setting
|
h.Backend.Settings[uid] = setting
|
||||||
}
|
}
|
||||||
|
|
||||||
h.Backend.Debug()
|
h.Backend.Debug()
|
||||||
|
|
||||||
http.Redirect(w, r, "/settings", 302)
|
http.Redirect(w, r, "/settings", 302)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user