1/*
2 * Copyright © 2018-2019 A Bunch Tell LLC.
3 *
4 * This file is part of WriteFreely.
5 *
6 * WriteFreely is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License, included
8 * in the LICENSE file in this source code package.
9 */
10
11package writefreely
12
13import (
14	"fmt"
15	"net/http"
16)
17
18func handleViewHostMeta(app *App, w http.ResponseWriter, r *http.Request) error {
19	w.Header().Set("Server", serverSoftware)
20	w.Header().Set("Content-Type", "application/xrd+xml; charset=utf-8")
21
22	meta := `<?xml version="1.0" encoding="UTF-8"?>
23<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">
24  <Link rel="lrdd" type="application/xrd+xml" template="https://` + r.Host + `/.well-known/webfinger?resource={uri}"/>
25</XRD>`
26	fmt.Fprintf(w, meta)
27
28	return nil
29}
30