mirror of https://github.com/writeas/writefreely
A focused writing and publishing space.
https://write.with.parts
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
30 lines
738 B
6 years ago
|
// package page provides mechanisms and data for generating a WriteFreely page.
|
||
|
package page
|
||
|
|
||
|
import (
|
||
|
"github.com/writeas/writefreely/config"
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
type StaticPage struct {
|
||
|
// App configuration
|
||
|
config.AppCfg
|
||
|
Version string
|
||
|
HeaderNav bool
|
||
|
|
||
|
// Request values
|
||
|
Path string
|
||
|
Username string
|
||
|
Values map[string]string
|
||
|
Flashes []string
|
||
|
}
|
||
|
|
||
|
// SanitizeHost alters the StaticPage to contain a real hostname. This is
|
||
|
// especially important for the Tor hidden service, as it can be served over
|
||
|
// proxies, messing up the apparent hostname.
|
||
|
func (sp *StaticPage) SanitizeHost(cfg *config.Config) {
|
||
|
if cfg.Server.HiddenHost != "" && strings.HasPrefix(sp.Host, cfg.Server.HiddenHost) {
|
||
|
sp.Host = cfg.Server.HiddenHost
|
||
|
}
|
||
|
}
|