mirror of
https://codeberg.org/superseriousbusiness/gotosocial.git
synced 2024-12-18 23:21:49 +03:00
083099a957
* reference logrus' global logger instead of passing and storing a logger reference everywhere * always directly use global logrus logger instead of referencing an instance * test suites should also directly use the global logrus logger * rename gin logging function to clarify that it's middleware * correct comments which erroneously referenced removed logger parameter * setting log level for tests now uses logrus' exported type instead of the string value, to guarantee error isn't possible
36 lines
1 KiB
Go
36 lines
1 KiB
Go
package instance
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/superseriousbusiness/gotosocial/internal/api"
|
|
"github.com/superseriousbusiness/gotosocial/internal/config"
|
|
"github.com/superseriousbusiness/gotosocial/internal/processing"
|
|
"github.com/superseriousbusiness/gotosocial/internal/router"
|
|
)
|
|
|
|
const (
|
|
// InstanceInformationPath is for serving instance info requests
|
|
InstanceInformationPath = "api/v1/instance"
|
|
)
|
|
|
|
// Module implements the ClientModule interface
|
|
type Module struct {
|
|
config *config.Config
|
|
processor processing.Processor
|
|
}
|
|
|
|
// New returns a new instance information module
|
|
func New(config *config.Config, processor processing.Processor) api.ClientModule {
|
|
return &Module{
|
|
config: config,
|
|
processor: processor,
|
|
}
|
|
}
|
|
|
|
// Route satisfies the ClientModule interface
|
|
func (m *Module) Route(s router.Router) error {
|
|
s.AttachHandler(http.MethodGet, InstanceInformationPath, m.InstanceInformationGETHandler)
|
|
s.AttachHandler(http.MethodPatch, InstanceInformationPath, m.InstanceUpdatePATCHHandler)
|
|
return nil
|
|
}
|