init
This commit is contained in:
commit
f6629fbb33
32 changed files with 1608 additions and 0 deletions
27
Foxchat.Identity/Controllers/NodeController.cs
Normal file
27
Foxchat.Identity/Controllers/NodeController.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
using Foxchat.Core.Models;
|
||||
using Foxchat.Identity.Database;
|
||||
using Foxchat.Identity.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Foxchat.Identity.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("/_fox/ident/node")]
|
||||
public class NodeController(IdentityContext context, ChatInstanceResolverService chatInstanceResolverService) : ControllerBase
|
||||
{
|
||||
public const string SOFTWARE_NAME = "Foxchat.NET.Identity";
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> GetNode()
|
||||
{
|
||||
var instance = await context.GetInstanceAsync();
|
||||
return Ok(new NodeInfo(SOFTWARE_NAME, instance.PublicKey));
|
||||
}
|
||||
|
||||
[HttpGet("{domain}")]
|
||||
public async Task<IActionResult> GetChatNode(string domain)
|
||||
{
|
||||
var instance = await chatInstanceResolverService.ResolveChatInstanceAsync(domain);
|
||||
return Ok(instance);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue