More fixes
This commit is contained in:
@@ -32,18 +32,15 @@ var (
|
||||
|
||||
// API ...
|
||||
type API struct {
|
||||
router *Router
|
||||
config *Config
|
||||
cache *Cache
|
||||
archive Archiver
|
||||
db Store
|
||||
pm passwords.Passwords
|
||||
tasks *Dispatcher
|
||||
router *Router
|
||||
config *Config
|
||||
db Store
|
||||
pm passwords.Passwords
|
||||
}
|
||||
|
||||
// NewAPI ...
|
||||
func NewAPI(router *Router, config *Config, cache *Cache, archive Archiver, db Store, pm passwords.Passwords, tasks *Dispatcher) *API {
|
||||
api := &API{router, config, cache, archive, db, pm, tasks}
|
||||
func NewAPI(router *Router, config *Config, db Store, pm passwords.Passwords) *API {
|
||||
api := &API{router, config, db, pm}
|
||||
|
||||
api.initRoutes()
|
||||
|
||||
@@ -54,11 +51,6 @@ func (a *API) initRoutes() {
|
||||
router := a.router.Group("/api/v1")
|
||||
|
||||
router.GET("/ping", a.PingEndpoint())
|
||||
router.POST("/auth", a.AuthEndpoint())
|
||||
|
||||
// Support / Report endpoints
|
||||
router.POST("/support", a.isAuthorized(a.SupportEndpoint()))
|
||||
router.POST("/report", a.isAuthorized(a.ReportEndpoint()))
|
||||
}
|
||||
|
||||
// CreateToken ...
|
||||
@@ -116,14 +108,6 @@ func (a *API) getLoggedInUser(r *http.Request) *User {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Every registered new user follows themselves
|
||||
// TODO: Make this configurable server behaviour?
|
||||
if user.Following == nil {
|
||||
user.Following = make(map[string]string)
|
||||
}
|
||||
|
||||
user.Following[user.Username] = user.URL
|
||||
|
||||
return user
|
||||
|
||||
}
|
||||
@@ -154,13 +138,6 @@ func (a *API) isAuthorized(endpoint httprouter.Handle) httprouter.Handle {
|
||||
return
|
||||
}
|
||||
|
||||
// Every registered new user follows themselves
|
||||
// TODO: Make this configurable server behaviour?
|
||||
if user.Following == nil {
|
||||
user.Following = make(map[string]string)
|
||||
}
|
||||
user.Following[user.Username] = user.URL
|
||||
|
||||
ctx := context.WithValue(r.Context(), TokenContextKey, token)
|
||||
ctx = context.WithValue(ctx, UserContextKey, user)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user