all repos — honk @ 4ea9dfdb6c6b28460a507d2052b6ea15ea7a1775

my fork of honk

allow masquerading webfinger
Ted Unangst tedu@tedunangst.com
Thu, 05 Mar 2020 15:29:34 -0500
commit

4ea9dfdb6c6b28460a507d2052b6ea15ea7a1775

parent

21107dbd1a3e73f84b412720c185a0011e5eb0a2

3 files changed, 11 insertions(+), 2 deletions(-)

jump to
M docs/honk.8docs/honk.8

@@ -171,6 +171,10 @@ To prepare a Twitter data archive, extract the twitter-longhash.zip file.

After unzipping the data archive, navigate to the tweet_media directory and unzip any zip files contained within. .Dl ./honk import username twitter source-directory +.Ss Advanced Options +To support separate mentions without a subdomain, +e.g. @user@example.com and https://honk.example.com/u/user, +add a ('masqname', 'example.com') row the config table of the database. .Sh FILES .Nm files are split between the data directory and the view directory.
M honk.gohonk.go

@@ -208,6 +208,7 @@ SomeCollection

) var serverName string +var masqName string var dataDir = "." var viewDir = "." var iconName = "icon.png"

@@ -253,6 +254,10 @@ getconfig("servermsg", &serverMsg)

getconfig("aboutmsg", &aboutMsg) getconfig("loginmsg", &loginMsg) getconfig("servername", &serverName) + getconfig("masqname", &masqName) + if masqName == "" { + masqName = serverName + } getconfig("usersep", &userSep) getconfig("honksep", &honkSep) prepareStatements(db)
M web.goweb.go

@@ -1997,7 +1997,7 @@ } else {

idx = strings.IndexByte(name, '@') if idx != -1 { name = name[:idx] - if name+"@"+serverName != orig { + if !(name+"@"+serverName == orig || name+"@"+masqName == orig) { log.Printf("foreign request rejected") name = "" }

@@ -2014,7 +2014,7 @@ return

} j := junk.New() - j["subject"] = fmt.Sprintf("acct:%s@%s", user.Name, serverName) + j["subject"] = fmt.Sprintf("acct:%s@%s", user.Name, masqName) j["aliases"] = []string{user.URL} l := junk.New() l["rel"] = "self"