Recreated plugin with new project template. Started implementing server system daemon
This commit is contained in:
@@ -1,59 +0,0 @@
|
||||
using MoonlightServers.Frontend.Interfaces;
|
||||
using MoonlightServers.Frontend.Models;
|
||||
using MoonlightServers.Shared.Constants;
|
||||
using MoonlightServers.Shared.Http.Responses.Client.Servers;
|
||||
|
||||
namespace MoonlightServers.Frontend.Implementations;
|
||||
|
||||
public class DefaultPermissionProvider : IServerPermissionProvider
|
||||
{
|
||||
public Task<ServerPermission[]> GetPermissionsAsync(ServerDetailResponse server)
|
||||
{
|
||||
ServerPermission[] permissions = [
|
||||
new()
|
||||
{
|
||||
Identifier = ServerPermissionConstants.Console,
|
||||
Description = "Allows access to the console",
|
||||
DisplayName = "Console",
|
||||
Icon = "icon-square-terminal"
|
||||
},
|
||||
new()
|
||||
{
|
||||
Identifier = ServerPermissionConstants.Files,
|
||||
Description = "Allows access to the files",
|
||||
DisplayName = "Files",
|
||||
Icon = "icon-folder"
|
||||
},
|
||||
new()
|
||||
{
|
||||
Identifier = ServerPermissionConstants.Power,
|
||||
Description = "Allows actions like turning off the server and starting it",
|
||||
DisplayName = "Power",
|
||||
Icon = "icon-power"
|
||||
},
|
||||
new()
|
||||
{
|
||||
Identifier = ServerPermissionConstants.Settings,
|
||||
Description = "Gives permissions to perform re-installs or change other general settings",
|
||||
DisplayName = "Settings",
|
||||
Icon = "icon-settings"
|
||||
},
|
||||
new()
|
||||
{
|
||||
Identifier = ServerPermissionConstants.Shares,
|
||||
Description = "Dangerous! This allows control to the available shares and their access level for a server",
|
||||
DisplayName = "Shares",
|
||||
Icon = "icon-users"
|
||||
},
|
||||
new()
|
||||
{
|
||||
Identifier = ServerPermissionConstants.Variables,
|
||||
Description = "Allows access to the server software specific settings",
|
||||
DisplayName = "Variables",
|
||||
Icon = "icon-variable"
|
||||
}
|
||||
];
|
||||
|
||||
return Task.FromResult(permissions);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using MoonlightServers.Frontend.Interfaces;
|
||||
using MoonlightServers.Frontend.Models;
|
||||
using MoonlightServers.Frontend.UI.Components.Servers.ServerTabs;
|
||||
using MoonlightServers.Shared.Constants;
|
||||
using MoonlightServers.Shared.Enums;
|
||||
using MoonlightServers.Shared.Http.Responses.Client.Servers;
|
||||
|
||||
namespace MoonlightServers.Frontend.Implementations;
|
||||
|
||||
public class DefaultServerTabProvider : IServerTabProvider
|
||||
{
|
||||
public Task<ServerTab[]> GetTabsAsync(ServerDetailResponse server)
|
||||
{
|
||||
ServerTab[] tabs =
|
||||
[
|
||||
ServerTab.CreateFromComponent<ConsoleTab>("Console", "console", 0, ServerPermissionConstants.Console, ServerPermissionLevel.Read),
|
||||
ServerTab.CreateFromComponent<FilesTab>("Files", "files", 1, ServerPermissionConstants.Files, ServerPermissionLevel.Read),
|
||||
ServerTab.CreateFromComponent<SharesTab>("Shares", "shares", 2, ServerPermissionConstants.Shares, ServerPermissionLevel.ReadWrite),
|
||||
ServerTab.CreateFromComponent<VariablesTab>("Variables", "variables", 9, ServerPermissionConstants.Variables, ServerPermissionLevel.Read),
|
||||
ServerTab.CreateFromComponent<SettingsTab>("Settings", "settings", 10, ServerPermissionConstants.Settings, ServerPermissionLevel.Read),
|
||||
];
|
||||
|
||||
return Task.FromResult(tabs);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using LucideBlazor;
|
||||
using Moonlight.Frontend.Interfaces;
|
||||
using Moonlight.Frontend.Models;
|
||||
|
||||
namespace MoonlightServers.Frontend.Implementations;
|
||||
|
||||
public class PermissionProvider : IPermissionProvider
|
||||
{
|
||||
public Task<PermissionCategory[]> GetPermissionsAsync()
|
||||
{
|
||||
return Task.FromResult<PermissionCategory[]>([
|
||||
new PermissionCategory("Demo", typeof(SparklesIcon), [
|
||||
new Permission("Permissions:Demo", "Demo", "Access to demo page")
|
||||
])
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using Moonlight.Client.Interfaces;
|
||||
using Moonlight.Client.Models;
|
||||
|
||||
namespace MoonlightServers.Frontend.Implementations;
|
||||
|
||||
public class SidebarImplementation : ISidebarItemProvider
|
||||
{
|
||||
public void ModifySidebar(List<SidebarItem> items)
|
||||
{
|
||||
items.AddRange(
|
||||
[
|
||||
new SidebarItem()
|
||||
{
|
||||
Name = "Servers",
|
||||
Path = "/servers",
|
||||
Icon = "icon-server",
|
||||
Priority = 4
|
||||
},
|
||||
new SidebarItem()
|
||||
{
|
||||
Name = "Servers",
|
||||
Path = "/admin/servers",
|
||||
Icon = "icon-server",
|
||||
Group = "Admin",
|
||||
Policy = "permissions:admin.servers.overview",
|
||||
Priority = 4
|
||||
}
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
21
MoonlightServers.Frontend/Implementations/SidebarProvider.cs
Normal file
21
MoonlightServers.Frontend/Implementations/SidebarProvider.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using LucideBlazor;
|
||||
using Moonlight.Frontend.Interfaces;
|
||||
using Moonlight.Frontend.Models;
|
||||
|
||||
namespace MoonlightServers.Frontend.Implementations;
|
||||
|
||||
public sealed class SidebarProvider : ISidebarProvider
|
||||
{
|
||||
public Task<SidebarItem[]> GetItemsAsync()
|
||||
{
|
||||
return Task.FromResult<SidebarItem[]>([
|
||||
new SidebarItem()
|
||||
{
|
||||
Group = "Demo",
|
||||
Name = "Demo",
|
||||
IconType = typeof(SparklesIcon),
|
||||
Path = "/demo"
|
||||
}
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user