Added page about instance

This commit is contained in:
localhost_frssoft 2022-10-12 13:34:41 +03:00
parent fe304f60e9
commit 7dd90ac015
7 changed files with 81 additions and 0 deletions

View file

@ -737,6 +737,19 @@ func (s *service) AboutPage(c *client) (err error) {
return s.renderer.Render(c.rctx, c.w, renderer.AboutPage, data)
}
func (s *service) AboutInstance(c *client) (err error) {
cdata := s.cdata(c, "about", 0, 0, "")
instance, err := c.GetInstance(c.ctx)
if err != nil {
return
}
data := &renderer.AboutInstanceData{
CommonData: cdata,
Instance: instance,
}
return s.renderer.Render(c.rctx, c.w, renderer.AboutInstance, data)
}
func (s *service) EmojiPage(c *client) (err error) {
emojis, err := c.GetInstanceEmojis(c.ctx)
if err != nil {

View file

@ -220,6 +220,10 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler {
aboutPage := handle(func(c *client) error {
return s.AboutPage(c)
}, SESSION, HTML)
aboutInstance := handle(func(c *client) error {
return s.AboutInstance(c)
}, SESSION, HTML)
emojisPage := handle(func(c *client) error {
return s.EmojiPage(c)
@ -721,6 +725,7 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler {
r.HandleFunc("/user/{id}/{type}", userPage).Methods(http.MethodGet)
r.HandleFunc("/usersearch/{id}", userSearchPage).Methods(http.MethodGet)
r.HandleFunc("/about", aboutPage).Methods(http.MethodGet)
r.HandleFunc("/aboutinstance", aboutInstance).Methods(http.MethodGet)
r.HandleFunc("/emojis", emojisPage).Methods(http.MethodGet)
r.HandleFunc("/search", searchPage).Methods(http.MethodGet)
r.HandleFunc("/settings", settingsPage).Methods(http.MethodGet)