diff options
Diffstat (limited to 'back-end/src/Endpoints')
-rw-r--r-- | back-end/src/Endpoints/BmAccountEndpoint.cs | 8 | ||||
-rw-r--r-- | back-end/src/Endpoints/BookmarkEndpoint.cs | 21 | ||||
-rw-r--r-- | back-end/src/Endpoints/SiteLookupEndpoint.cs | 10 |
3 files changed, 14 insertions, 25 deletions
diff --git a/back-end/src/Endpoints/BmAccountEndpoint.cs b/back-end/src/Endpoints/BmAccountEndpoint.cs index 24ddb90..81b2ff3 100644 --- a/back-end/src/Endpoints/BmAccountEndpoint.cs +++ b/back-end/src/Endpoints/BmAccountEndpoint.cs @@ -36,11 +36,12 @@ using VNLib.Plugins.Extensions.Loading; using VNLib.Plugins.Extensions.Validation; using VNLib.Plugins.Extensions.Loading.Users; using VNLib.Plugins.Extensions.Loading.Events; - -using SimpleBookmark.Model; +using VNLib.Plugins.Extensions.Loading.Routing; namespace SimpleBookmark.Endpoints { + [EndpointPath("{{path}}")] + [EndpointLogName("Accounts")] [ConfigurationName("registration")] internal sealed class BmAccountEndpoint : UnprotectedWebEndpoint { @@ -58,9 +59,6 @@ namespace SimpleBookmark.Endpoints public BmAccountEndpoint(PluginBase plugin, IConfigScope config) { - string path = config.GetRequiredProperty("path", p => p.GetString()!); - InitPathAndLog(path, plugin.Log); - //get setup mode and enabled startup arguments SetupMode = plugin.HostArgs.HasArgument("--setup"); Enabled = !plugin.HostArgs.HasArgument("--disable-registation"); diff --git a/back-end/src/Endpoints/BookmarkEndpoint.cs b/back-end/src/Endpoints/BookmarkEndpoint.cs index ae2932d..d76cb35 100644 --- a/back-end/src/Endpoints/BookmarkEndpoint.cs +++ b/back-end/src/Endpoints/BookmarkEndpoint.cs @@ -39,6 +39,7 @@ using VNLib.Plugins.Essentials.Accounts; using VNLib.Plugins.Essentials.Endpoints; using VNLib.Plugins.Essentials.Extensions; using VNLib.Plugins.Extensions.Loading; +using VNLib.Plugins.Extensions.Loading.Routing; using VNLib.Plugins.Extensions.Data.Extensions; using VNLib.Plugins.Extensions.Validation; @@ -47,25 +48,15 @@ using SimpleBookmark.Model; namespace SimpleBookmark.Endpoints { + [EndpointPath("{{path}}")] + [EndpointLogName("Bookmarks")] [ConfigurationName("bm_endpoint")] - internal sealed class BookmarkEndpoint : ProtectedWebEndpoint + internal sealed class BookmarkEndpoint(PluginBase plugin, IConfigScope config) : ProtectedWebEndpoint { private static readonly IValidator<BookmarkEntry> BmValidator = BookmarkEntry.GetValidator(); - private readonly BookmarkStore Bookmarks; - private readonly BookmarkStoreConfig BmConfig; - - public BookmarkEndpoint(PluginBase plugin, IConfigScope config) - { - string? path = config.GetRequiredProperty("path", p => p.GetString()!); - InitPathAndLog(path, plugin.Log); - - //Init bookmark store - Bookmarks = plugin.GetOrCreateSingleton<BookmarkStore>(); - - //Load config - BmConfig = config.GetRequiredProperty("config", p => p.Deserialize<BookmarkStoreConfig>()!); - } + private readonly BookmarkStore Bookmarks = plugin.GetOrCreateSingleton<BookmarkStore>(); + private readonly BookmarkStoreConfig BmConfig = config.GetRequiredProperty<BookmarkStoreConfig>("config"); ///<inheritdoc/> protected override async ValueTask<VfReturnType> GetAsync(HttpEntity entity) diff --git a/back-end/src/Endpoints/SiteLookupEndpoint.cs b/back-end/src/Endpoints/SiteLookupEndpoint.cs index effe6aa..f184ea9 100644 --- a/back-end/src/Endpoints/SiteLookupEndpoint.cs +++ b/back-end/src/Endpoints/SiteLookupEndpoint.cs @@ -28,11 +28,14 @@ using VNLib.Plugins.Essentials.Endpoints; using VNLib.Plugins.Essentials.Extensions; using VNLib.Plugins.Extensions.Loading; using VNLib.Plugins.Extensions.Validation; +using VNLib.Plugins.Extensions.Loading.Routing; using SimpleBookmark.PlatformFeatures.Curl; namespace SimpleBookmark.Endpoints { + [EndpointPath("{{path}}")] + [EndpointLogName("Site Lookup")] [ConfigurationName("curl")] internal sealed class SiteLookupEndpoint : ProtectedWebEndpoint { @@ -44,11 +47,8 @@ namespace SimpleBookmark.Endpoints public SiteLookupEndpoint(PluginBase plugin, IConfigScope config) { - string path = config.GetRequiredProperty("path", p => p.GetString()!); - InitPathAndLog(path, plugin.Log); - - string exePath = config.GetValueOrDefault("exe_path", p => p.GetString(), DefaultCurlExecName); - bool httspOnly = config.GetValueOrDefault("https_only", p => p.GetBoolean(), false); + string exePath = config.GetValueOrDefault("exe_path", DefaultCurlExecName); + bool httspOnly = config.GetValueOrDefault("https_only", false); //Optional extra arguments string[] extrArgs = config.GetValueOrDefault( |