all repos — honk @ 9629fe7542a8bc05c4a2cae8567480fb854ea35a

my fork of honk

specify banner: in profile
Ted Unangst tedu@tedunangst.com
Tue, 31 May 2022 01:31:11 -0400
commit

9629fe7542a8bc05c4a2cae8567480fb854ea35a

parent

b498518b13d3fa6840662e0bf1ff5ba6bba3270c

6 files changed, 29 insertions(+), 0 deletions(-)

jump to
M activity.goactivity.go

@@ -1539,6 +1539,13 @@ }

a["url"] = u } j["icon"] = a + if ban := user.Options.Banner; ban != "" { + a := junk.New() + a["type"] = "Image" + a["mediaType"] = "image/jpg" + a["url"] = ban + j["image"] = a + } } else { j["type"] = "Service" }
M docs/changelog.txtdocs/changelog.txt

@@ -2,6 +2,8 @@ changelog

=== next ++ Specify banner: image in profile. + + Update activity compatibility with mastodon. - Signed fetch.
M docs/honk.1docs/honk.1

@@ -178,6 +178,8 @@ meme collection by adding

.Dq avatar: filename.png to one's profile info. If truly necessary. +A banner may be set by specifying +.Dq banner: image.jpg . See .Xr honk 8 for more about the funzone.
M fun.gofun.go

@@ -419,6 +419,7 @@ }

var re_memes = regexp.MustCompile("meme: ?([^\n]+)") var re_avatar = regexp.MustCompile("avatar: ?([^\n]+)") +var re_banner = regexp.MustCompile("banner: ?([^\n]+)") func memetize(honk *Honk) { repl := func(x string) string {
M honk.gohonk.go

@@ -56,6 +56,7 @@ OmitImages bool `json:",omitempty"`

Avahex bool `json:",omitempty"` MentionAll bool `json:",omitempty"` Avatar string `json:",omitempty"` + Banner string `json:",omitempty"` MapLink string `json:",omitempty"` Reaction string `json:",omitempty"` MeCount int64
M web.goweb.go

@@ -1147,6 +1147,19 @@ if ava != options.Avatar {

options.Avatar = ava sendupdate = true } + ban := re_banner.FindString(whatabout) + if ban != "" { + whatabout = re_banner.ReplaceAllString(whatabout, "") + ban = ban[7:] + if ban[0] == ' ' { + ban = ban[1:] + } + ban = fmt.Sprintf("https://%s/meme/%s", serverName, ban) + } + if ban != options.Banner { + options.Banner = ban + sendupdate = true + } whatabout = strings.TrimSpace(whatabout) if whatabout != user.About { sendupdate = true

@@ -2016,6 +2029,9 @@ templinfo["User"] = user

about := user.About if ava := user.Options.Avatar; ava != "" { about += "\n\navatar: " + ava[strings.LastIndexByte(ava, '/')+1:] + } + if ban := user.Options.Banner; ban != "" { + about += "\n\nbanner: " + ban[strings.LastIndexByte(ban, '/')+1:] } templinfo["WhatAbout"] = about err := readviews.Execute(w, "account.html", templinfo)