allow masquerading webfinger

Ted Unangst 4 years ago
parent 1db7407c61
commit 6fbad97ee0

@ -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.

@ -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)

@ -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"

Loading…
Cancel
Save