aboutsummaryrefslogtreecommitdiffhomepage
path: root/ui/controller.go
blob: b3e85af4762136013481e3cfa75c9672852ee444 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright 2017 Frédéric Guillot. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.

package ui

import (
	"github.com/gorilla/mux"
	"github.com/miniflux/miniflux/config"
	"github.com/miniflux/miniflux/locale"
	"github.com/miniflux/miniflux/reader/feed"
	"github.com/miniflux/miniflux/scheduler"
	"github.com/miniflux/miniflux/storage"
	"github.com/miniflux/miniflux/template"
)

// Controller contains all HTTP handlers for the user interface.
type Controller struct {
	cfg         *config.Config
	store       *storage.Storage
	pool        *scheduler.WorkerPool
	feedHandler *feed.Handler
	tpl         *template.Engine
	router      *mux.Router
	translator  *locale.Translator
}

// NewController returns a new Controller.
func NewController(cfg *config.Config, store *storage.Storage, pool *scheduler.WorkerPool, feedHandler *feed.Handler, tpl *template.Engine, translator *locale.Translator, router *mux.Router) *Controller {
	return &Controller{
		cfg:         cfg,
		store:       store,
		pool:        pool,
		feedHandler: feedHandler,
		tpl:         tpl,
		translator:  translator,
		router:      router,
	}
}