feat: show version in admin page
This commit is contained in:
parent
c920eb94a0
commit
a0f12efd65
3 changed files with 41 additions and 14 deletions
|
@ -46,6 +46,7 @@ type TemplateData struct {
|
|||
Channels []*model.Channel
|
||||
Channel *model.Channel
|
||||
ChannelPlugin *model.ChannelPlugin
|
||||
Version string
|
||||
}
|
||||
|
||||
// Admin represents the admin interface
|
||||
|
@ -55,10 +56,11 @@ type Admin struct {
|
|||
store *sessions.CookieStore
|
||||
templates map[string]*template.Template
|
||||
baseTemplate *template.Template
|
||||
version string
|
||||
}
|
||||
|
||||
// New creates a new Admin instance
|
||||
func New(cfg *config.Config, database *db.Database) *Admin {
|
||||
func New(cfg *config.Config, database *db.Database, version string) *Admin {
|
||||
// Create session store with appropriate options
|
||||
store := sessions.NewCookieStore([]byte(cfg.SecretKey))
|
||||
store.Options = &sessions.Options{
|
||||
|
@ -126,6 +128,7 @@ func New(cfg *config.Config, database *db.Database) *Admin {
|
|||
store: store,
|
||||
templates: templates,
|
||||
baseTemplate: baseTemplate,
|
||||
version: version,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,6 +267,7 @@ func (a *Admin) render(w http.ResponseWriter, r *http.Request, templateName stri
|
|||
data.LoggedIn = a.isLoggedIn(r)
|
||||
data.Path = r.URL.Path
|
||||
data.Flash = a.getFlashes(w, r)
|
||||
data.Version = a.version
|
||||
|
||||
// Get template
|
||||
tmpl, ok := a.templates[templateName]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue