mirror of
https://github.com/rls-moe/nyx
synced 2024-11-14 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:
parent
53039e6102
commit
bc02972eef
@ -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,
|
||||||
},
|
},
|
||||||
|
@ -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)
|
||||||
|
@ -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)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user