0
0
mirror of https://github.com/rls-moe/nyx synced 2024-11-22 22:12:24 +00:00

Added some useful middleware to stop server overloads and set default to enable insecure cookies

This commit is contained in:
Tim Schuster 2017-03-16 20:28:36 +01:00
parent 53039e6102
commit bc02972eef
No known key found for this signature in database
GPG Key ID: F9E27097EFB77F61
3 changed files with 5 additions and 1 deletions

View File

@ -60,7 +60,7 @@ func Load() (*Config, error) {
HostnameWhiteList: []string{}, HostnameWhiteList: []string{},
ListenOn: ":8080", ListenOn: ":8080",
MasterSecret: "changeme", MasterSecret: "changeme",
DisableSecurity: false, DisableSecurity: true,
Captcha: CaptchaConfig{ Captcha: CaptchaConfig{
Mode: CaptchaDisabled, Mode: CaptchaDisabled,
}, },

View File

@ -75,8 +75,10 @@ func LoadTemplates() error {
func Router(r chi.Router) { func Router(r chi.Router) {
r.Get("/", serveDir) r.Get("/", serveDir)
r.Get("/dir.html", serveDir) r.Get("/dir.html", serveDir)
r.Get("/:board/", serveBoard)
r.Get("/:board/board.html", serveBoard) r.Get("/:board/board.html", serveBoard)
r.Post("/:board/new_thread.sh", handleNewThread) r.Post("/:board/new_thread.sh", handleNewThread)
r.Get("/:board/:thread/", serveThread)
r.Get("/:board/:thread/thread.html", serveThread) r.Get("/:board/:thread/thread.html", serveThread)
r.Get("/:board/:thread/:reply/:unused.png", serveFullImage) r.Get("/:board/:thread/:reply/:unused.png", serveFullImage)
r.Get("/:board/:thread/:reply/thumb.png", serveThumb) r.Get("/:board/:thread/:reply/thumb.png", serveThumb)

View File

@ -35,6 +35,8 @@ func Start(config *config.Config) error {
r.Use(middleware.Logger) r.Use(middleware.Logger)
r.Use(middleware.Recoverer) r.Use(middleware.Recoverer)
r.Use(middleware.CloseNotify) r.Use(middleware.CloseNotify)
r.Use(middleware.ThrottleBacklog(1000, 6000, 10*time.Second))
r.Use(middleware.Heartbeat("/ping"))
r.Use(middle.LimitSize(config)) r.Use(middle.LimitSize(config))
r.Use(middleware.DefaultCompress) r.Use(middleware.DefaultCompress)