Add ActivityPub components, routes, handlers

This commit is contained in:
Matt Baer
2018-11-08 01:28:08 -05:00
parent 5e53a1788d
commit 6dbf0c8764
31 changed files with 739 additions and 1 deletions

19
hostmeta.go Normal file
View File

@@ -0,0 +1,19 @@
package writefreely
import (
"fmt"
"net/http"
)
func handleViewHostMeta(app *app, w http.ResponseWriter, r *http.Request) error {
w.Header().Set("Server", serverSoftware)
w.Header().Set("Content-Type", "application/xrd+xml; charset=utf-8")
meta := `<?xml version="1.0" encoding="UTF-8"?>
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">
<Link rel="lrdd" type="application/xrd+xml" template="https://` + r.Host + `/.well-known/webfinger?resource={uri}"/>
</XRD>`
fmt.Fprintf(w, meta)
return nil
}