From a23271613d6a7e44589bfa7ecc0c0d4af23bd588 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Wed, 8 Jul 2020 18:41:47 -0400 Subject: [PATCH] add admin email to nodeinfo metadata --- src/BirdsiteLive.Common/Settings/InstanceSettings.cs | 2 +- src/BirdsiteLive/Controllers/WellKnownController.cs | 8 ++++++++ src/BirdsiteLive/Models/WellKnownModels/Metadata.cs | 7 +++++++ src/BirdsiteLive/Models/WellKnownModels/NodeInfoV20.cs | 6 ++++-- src/BirdsiteLive/Models/WellKnownModels/NodeInfoV21.cs | 2 +- src/BirdsiteLive/appsettings.json | 1 + 6 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 src/BirdsiteLive/Models/WellKnownModels/Metadata.cs diff --git a/src/BirdsiteLive.Common/Settings/InstanceSettings.cs b/src/BirdsiteLive.Common/Settings/InstanceSettings.cs index c0fff2e..ce200d9 100644 --- a/src/BirdsiteLive.Common/Settings/InstanceSettings.cs +++ b/src/BirdsiteLive.Common/Settings/InstanceSettings.cs @@ -3,7 +3,7 @@ public class InstanceSettings { public string Domain { get; set; } - + public string AdminEmail { get; set; } public string PostgresConnString { get; set; } } } \ No newline at end of file diff --git a/src/BirdsiteLive/Controllers/WellKnownController.cs b/src/BirdsiteLive/Controllers/WellKnownController.cs index 870801b..30a6f22 100644 --- a/src/BirdsiteLive/Controllers/WellKnownController.cs +++ b/src/BirdsiteLive/Controllers/WellKnownController.cs @@ -77,6 +77,10 @@ namespace BirdsiteLive.Controllers { inbound = new object[0], outbound = new object[0] + }, + metadata = new Metadata() + { + email = _settings.AdminEmail } }; return new JsonResult(nodeInfo); @@ -109,6 +113,10 @@ namespace BirdsiteLive.Controllers { inbound = new object[0], outbound = new object[0] + }, + metadata = new Metadata() + { + email = _settings.AdminEmail } }; return new JsonResult(nodeInfo); diff --git a/src/BirdsiteLive/Models/WellKnownModels/Metadata.cs b/src/BirdsiteLive/Models/WellKnownModels/Metadata.cs new file mode 100644 index 0000000..9f5007e --- /dev/null +++ b/src/BirdsiteLive/Models/WellKnownModels/Metadata.cs @@ -0,0 +1,7 @@ +namespace BirdsiteLive.Models.WellKnownModels +{ + public class Metadata + { + public string email { get; set; } + } +} \ No newline at end of file diff --git a/src/BirdsiteLive/Models/WellKnownModels/NodeInfoV20.cs b/src/BirdsiteLive/Models/WellKnownModels/NodeInfoV20.cs index f2c1f92..032fc51 100644 --- a/src/BirdsiteLive/Models/WellKnownModels/NodeInfoV20.cs +++ b/src/BirdsiteLive/Models/WellKnownModels/NodeInfoV20.cs @@ -1,4 +1,6 @@ -namespace BirdsiteLive.Models.WellKnownModels +using System.ComponentModel.DataAnnotations; + +namespace BirdsiteLive.Models.WellKnownModels { public class NodeInfoV20 { @@ -8,6 +10,6 @@ public Usage usage { get; set; } public bool openRegistrations { get; set; } public Services services { get; set; } - //public object metadata { get; set; } + public Metadata metadata { get; set; } } } \ No newline at end of file diff --git a/src/BirdsiteLive/Models/WellKnownModels/NodeInfoV21.cs b/src/BirdsiteLive/Models/WellKnownModels/NodeInfoV21.cs index ba50f5b..ce397cb 100644 --- a/src/BirdsiteLive/Models/WellKnownModels/NodeInfoV21.cs +++ b/src/BirdsiteLive/Models/WellKnownModels/NodeInfoV21.cs @@ -8,6 +8,6 @@ public bool openRegistrations { get; set; } public SoftwareV21 software { get; set; } public Services services { get; set; } - //public object metadata { get; set; } + public Metadata metadata { get; set; } } } \ No newline at end of file diff --git a/src/BirdsiteLive/appsettings.json b/src/BirdsiteLive/appsettings.json index 5054e67..08c587a 100644 --- a/src/BirdsiteLive/appsettings.json +++ b/src/BirdsiteLive/appsettings.json @@ -9,6 +9,7 @@ "AllowedHosts": "*", "Instance": { "Domain": "domain.name", + "AdminEmail": "me@domain.name", "PostgresConnString": "Host=127.0.0.1;Username=username;Password=password;Database=mydb" }, "Twitter": {