diff --git a/src/YumeChan.NetRunner/Pages/BotPlugins.razor b/src/YumeChan.NetRunner/Pages/BotPlugins.razor index 8fe8db7..0c36365 100644 --- a/src/YumeChan.NetRunner/Pages/BotPlugins.razor +++ b/src/YumeChan.NetRunner/Pages/BotPlugins.razor @@ -3,39 +3,28 @@ @using YumeChan.PluginBase; @using YumeChan.Core.Services.Plugins +@using YumeChan.NetRunner.Shared.Plugins @inject AuthenticationStateProvider AuthStateProvider; @inject PluginsLoader PluginsLoader; -

Plugins

-
-

Currently Loaded : @PluginsLoader.PluginManifests.Count Plugins

-
- - - - - - - - - - - - - @foreach (IPlugin pluginManifest in PluginsLoader.PluginManifests.Values.Where(p => _isAdmin || !p.StealthMode)) - { - - - - - - - } - -
AssemblyPlugin NameVersionActive
@pluginManifest.AssemblyName@pluginManifest.DisplayName@pluginManifest.Version@(pluginManifest.Loaded ? "Yes" : "No")
+
+

Plugins

+

Currently Loaded : @PluginsLoader.PluginManifests.Count Plugins

+
+ +
+ @foreach (IPlugin pluginManifest in PluginsLoader.PluginManifests.Values.Where(p => _isAdmin || !p.StealthMode)) + { +
+ +
+ } + +
+ @code { diff --git a/src/YumeChan.NetRunner/Shared/Plugins/PluginCard.razor b/src/YumeChan.NetRunner/Shared/Plugins/PluginCard.razor new file mode 100644 index 0000000..9999fb1 --- /dev/null +++ b/src/YumeChan.NetRunner/Shared/Plugins/PluginCard.razor @@ -0,0 +1,86 @@ +@using YumeChan.PluginBase + +@* + Structure: + - Plugin Icon + - Plugin Name + - Plugin Description + - Plugin Version / Author(s) + - Plugin Status +*@ + + +
+ @PluginManifest.DisplayName + +
+

@PluginManifest.DisplayName

+ + @PluginManifest.AssemblyName + +
+ +

@PluginManifest.Description

+ +
+ @* Dashboard: Centre button *@ + + Dashboard + + +
+ @if (PluginManifest.ProjectHomepage is not null) + { + + Homepage + + } + + @if (PluginManifest.SourceCodeRepository is not null) + { + + Repository + + } + + @if (PluginManifest.AuthorContact is not null) + { + bool isEmail = PluginManifest.AuthorContact.Contains('@'); + bool isUrl = Uri.TryCreate(PluginManifest.AuthorContact, UriKind.Absolute, out _); + string builtUrl = isUrl ? PluginManifest.AuthorContact : isEmail ? $"mailto:{PluginManifest.AuthorContact}" : null; + + + @(isEmail ? "Contact" : "Author") + + } +
+ +
+ @VersionInfo.Item1 + @(PluginManifest.Author ?? "Unknown") +
+
+
+ +@code { + [Parameter] + public IPlugin PluginManifest { get; set; } + + public (string, string?) VersionInfo { get; set; } = ("", ""); + + protected override void OnParametersSet() + { + if (PluginManifest.Version is { Length: not 0 } version) + { + // Try splitting the version string into two parts + VersionInfo = version.LastIndexOf('+') is var hashIndex and not -1 + ? (version[..hashIndex], version[(hashIndex + 1)..]) + : (version, null); + } + + base.OnParametersSet(); + } + +} \ No newline at end of file diff --git a/src/YumeChan.NetRunner/wwwroot/plugin.svg b/src/YumeChan.NetRunner/wwwroot/plugin.svg new file mode 100644 index 0000000..3a2ab42 --- /dev/null +++ b/src/YumeChan.NetRunner/wwwroot/plugin.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file