35 lines
826 B
Go
Executable file
35 lines
826 B
Go
Executable file
package index
|
|
|
|
import (
|
|
"html/template"
|
|
"io"
|
|
|
|
"git.cliffbreak.de/Cliffbreak/tsviewer/features/api/channel"
|
|
"git.cliffbreak.de/Cliffbreak/tsviewer/features/api/client"
|
|
"git.cliffbreak.de/Cliffbreak/tsviewer/features/api/server"
|
|
)
|
|
|
|
type Service interface {
|
|
ServerInfo() (*server.Server, error)
|
|
Clients() ([]*client.Client, error)
|
|
Channels() ([]*channel.Channel, error)
|
|
ChannelsRaw() ([]*channel.Channel, error)
|
|
}
|
|
|
|
type IndexPage struct {
|
|
Server server.Server
|
|
Channels []*channel.Channel
|
|
Clients []*client.Client
|
|
}
|
|
|
|
func NewPage(server server.Server, channels []*channel.Channel, clients []*client.Client) *IndexPage {
|
|
return &IndexPage{
|
|
Server: server,
|
|
Channels: channels,
|
|
Clients: clients,
|
|
}
|
|
}
|
|
|
|
func (page IndexPage) Send(w io.Writer, t template.Template) {
|
|
t.Lookup("index.html").Execute(w, page)
|
|
}
|