Add host-meta
This commit is contained in:
parent
d8b4d01e37
commit
8f63a831c4
3 changed files with 34 additions and 0 deletions
20
lib/nulla_web/controllers/hostmeta_controller.ex
Normal file
20
lib/nulla_web/controllers/hostmeta_controller.ex
Normal file
|
@ -0,0 +1,20 @@
|
|||
defmodule NullaWeb.HostmetaController do
|
||||
use NullaWeb, :controller
|
||||
alias Nulla.Models.InstanceSettings
|
||||
|
||||
def index(conn, _params) do
|
||||
instance_settings = InstanceSettings.get_instance_settings!()
|
||||
domain = instance_settings.domain
|
||||
|
||||
xml = """
|
||||
<?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://#{domain}/.well-known/webfinger?resource={uri}"/>
|
||||
</XRD>
|
||||
"""
|
||||
|
||||
conn
|
||||
|> put_resp_content_type("application/xrd+xml")
|
||||
|> send_resp(200, xml)
|
||||
end
|
||||
end
|
|
@ -17,6 +17,7 @@ defmodule NullaWeb.Router do
|
|||
scope "/", NullaWeb do
|
||||
pipe_through :browser
|
||||
|
||||
get "/.well-known/host-meta", HostmetaController, :index
|
||||
get "/.well-known/webfinger", WebfingerController, :index
|
||||
get "/.well-known/nodeinfo", NodeinfoController, :index
|
||||
get "/nodeinfo/2.0", NodeinfoController, :show
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue