diff --git a/docs/honk.8 b/docs/honk.8 index 1575f4d..f61cb9a 100644 --- a/docs/honk.8 +++ b/docs/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. diff --git a/honk.go b/honk.go index 6d812fe..9bff113 100644 --- a/honk.go +++ b/honk.go @@ -208,6 +208,7 @@ const ( ) var serverName string +var masqName string var dataDir = "." var viewDir = "." var iconName = "icon.png" @@ -253,6 +254,10 @@ func main() { getconfig("aboutmsg", &aboutMsg) getconfig("loginmsg", &loginMsg) getconfig("servername", &serverName) + getconfig("masqname", &masqName) + if masqName == "" { + masqName = serverName + } getconfig("usersep", &userSep) getconfig("honksep", &honkSep) prepareStatements(db) diff --git a/web.go b/web.go index 52f854b..f2f5e93 100644 --- a/web.go +++ b/web.go @@ -1997,7 +1997,7 @@ func fingerlicker(w http.ResponseWriter, r *http.Request) { 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 @@ func fingerlicker(w http.ResponseWriter, r *http.Request) { } 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"