Hermes is an open-source E-Mail tracking solution that is written in Go. It tracks emails using a tracking pixel.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
2.3 KiB

4 years ago
  1. package app
  2. import (
  3. "github.com/revel/revel"
  4. )
  5. var (
  6. // AppVersion revel app version (ldflags)
  7. AppVersion string
  8. // BuildTime revel app build-time (ldflags)
  9. BuildTime string
  10. )
  11. func init() {
  12. // Filters is the default set of global filters.
  13. revel.Filters = []revel.Filter{
  14. revel.PanicFilter, // Recover from panics and display an error page instead.
  15. revel.RouterFilter, // Use the routing table to select the right Action
  16. revel.FilterConfiguringFilter, // A hook for adding or removing per-Action filters.
  17. revel.ParamsFilter, // Parse parameters into Controller.Params.
  18. revel.SessionFilter, // Restore and write the session cookie.
  19. revel.FlashFilter, // Restore and write the flash cookie.
  20. revel.ValidationFilter, // Restore kept validation errors and save new ones from cookie.
  21. revel.I18nFilter, // Resolve the requested language
  22. HeaderFilter, // Add some security based headers
  23. revel.InterceptorFilter, // Run interceptors around the action.
  24. revel.CompressFilter, // Compress the result.
  25. revel.BeforeAfterFilter, // Call the before and after filter functions
  26. revel.ActionInvoker, // Invoke the action.
  27. }
  28. // Register startup functions with OnAppStart
  29. // revel.DevMode and revel.RunMode only work inside of OnAppStart. See Example Startup Script
  30. // ( order dependent )
  31. // revel.OnAppStart(ExampleStartupScript)
  32. // revel.OnAppStart(InitDB)
  33. // revel.OnAppStart(FillCache)
  34. }
  35. // HeaderFilter adds common security headers
  36. // There is a full implementation of a CSRF filter in
  37. // https://github.com/revel/modules/tree/master/csrf
  38. var HeaderFilter = func(c *revel.Controller, fc []revel.Filter) {
  39. c.Response.Out.Header().Add("X-Frame-Options", "SAMEORIGIN")
  40. c.Response.Out.Header().Add("X-XSS-Protection", "1; mode=block")
  41. c.Response.Out.Header().Add("X-Content-Type-Options", "nosniff")
  42. c.Response.Out.Header().Add("Referrer-Policy", "strict-origin-when-cross-origin")
  43. fc[0](c, fc[1:]) // Execute the next filter stage.
  44. }
  45. //func ExampleStartupScript() {
  46. // // revel.DevMod and revel.RunMode work here
  47. // // Use this script to check for dev mode and set dev/prod startup scripts here!
  48. // if revel.DevMode == true {
  49. // // Dev mode
  50. // }
  51. //}