Merge pull request #274 from writeas/private-instance-improvements

Private instance cleanup
pull/288/head
Matt Baer 5 years ago committed by GitHub
commit c3400242f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      app.go
  2. 10
      config/config.go
  3. 2
      pages/login.tmpl
  4. 4
      templates/base.tmpl
  5. 2
      templates/include/footer.tmpl

@ -221,6 +221,10 @@ func handleViewHome(app *App, w http.ResponseWriter, r *http.Request) error {
return handleViewPad(app, w, r) return handleViewPad(app, w, r)
} }
if app.cfg.App.Private {
return viewLogin(app, w, r)
}
if land := app.cfg.App.LandingPath(); land != "/" { if land := app.cfg.App.LandingPath(); land != "/" {
return impart.HTTPError{http.StatusFound, land} return impart.HTTPError{http.StatusFound, land}
} }

@ -193,6 +193,16 @@ func (ac *AppCfg) LandingPath() string {
return ac.Landing return ac.Landing
} }
func (ac AppCfg) SignupPath() string {
if !ac.OpenRegistration {
return ""
}
if ac.Chorus || ac.Private || (ac.Landing != "" && ac.Landing != "/") {
return "/signup"
}
return "/"
}
// Load reads the given configuration file, then parses and returns it as a Config. // Load reads the given configuration file, then parses and returns it as a Config.
func Load(fname string) (*Config, error) { func Load(fname string) (*Config, error) {
if fname == "" { if fname == "" {

@ -72,7 +72,7 @@ hr.short {
<input type="submit" id="btn-login" value="Login" /> <input type="submit" id="btn-login" value="Login" />
</form> </form>
{{if and (not .SingleUser) .OpenRegistration}}<p style="text-align:center;font-size:0.9em;margin:3em auto;max-width:26em;">{{if .Message}}{{.Message}}{{else}}<em>No account yet?</em> <a href="/">Sign up</a> to start a blog.{{end}}</p>{{end}} {{if and (not .SingleUser) .OpenRegistration}}<p style="text-align:center;font-size:0.9em;margin:3em auto;max-width:26em;">{{if .Message}}{{.Message}}{{else}}<em>No account yet?</em> <a href="{{.SignupPath}}">Sign up</a> to start a blog.{{end}}</p>{{end}}
<script type="text/javascript"> <script type="text/javascript">
function disableSubmit() { function disableSubmit() {

@ -47,8 +47,8 @@
{{if not .DisableDrafts}}<a href="/me/posts/"{{if eq .Path "/me/posts/"}} class="selected"{{end}}>Drafts</a>{{end}} {{if not .DisableDrafts}}<a href="/me/posts/"{{if eq .Path "/me/posts/"}} class="selected"{{end}}>Drafts</a>{{end}}
{{ end }} {{ end }}
{{if and (and .LocalTimeline .CanViewReader) (not .Chorus)}}<a href="/read"{{if eq .Path "/read"}} class="selected"{{end}}>Reader</a>{{end}} {{if and (and .LocalTimeline .CanViewReader) (not .Chorus)}}<a href="/read"{{if eq .Path "/read"}} class="selected"{{end}}>Reader</a>{{end}}
{{if and (and (and .Chorus .OpenRegistration) (not .Username)) (or (not .Private) (ne .Landing ""))}}<a href="/signup"{{if eq .Path "/signup"}} class="selected"{{end}}>Sign up</a>{{end}} {{if eq .SignupPath "/signup"}}<a href="/signup"{{if eq .Path "/signup"}} class="selected"{{end}}>Sign up</a>{{end}}
{{if not .Username}}<a href="/login"{{if eq .Path "/login"}} class="selected"{{end}}>Log in</a>{{else if .SimpleNav}}<a href="/me/logout">Log out</a>{{end}} {{if and (not .Username) (not .Private)}}<a href="/login"{{if eq .Path "/login"}} class="selected"{{end}}>Log in</a>{{else if .SimpleNav}}<a href="/me/logout">Log out</a>{{end}}
{{ end }} {{ end }}
</nav> </nav>
{{if .Chorus}}{{if .Username}}<div class="right-side" style="font-size: 0.86em;"> {{if .Chorus}}{{if .Username}}<div class="right-side" style="font-size: 0.86em;">

@ -6,7 +6,7 @@
<a class="home" href="/">{{.SiteName}}</a> <a class="home" href="/">{{.SiteName}}</a>
{{if not .SingleUser}} {{if not .SingleUser}}
<a href="/about">about</a> <a href="/about">about</a>
{{if .LocalTimeline}}<a href="/read">reader</a>{{end}} {{if and .LocalTimeline .CanViewReader}}<a href="/read">reader</a>{{end}}
{{if .Username}}<a href="https://writefreely.org/guide/{{.OfficialVersion}}" target="guide">writer's guide</a>{{end}} {{if .Username}}<a href="https://writefreely.org/guide/{{.OfficialVersion}}" target="guide">writer's guide</a>{{end}}
<a href="/privacy">privacy</a> <a href="/privacy">privacy</a>
<p style="font-size: 0.9em">powered by <a href="https://writefreely.org">writefreely</a></p> <p style="font-size: 0.9em">powered by <a href="https://writefreely.org">writefreely</a></p>

Loading…
Cancel
Save