mirror of
https://github.com/writeas/htmlhouse
synced 2025-07-18 21:08:16 +00:00
Use explicity host name, not given one
This commit is contained in:
parent
1b2961c3a1
commit
e083879b30
@ -15,7 +15,8 @@ type config struct {
|
||||
PrivateKey string `env:"key=PRIVATE_KEY require=true"`
|
||||
PublicKey string `env:"key=PUBLIC_KEY require=true"`
|
||||
|
||||
ServerPort int `env:"key=PORT default=8080"`
|
||||
HostName string `env:"key=HOST default=https://html.house"`
|
||||
ServerPort int `env:"key=PORT default=8080"`
|
||||
|
||||
AutoApprove bool `env:"key=AUTO_APPROVE default=false"`
|
||||
AdminPass string `env:"key=ADMIN_PASS default=uhoh"`
|
||||
|
@ -39,7 +39,7 @@ func createHouse(app *app, w http.ResponseWriter, r *http.Request) error {
|
||||
resUser := newSessionInfo(houseID)
|
||||
|
||||
if public {
|
||||
go addPublicAccess(app, r.Host, houseID, html)
|
||||
go addPublicAccess(app, houseID, html)
|
||||
}
|
||||
|
||||
return impart.WriteSuccess(w, resUser, http.StatusCreated)
|
||||
@ -72,7 +72,7 @@ func removePublicAccess(app *app, houseID string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func addPublicAccess(app *app, host, houseID, html string) error {
|
||||
func addPublicAccess(app *app, houseID, html string) error {
|
||||
// Parse title of page
|
||||
title := titleReg.FindStringSubmatch(html)[1]
|
||||
if !validTitle(title) {
|
||||
@ -87,7 +87,7 @@ func addPublicAccess(app *app, host, houseID, html string) error {
|
||||
|
||||
// Get thumbnail
|
||||
data := url.Values{}
|
||||
data.Set("url", fmt.Sprintf("%s/%s.html", host, houseID))
|
||||
data.Set("url", fmt.Sprintf("%s/%s.html", app.cfg.HostName, houseID))
|
||||
|
||||
u, err := url.ParseRequestURI("http://peeper.html.house")
|
||||
u.Path = "/"
|
||||
@ -158,7 +158,7 @@ func renovateHouse(app *app, w http.ResponseWriter, r *http.Request) error {
|
||||
resUser := newSessionInfo(houseID)
|
||||
|
||||
if public {
|
||||
go addPublicAccess(app, r.Host, houseID, html)
|
||||
go addPublicAccess(app, houseID, html)
|
||||
} else {
|
||||
go removePublicAccess(app, houseID)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user