Add channel type selection to the web interface
This commit is contained in:
parent
a72f3ce493
commit
9d3a23e5e4
|
@ -1,20 +1,3 @@
|
|||
/*
|
||||
ekster - microsub server
|
||||
Copyright (C) 2018 Peter Stuifzand
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package main
|
||||
|
||||
import (
|
||||
|
@ -668,6 +651,17 @@ func (h *mainHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
h.Backend.Settings[uid] = setting
|
||||
}
|
||||
|
||||
channelType := r.FormValue("type")
|
||||
|
||||
if setting, e := h.Backend.Settings[uid]; e {
|
||||
setting.ChannelType = channelType
|
||||
h.Backend.Settings[uid] = setting
|
||||
} else {
|
||||
setting = channelSetting{
|
||||
ChannelType: channelType,
|
||||
}
|
||||
h.Backend.Settings[uid] = setting
|
||||
}
|
||||
h.Backend.Debug()
|
||||
|
||||
http.Redirect(w, r, "/settings", 302)
|
||||
|
|
|
@ -68,6 +68,7 @@ type memoryBackend struct {
|
|||
type channelSetting struct {
|
||||
ExcludeRegex string
|
||||
IncludeRegex string
|
||||
ChannelType string
|
||||
}
|
||||
|
||||
// Debug interface for easy of use in other packages
|
||||
|
|
|
@ -67,15 +67,28 @@
|
|||
<input type="text" class="input" name="include_regex" value="{{ .CurrentSetting.IncludeRegex }}" placeholder="enter regex to track items" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<div class="select">
|
||||
<label class="label" for="type">Tracking Regex</label>
|
||||
<select name="type" id="type">
|
||||
<option value="null">Null</option>
|
||||
<option value="sorted-set">Sorted Set</option>
|
||||
<option value="stream">Streams</option>
|
||||
</select>
|
||||
</div>
|
||||
<input type="text" class="input" name="include_regex" value="{{ .CurrentSetting.IncludeRegex }}" placeholder="enter regex to track items" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<button type="submit" class="button is-primary">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="column">
|
||||
<h3 class="title is-4">Channels</h3>
|
||||
|
||||
<h3 class="title is-4">Feeds</h3>
|
||||
|
||||
<div class="channel">
|
||||
{{ range .Feeds }}
|
||||
<div class="feed box">
|
||||
|
|
Loading…
Reference in New Issue
Block a user