feat: publish standalone worker

Separate worker packaging and service lifecycle from the control plane.
Этот коммит содержится в:
Gleb Tv
2026-07-13 17:55:14 +03:00
Коммит 2c7a0236da
309 изменённых файлов: 44004 добавлений и 0 удалений

40
internal/webapp/page_data.go Обычный файл
Просмотреть файл

@@ -0,0 +1,40 @@
package webapp
import (
"net/http"
"time"
)
// basePageData is the struct every page template receives (embedded
// into the per-page struct). The shared layout looks up Title,
// IsLogin, CSRFToken, Version, BuildDate, and StartedAt from here so
// handlers do not need to repeat those fields on every page.
type basePageData struct {
Title string
IsLogin bool
CSRFToken string
Version string
BuildDate string
StartedAt time.Time
}
// newBasePage builds the common fields. isLogin is true for the
// login page so the layout can hide the navigation; csrfToken is the
// empty string when isLogin is true (there is no session yet).
func (s *Server) newBasePage(_ *http.Request, title string, sess *Session) basePageData {
return basePageData{
Title: title,
IsLogin: sess == nil,
CSRFToken: tokenOrEmpty(sess),
Version: s.deps.Version,
BuildDate: s.deps.BuildDate,
StartedAt: s.deps.StartedAt,
}
}
func tokenOrEmpty(sess *Session) string {
if sess == nil {
return ""
}
return sess.CSRFToken
}