setting avatar. if you must.
This commit is contained in:
parent
83c89df14b
commit
04a82a0098
|
@ -2,6 +2,8 @@ changelog
|
||||||
|
|
||||||
-- next
|
-- next
|
||||||
|
|
||||||
|
+ Set an avatar. If you must.
|
||||||
|
|
||||||
+ Try a little harder to recover from httpsig failures.
|
+ Try a little harder to recover from httpsig failures.
|
||||||
|
|
||||||
+ Add cite tag for block quote attributions.
|
+ Add cite tag for block quote attributions.
|
||||||
|
|
|
@ -164,6 +164,12 @@ It also allows the import of external objects via URL, either individual
|
||||||
posts or actor URLs, in which case their recent outbox is imported.
|
posts or actor URLs, in which case their recent outbox is imported.
|
||||||
.Ss Account
|
.Ss Account
|
||||||
It's all about you.
|
It's all about you.
|
||||||
|
An avatar may be selected from the
|
||||||
|
.Pa funzone
|
||||||
|
by adding
|
||||||
|
.Dq avatar: filename.png
|
||||||
|
to one's profile info.
|
||||||
|
If truly necessary.
|
||||||
.Pp
|
.Pp
|
||||||
Some options to customize the site appearance:
|
Some options to customize the site appearance:
|
||||||
.Bl -tag -width skinny
|
.Bl -tag -width skinny
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<form id="aboutform" action="/saveuser" method="POST">
|
<form id="aboutform" action="/saveuser" method="POST">
|
||||||
<input type="hidden" name="CSRF" value="{{ .UserCSRF }}">
|
<input type="hidden" name="CSRF" value="{{ .UserCSRF }}">
|
||||||
<p>about me:
|
<p>about me:
|
||||||
<p><textarea name="whatabout">{{ .User.About }}</textarea>
|
<p><textarea name="whatabout">{{ .WhatAbout }}</textarea>
|
||||||
<p><label class="button" for="skinny">skinny layout:</label>
|
<p><label class="button" for="skinny">skinny layout:</label>
|
||||||
<input tabindex=1 type="checkbox" id="skinny" name="skinny" value="skinny" {{ if .User.Options.SkinnyCSS }}checked{{ end }}><span></span>
|
<input tabindex=1 type="checkbox" id="skinny" name="skinny" value="skinny" {{ if .User.Options.SkinnyCSS }}checked{{ end }}><span></span>
|
||||||
<p><label class="button" for="maps">apple map links:</label>
|
<p><label class="button" for="maps">apple map links:</label>
|
||||||
|
|
18
web.go
18
web.go
|
@ -1069,6 +1069,8 @@ func honkpage(w http.ResponseWriter, u *login.UserInfo, honks []*Honk, templinfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var re_avatar = regexp.MustCompile("avatar: ?([[:alnum:]_.-]+)")
|
||||||
|
|
||||||
func saveuser(w http.ResponseWriter, r *http.Request) {
|
func saveuser(w http.ResponseWriter, r *http.Request) {
|
||||||
whatabout := r.FormValue("whatabout")
|
whatabout := r.FormValue("whatabout")
|
||||||
u := login.GetUserInfo(r)
|
u := login.GetUserInfo(r)
|
||||||
|
@ -1085,6 +1087,17 @@ func saveuser(w http.ResponseWriter, r *http.Request) {
|
||||||
} else {
|
} else {
|
||||||
options.MapLink = ""
|
options.MapLink = ""
|
||||||
}
|
}
|
||||||
|
if ava := re_avatar.FindString(whatabout); ava != "" {
|
||||||
|
whatabout = re_avatar.ReplaceAllString(whatabout, "")
|
||||||
|
ava = ava[7:]
|
||||||
|
if ava[0] == ' ' {
|
||||||
|
ava = ava[1:]
|
||||||
|
}
|
||||||
|
options.Avatar = fmt.Sprintf("https://%s/meme/%s", serverName, ava)
|
||||||
|
} else {
|
||||||
|
options.Avatar = ""
|
||||||
|
}
|
||||||
|
whatabout = strings.TrimSpace(whatabout)
|
||||||
j, err := jsonify(options)
|
j, err := jsonify(options)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
_, err = db.Exec("update users set about = ?, options = ? where username = ?", whatabout, j, u.Username)
|
_, err = db.Exec("update users set about = ?, options = ? where username = ?", whatabout, j, u.Username)
|
||||||
|
@ -1861,6 +1874,11 @@ func accountpage(w http.ResponseWriter, r *http.Request) {
|
||||||
templinfo["UserCSRF"] = login.GetCSRF("saveuser", r)
|
templinfo["UserCSRF"] = login.GetCSRF("saveuser", r)
|
||||||
templinfo["LogoutCSRF"] = login.GetCSRF("logout", r)
|
templinfo["LogoutCSRF"] = login.GetCSRF("logout", r)
|
||||||
templinfo["User"] = user
|
templinfo["User"] = user
|
||||||
|
about := user.About
|
||||||
|
if ava := user.Options.Avatar; ava != "" {
|
||||||
|
about += "\n\navatar: " + ava[strings.LastIndexByte(ava, '/')+1:]
|
||||||
|
}
|
||||||
|
templinfo["WhatAbout"] = about
|
||||||
err := readviews.Execute(w, "account.html", templinfo)
|
err := readviews.Execute(w, "account.html", templinfo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print(err)
|
log.Print(err)
|
||||||
|
|
Loading…
Reference in New Issue