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.
 
 
 
 
 

40 lines
1.0 KiB

  1. /*
  2. * Copyright © 2018 A Bunch Tell LLC.
  3. *
  4. * This file is part of WriteFreely.
  5. *
  6. * WriteFreely is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Affero General Public License, included
  8. * in the LICENSE file in this source code package.
  9. */
  10. // package page provides mechanisms and data for generating a WriteFreely page.
  11. package page
  12. import (
  13. "github.com/writeas/writefreely/config"
  14. "strings"
  15. )
  16. type StaticPage struct {
  17. // App configuration
  18. config.AppCfg
  19. Version string
  20. HeaderNav bool
  21. // Request values
  22. Path string
  23. Username string
  24. Values map[string]string
  25. Flashes []string
  26. }
  27. // SanitizeHost alters the StaticPage to contain a real hostname. This is
  28. // especially important for the Tor hidden service, as it can be served over
  29. // proxies, messing up the apparent hostname.
  30. func (sp *StaticPage) SanitizeHost(cfg *config.Config) {
  31. if cfg.Server.HiddenHost != "" && strings.HasPrefix(sp.Host, cfg.Server.HiddenHost) {
  32. sp.Host = cfg.Server.HiddenHost
  33. }
  34. }