diff --git a/community.go b/community.go index 36d09b4..2778347 100644 --- a/community.go +++ b/community.go @@ -15,6 +15,7 @@ import ( "strconv" "strings" + "git.erbosoft.com/amy/amsterdam/config" "git.erbosoft.com/amy/amsterdam/database" "git.erbosoft.com/amy/amsterdam/ui" "git.erbosoft.com/amy/amsterdam/util" @@ -69,7 +70,7 @@ func ShowCommunity(ctxt ui.AmContext) (string, any) { if ci.PhotoURL != nil && *ci.PhotoURL != "" { ctxt.VarMap().Set("logoURL", *ci.PhotoURL) } else { - ctxt.VarMap().Set("logoURL", "/img/builtin/default-community.jpg") + ctxt.VarMap().Set("logoURL", config.GlobalConfig.Site.DefaultCommunityLogo) } tz := prefs.Location() loc := prefs.Localizer() diff --git a/communityadmin.go b/communityadmin.go index 9f95f76..1435ed5 100644 --- a/communityadmin.go +++ b/communityadmin.go @@ -20,6 +20,7 @@ import ( "strings" "time" + "git.erbosoft.com/amy/amsterdam/config" "git.erbosoft.com/amy/amsterdam/database" "git.erbosoft.com/amy/amsterdam/email" "git.erbosoft.com/amy/amsterdam/exports" @@ -108,7 +109,7 @@ func communityLogoURL(ci *database.ContactInfo) string { if ci.PhotoURL != nil && *ci.PhotoURL != "" { return *ci.PhotoURL } - return "/img/builtin/default-community.jpg" + return config.GlobalConfig.Site.DefaultCommunityLogo } /* CommunityProfileForm displays the dfialog for editing the community profile. diff --git a/conference.go b/conference.go index 89324aa..3de6f51 100644 --- a/conference.go +++ b/conference.go @@ -18,6 +18,7 @@ import ( "strconv" "strings" + "git.erbosoft.com/amy/amsterdam/config" "git.erbosoft.com/amy/amsterdam/database" "git.erbosoft.com/amy/amsterdam/email" "git.erbosoft.com/amy/amsterdam/htmlcheck" @@ -440,7 +441,7 @@ func templateBozo(args jet.Arguments) reflect.Value { func templateProfileImage(args jet.Arguments) reflect.Value { post := args.Get(0).Convert(reflect.TypeFor[*database.PostHeader]()).Interface().(*database.PostHeader) ctxt := args.Get(1).Convert(reflect.TypeFor[ui.AmContext]()).Interface().(ui.AmContext) - rc := "/img/builtin/no-user.png" + rc := config.GlobalConfig.Site.DefaultUserPhoto user, err := post.Creator(ctxt.Ctx()) if err == nil { ci, err := user.ContactInfo(ctxt.Ctx()) diff --git a/config/config.go b/config/config.go index 05a0b6e..14bc2e6 100644 --- a/config/config.go +++ b/config/config.go @@ -74,6 +74,8 @@ type AmConfig struct { UserAgreementResource string `yaml:"userAgreementResource"` PolicyResource string `yaml:"policyResource"` FooterTemplate string `yaml:"footerTemplate"` + DefaultCommunityLogo string `yaml:"defaultCommunityLogo"` + DefaultUserPhoto string `yaml:"defaultUserPhoto"` } `yaml:"site"` Database struct { Driver string `yaml:"driver"` diff --git a/config/default.yaml b/config/default.yaml index e219c28..350062b 100644 --- a/config/default.yaml +++ b/config/default.yaml @@ -21,6 +21,8 @@ site: userAgreementResource: "useragreement.html" policyResource: "policy.html" footerTemplate: "footer.jet" + defaultCommunityLogo: "/img/builtin/default-community.jpg" + defaultUserPhoto: "/img/builtin/no-user.png" database: driver: "mysql" dsn: "amsdb:x00yes2k@tcp(localhost)/amsterdam?parseTime=true&loc=UTC" diff --git a/ui/templates.go b/ui/templates.go index 64a70fe..ebce38f 100644 --- a/ui/templates.go +++ b/ui/templates.go @@ -111,7 +111,7 @@ func immediateIf(a jet.Arguments) reflect.Value { // extractCommunityLogo extracts a community logo URL from a community. func extractCommunityLogo(a jet.Arguments) reflect.Value { - rc := "/img/builtin/default-community.jpg" + rc := config.GlobalConfig.Site.DefaultCommunityLogo comm := a.Get(0).Convert(reflect.TypeFor[*database.Community]()).Interface().(*database.Community) ctxt := a.Get(1).Convert(reflect.TypeFor[AmContext]()).Interface().(AmContext) ci, err := comm.ContactInfo(ctxt.Ctx()) diff --git a/ui/views/profile.jet b/ui/views/profile.jet index bfcba82..86ef68f 100644 --- a/ui/views/profile.jet +++ b/ui/views/profile.jet @@ -21,7 +21,7 @@
{{ username }}'s photo + onerror="this.src='{{ GlobalConfig.Site.DefaultUserPhoto }}'">
diff --git a/ui/views/singlepost.jet b/ui/views/singlepost.jet index 2196bb4..2f228ea 100644 --- a/ui/views/singlepost.jet +++ b/ui/views/singlepost.jet @@ -12,7 +12,7 @@
Profile image: {{ post_userName }} + onerror="this.src='{{ GlobalConfig.Site.DefaultUserPhoto }}'">
{{ end }}
diff --git a/userdata.go b/userdata.go index b97823c..b455377 100644 --- a/userdata.go +++ b/userdata.go @@ -18,6 +18,7 @@ import ( "strconv" "strings" + "git.erbosoft.com/amy/amsterdam/config" "git.erbosoft.com/amy/amsterdam/database" "git.erbosoft.com/amy/amsterdam/email" "git.erbosoft.com/amy/amsterdam/ui" @@ -32,7 +33,7 @@ func userPhotoURL(ci *database.ContactInfo) string { if ci.PhotoURL != nil && *ci.PhotoURL != "" { return *ci.PhotoURL } - return "/img/builtin/no-user.png" + return config.GlobalConfig.Site.DefaultUserPhoto } /* EditProfileForm renders the Amsterdam profile editing form.