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