A clean, Markdown-based publishing platform made for writers. Write together, and build a community. https://writefreely.org
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.
 
 
 
 
 

30 lines
738 B

  1. // package page provides mechanisms and data for generating a WriteFreely page.
  2. package page
  3. import (
  4. "github.com/writeas/writefreely/config"
  5. "strings"
  6. )
  7. type StaticPage struct {
  8. // App configuration
  9. config.AppCfg
  10. Version string
  11. HeaderNav bool
  12. // Request values
  13. Path string
  14. Username string
  15. Values map[string]string
  16. Flashes []string
  17. }
  18. // SanitizeHost alters the StaticPage to contain a real hostname. This is
  19. // especially important for the Tor hidden service, as it can be served over
  20. // proxies, messing up the apparent hostname.
  21. func (sp *StaticPage) SanitizeHost(cfg *config.Config) {
  22. if cfg.Server.HiddenHost != "" && strings.HasPrefix(sp.Host, cfg.Server.HiddenHost) {
  23. sp.Host = cfg.Server.HiddenHost
  24. }
  25. }