added nodeinfo data
This commit is contained in:
parent
7d661d0273
commit
4457f2c30f
1 changed files with 105 additions and 14 deletions
|
@ -24,6 +24,52 @@ namespace BirdsiteLive.Controllers
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
[Route("/.well-known/nodeinfo")]
|
||||||
|
public IActionResult WellKnownNodeInfo()
|
||||||
|
{
|
||||||
|
var nodeInfo = new WellKnownNodeInfo
|
||||||
|
{
|
||||||
|
links = new Link[]
|
||||||
|
{
|
||||||
|
new Link()
|
||||||
|
{
|
||||||
|
rel = "http://nodeinfo.diaspora.software/ns/schema/2.0",
|
||||||
|
href = $"https://{_settings.Domain}/nodeinfo/2.0.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return new JsonResult(nodeInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Route("/nodeinfo/2.0.json")]
|
||||||
|
public IActionResult NodeInfo()
|
||||||
|
{
|
||||||
|
var nodeInfo = new NodeInfo
|
||||||
|
{
|
||||||
|
version = "2.0",
|
||||||
|
usage = new Usage()
|
||||||
|
{
|
||||||
|
localPosts = 0,
|
||||||
|
users = new Users()
|
||||||
|
{
|
||||||
|
total = 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
software = new Software()
|
||||||
|
{
|
||||||
|
name = "BirdsiteLive",
|
||||||
|
version = "0.1.0"
|
||||||
|
},
|
||||||
|
protocols = new []
|
||||||
|
{
|
||||||
|
"activitypub"
|
||||||
|
},
|
||||||
|
openRegistrations = false
|
||||||
|
};
|
||||||
|
|
||||||
|
return new JsonResult(nodeInfo);
|
||||||
|
}
|
||||||
|
|
||||||
[Route("/.well-known/webfinger")]
|
[Route("/.well-known/webfinger")]
|
||||||
public IActionResult Webfinger(string resource = null)
|
public IActionResult Webfinger(string resource = null)
|
||||||
{
|
{
|
||||||
|
@ -83,6 +129,7 @@ namespace BirdsiteLive.Controllers
|
||||||
|
|
||||||
return new JsonResult(result);
|
return new JsonResult(result);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class WebFingerResult
|
public class WebFingerResult
|
||||||
{
|
{
|
||||||
|
@ -97,5 +144,49 @@ namespace BirdsiteLive.Controllers
|
||||||
public string type { get; set; }
|
public string type { get; set; }
|
||||||
public string href { get; set; }
|
public string href { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class WellKnownNodeInfo
|
||||||
|
{
|
||||||
|
public Link[] links { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Link
|
||||||
|
{
|
||||||
|
public string href { get; set; }
|
||||||
|
public string rel { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class NodeInfo
|
||||||
|
{
|
||||||
|
public string version { get; set; }
|
||||||
|
public string[] protocols { get; set; }
|
||||||
|
public Software software { get; set; }
|
||||||
|
public Usage usage { get; set; }
|
||||||
|
public bool openRegistrations { get; set; }
|
||||||
|
public Services services { get; set; }
|
||||||
|
public object metadata { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Services
|
||||||
|
{
|
||||||
|
public object[] inbound { get; set; }
|
||||||
|
public object[] outbound { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Software
|
||||||
|
{
|
||||||
|
public string name { get; set; }
|
||||||
|
public string version { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Usage
|
||||||
|
{
|
||||||
|
public int localPosts { get; set; }
|
||||||
|
public Users users { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Users
|
||||||
|
{
|
||||||
|
public int total { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue