Add site_description config value

This changes what displays in the NodeInfo, and in the future might be
used for other things.
This commit is contained in:
Matt Baer 2018-12-03 18:36:33 -05:00
parent 573ce02739
commit cbf6ff54df
4 changed files with 10 additions and 1 deletions

View file

@ -113,6 +113,7 @@ func handleAdminUpdateSite(app *app, u *User, w http.ResponseWriter, r *http.Req
func handleAdminUpdateConfig(app *app, u *User, w http.ResponseWriter, r *http.Request) error { func handleAdminUpdateConfig(app *app, u *User, w http.ResponseWriter, r *http.Request) error {
app.cfg.App.SiteName = r.FormValue("site_name") app.cfg.App.SiteName = r.FormValue("site_name")
app.cfg.App.SiteDesc = r.FormValue("site_desc")
app.cfg.App.OpenRegistration = r.FormValue("open_registration") == "on" app.cfg.App.OpenRegistration = r.FormValue("open_registration") == "on"
mul, err := strconv.Atoi(r.FormValue("min_username_len")) mul, err := strconv.Atoi(r.FormValue("min_username_len"))
if err == nil { if err == nil {

View file

@ -31,6 +31,7 @@ type (
AppCfg struct { AppCfg struct {
SiteName string `ini:"site_name"` SiteName string `ini:"site_name"`
SiteDesc string `ini:"site_description"`
Host string `ini:"host"` Host string `ini:"host"`
// Site appearance // Site appearance

View file

@ -14,7 +14,10 @@ type nodeInfoResolver struct {
func nodeInfoConfig(db *datastore, cfg *config.Config) *nodeinfo.Config { func nodeInfoConfig(db *datastore, cfg *config.Config) *nodeinfo.Config {
name := cfg.App.SiteName name := cfg.App.SiteName
desc := "Minimal, federated blogging platform." desc := cfg.App.SiteDesc
if desc == "" {
desc = "Minimal, federated blogging platform."
}
if cfg.App.SingleUser { if cfg.App.SingleUser {
// Fetch blog information, instead // Fetch blog information, instead
coll, err := db.GetCollectionByID(1) coll, err := db.GetCollectionByID(1)

View file

@ -92,6 +92,10 @@ function savePage(el) {
<dl class="dl-horizontal admin-dl-horizontal"> <dl class="dl-horizontal admin-dl-horizontal">
<dt>Site Name</dt> <dt>Site Name</dt>
<dd><input type="text" name="site_name" id="site_name" class="inline" value="{{.Config.SiteName}}" style="width: 14em;" /></dd> <dd><input type="text" name="site_name" id="site_name" class="inline" value="{{.Config.SiteName}}" style="width: 14em;" /></dd>
{{if not .SingleUser}}
<dt>Site Description</dt>
<dd><input type="text" name="site_desc" id="site_desc" class="inline" value="{{.Config.SiteDesc}}" style="width: 14em;" /></dd>
{{end}}
<dt>Host</dt> <dt>Host</dt>
<dd>{{.Config.Host}}</dd> <dd>{{.Config.Host}}</dd>
<dt>User Mode</dt> <dt>User Mode</dt>