Use internal API to get channel/feed info
This commit is contained in:
parent
7156920798
commit
e491a61dae
|
@ -41,10 +41,10 @@ type indexPage struct {
|
|||
type settingsPage struct {
|
||||
Session session
|
||||
|
||||
CurrentChannel string
|
||||
CurrentChannel microsub.Channel
|
||||
|
||||
Channels map[string]microsub.Channel
|
||||
Feeds map[string][]microsub.Feed
|
||||
Channels []microsub.Channel
|
||||
Feeds []microsub.Feed
|
||||
}
|
||||
type logsPage struct {
|
||||
Session session
|
||||
|
@ -233,9 +233,16 @@ func (h *mainHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
var page settingsPage
|
||||
page.Session = sess
|
||||
page.Channels = h.Backend.Channels
|
||||
page.Feeds = h.Backend.Feeds
|
||||
page.CurrentChannel = r.URL.Query().Get("uid")
|
||||
currentChannel := r.URL.Query().Get("uid")
|
||||
page.Channels, err = h.Backend.ChannelsGetList()
|
||||
page.Feeds, err = h.Backend.FollowGetList(currentChannel)
|
||||
|
||||
for _, v := range page.Channels {
|
||||
if v.UID == currentChannel {
|
||||
page.CurrentChannel = v
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
err = h.Templates.ExecuteTemplate(w, "channel.html", page)
|
||||
if err != nil {
|
||||
|
@ -284,8 +291,8 @@ func (h *mainHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
var page settingsPage
|
||||
page.Session = sess
|
||||
page.Channels = h.Backend.Channels
|
||||
page.Feeds = h.Backend.Feeds
|
||||
page.Channels, err = h.Backend.ChannelsGetList()
|
||||
//page.Feeds = h.Backend.Feeds
|
||||
|
||||
err = h.Templates.ExecuteTemplate(w, "settings.html", page)
|
||||
if err != nil {
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
<h1 class="title">Ekster - Microsub server</h1>
|
||||
|
||||
{{ $channel := index .Channels .CurrentChannel }}
|
||||
{{ $channel := .CurrentChannel }}
|
||||
|
||||
<nav class="breadcrumb" aria-label="breadcrumbs">
|
||||
<ul>
|
||||
|
@ -53,7 +53,7 @@
|
|||
<h2 class="subtitle">{{ $channel.Name }}</h2>
|
||||
|
||||
<div class="channel">
|
||||
{{ range index .Feeds .CurrentChannel }}
|
||||
{{ range .Feeds }}
|
||||
<div class="feed box">
|
||||
<div class="name">
|
||||
<a href="{{ .URL }}">{{ .URL }}</a>
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
<div class="name">
|
||||
<a href="/settings/channel?uid={{ .UID }}">
|
||||
{{ .Name }}
|
||||
<span class="unread tag is-dark">{{ index $.Feeds .UID | len }}</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue
Block a user