controller.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright 2017 Frédéric Guillot. All rights reserved.
  2. // Use of this source code is governed by the Apache 2.0
  3. // license that can be found in the LICENSE file.
  4. package ui
  5. import (
  6. "github.com/gorilla/mux"
  7. "github.com/miniflux/miniflux/config"
  8. "github.com/miniflux/miniflux/locale"
  9. "github.com/miniflux/miniflux/reader/feed"
  10. "github.com/miniflux/miniflux/scheduler"
  11. "github.com/miniflux/miniflux/storage"
  12. "github.com/miniflux/miniflux/template"
  13. )
  14. // Controller contains all HTTP handlers for the user interface.
  15. type Controller struct {
  16. cfg *config.Config
  17. store *storage.Storage
  18. pool *scheduler.WorkerPool
  19. feedHandler *feed.Handler
  20. tpl *template.Engine
  21. router *mux.Router
  22. translator *locale.Translator
  23. }
  24. // NewController returns a new Controller.
  25. func NewController(cfg *config.Config, store *storage.Storage, pool *scheduler.WorkerPool, feedHandler *feed.Handler, tpl *template.Engine, translator *locale.Translator, router *mux.Router) *Controller {
  26. return &Controller{
  27. cfg: cfg,
  28. store: store,
  29. pool: pool,
  30. feedHandler: feedHandler,
  31. tpl: tpl,
  32. translator: translator,
  33. router: router,
  34. }
  35. }