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]
|
||||
|
|
|
@ -117,6 +117,19 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<footer class="footer footer-transparent d-print-none">
|
||||
<div class="container-xl">
|
||||
<div class="row text-center align-items-center flex-row-reverse">
|
||||
<div class="col-12 col-lg-auto mt-3 mt-lg-0">
|
||||
<ul class="list-inline list-inline-dots mb-0">
|
||||
<li class="list-inline-item">
|
||||
ButterRobot {{if .Version}}v{{.Version}}{{else}}(development){{end}}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<script src="https://unpkg.com/@tabler/core@latest/dist/js/tabler.min.js"></script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue