From de09dfbfc4b4643ff469baf4c9a3608d27a3c680 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Sat, 21 Mar 2020 03:29:36 -0400 Subject: [PATCH] added inbox and wellknown controller --- .../BirdsiteLive.Cryptography.csproj | 7 +++ src/BirdsiteLive.Cryptography/Class1.cs | 8 +++ src/BirdsiteLive.sln | 13 ++++- .../Controllers/InboxController.cs | 20 +++++++ .../Controllers/WellKnownController.cs | 53 +++++++++++++++++++ 5 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 src/BirdsiteLive.Cryptography/BirdsiteLive.Cryptography.csproj create mode 100644 src/BirdsiteLive.Cryptography/Class1.cs create mode 100644 src/BirdsiteLive/Controllers/InboxController.cs create mode 100644 src/BirdsiteLive/Controllers/WellKnownController.cs diff --git a/src/BirdsiteLive.Cryptography/BirdsiteLive.Cryptography.csproj b/src/BirdsiteLive.Cryptography/BirdsiteLive.Cryptography.csproj new file mode 100644 index 0000000..9f5c4f4 --- /dev/null +++ b/src/BirdsiteLive.Cryptography/BirdsiteLive.Cryptography.csproj @@ -0,0 +1,7 @@ + + + + netstandard2.0 + + + diff --git a/src/BirdsiteLive.Cryptography/Class1.cs b/src/BirdsiteLive.Cryptography/Class1.cs new file mode 100644 index 0000000..5b1ef77 --- /dev/null +++ b/src/BirdsiteLive.Cryptography/Class1.cs @@ -0,0 +1,8 @@ +using System; + +namespace BirdsiteLive.Cryptography +{ + public class Class1 + { + } +} diff --git a/src/BirdsiteLive.sln b/src/BirdsiteLive.sln index f7d4fe3..32db4a4 100644 --- a/src/BirdsiteLive.sln +++ b/src/BirdsiteLive.sln @@ -3,7 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29911.84 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BirdsiteLive", "BirdsiteLive\BirdsiteLive.csproj", "{4059D92B-A86B-4765-A905-EFC2D7259C34}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BirdsiteLive", "BirdsiteLive\BirdsiteLive.csproj", "{4059D92B-A86B-4765-A905-EFC2D7259C34}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BirdsiteLive.Cryptography", "BirdsiteLive.Cryptography\BirdsiteLive.Cryptography.csproj", "{160AD138-4E29-4706-8546-9826B529E9B2}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Domain", "Domain", "{4FEAD6BC-3C8E-451A-8CA1-FF1AF47D26CC}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,10 +19,17 @@ Global {4059D92B-A86B-4765-A905-EFC2D7259C34}.Debug|Any CPU.Build.0 = Debug|Any CPU {4059D92B-A86B-4765-A905-EFC2D7259C34}.Release|Any CPU.ActiveCfg = Release|Any CPU {4059D92B-A86B-4765-A905-EFC2D7259C34}.Release|Any CPU.Build.0 = Release|Any CPU + {160AD138-4E29-4706-8546-9826B529E9B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {160AD138-4E29-4706-8546-9826B529E9B2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {160AD138-4E29-4706-8546-9826B529E9B2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {160AD138-4E29-4706-8546-9826B529E9B2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {160AD138-4E29-4706-8546-9826B529E9B2} = {4FEAD6BC-3C8E-451A-8CA1-FF1AF47D26CC} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {69E8DCAD-4C37-4010-858F-5F94E6FBABCE} EndGlobalSection diff --git a/src/BirdsiteLive/Controllers/InboxController.cs b/src/BirdsiteLive/Controllers/InboxController.cs new file mode 100644 index 0000000..301bf6e --- /dev/null +++ b/src/BirdsiteLive/Controllers/InboxController.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; + +namespace BirdsiteLive.Controllers +{ + [ApiController] + public class InboxController : ControllerBase + { + [Route("/inbox")] + [HttpPost] + public async Task Inbox() + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/src/BirdsiteLive/Controllers/WellKnownController.cs b/src/BirdsiteLive/Controllers/WellKnownController.cs new file mode 100644 index 0000000..455d3da --- /dev/null +++ b/src/BirdsiteLive/Controllers/WellKnownController.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; + +namespace BirdsiteLive.Controllers +{ + [ApiController] + public class WellKnownController : ControllerBase + { + #region Ctor + public WellKnownController() + { + + } + #endregion + + [Route("/.well-known/webfinger")] + public WebFingerResult Webfinger(string resource = null) + { + var acct = resource.Split("acct:")[1]; + + + return new WebFingerResult() + { + subject = $"acct:{acct}", + links = new List + { + new WebFingerLink() + { + rel = "self", + type = "application/activity+json", + href = "https://d150a079.ngrok.io/actor" + } + } + }; + } + + public class WebFingerResult + { + public string subject { get; set; } + public List links { get; set; } = new List(); + } + + public class WebFingerLink + { + public string rel { get; set; } + public string type { get; set; } + public string href { get; set; } + } + } +} \ No newline at end of file