瀏覽代碼

Merge pull request #394 from Moonlight-Panel/v2_AddFooterCustomisation

Added footer customization
Masu Baumgartner 1 年之前
父節點
當前提交
6c722a9ac3

+ 20 - 0
Moonlight/Core/Configuration/CoreConfiguration.cs

@@ -105,6 +105,26 @@ public class CoreConfiguration
 
         [JsonProperty("FileManager")]
         public FileManagerData FileManager { get; set; } = new();
+
+        [JsonProperty("Footer")] public FooterData Footer { get; set; } = new();
+    }
+    
+    public class FooterData
+    {
+        [Description("The name of the copyright holder. If this is changed from the default value, an additional 'Software by' will be shown")]
+        public string CopyrightText { get; set; } = "Moonlight Panel";
+        
+        [Description("The link of the copyright holders website. If this is changed from the default value, an additional 'Software by' will be shown")]
+        public string CopyrightLink { get; set; } = "https://moonlightpanel.xyz";
+
+        [Description("A link to your 'about us' page. Leave it empty if you want to hide it")]
+        public string AboutLink { get; set; } = "https://moonlightpanel.xyz";
+        
+        [Description("A link to your 'privacy' page. Leave it empty if you want to hide it")]
+        public string PrivacyLink { get; set; } = "https://moonlightpanel.xyz";
+        
+        [Description("A link to your 'imprint' page. Leave it empty if you want to hide it")]
+        public string ImprintLink { get; set; } = "https://moonlightpanel.xyz";
     }
     
     public class FileManagerData

+ 41 - 12
Moonlight/Core/UI/Components/Partials/AppFooter.razor

@@ -1,19 +1,48 @@
-<div class="app-footer">
+@using MoonCore.Services
+@using Moonlight.Core.Configuration
+
+@inject ConfigService<CoreConfiguration> ConfigService
+
+@{
+    var config = ConfigService.Get().Customisation.Footer;
+}
+
+<div class="app-footer">
     <div class="app-container container-fluid d-flex flex-column flex-md-row flex-center flex-md-stack py-3 ">
         <div class="text-gray-900 order-2 order-md-1">
-            <span class="text-muted fw-semibold me-1">2024©</span>
-            <a href="https://moonlightpanel.xyz" target="_blank" class="text-gray-800 text-hover-primary">Moonlight Panel</a>
+            <span class="text-muted fw-semibold me-1">© @(DateTime.UtcNow.Year)</span>
+            @if (config.CopyrightText == "Moonlight Panel" && config.CopyrightLink == "https://moonlightpanel.xyz")
+            {
+                <a href="https://moonlightpanel.xyz" target="_blank" class="text-gray-800 text-hover-primary">Moonlight Panel</a>
+            }
+            else
+            {
+                <a href="@config.CopyrightLink" target="_blank" class="text-gray-800 text-hover-primary">@config.CopyrightText</a>
+                <span class="text-muted fw-semibold mx-1">Software by</span>
+                <a href="https://moonlightpanel.xyz" target="_blank" class="text-gray-800 text-hover-primary">Moonlight Panel</a>
+            }
         </div>
         <ul class="menu menu-gray-600 menu-hover-primary fw-semibold order-1">
-            <li class="menu-item">
-                <a href="https://moonlightpanel.xyz" target="_blank" class="menu-link px-2">About</a>
-            </li>
-            <li class="menu-item">
-                <a href="https://moonlightpanel.xyz" target="_blank" class="menu-link px-2">Support</a>
-            </li>
-            <li class="menu-item">
-                <a href="https://moonlightpanel.xyz" target="_blank" class="menu-link px-2">Purchase</a>
-            </li>
+            @if (!string.IsNullOrEmpty(config.AboutLink))
+            {
+                <li class="menu-item">
+                    <a href="@config.AboutLink" target="_blank" class="menu-link px-2">About us</a>
+                </li>
+            }
+
+            @if (!string.IsNullOrEmpty(config.PrivacyLink))
+            {
+                <li class="menu-item">
+                    <a href="@config.PrivacyLink" target="_blank" class="menu-link px-2">Privacy</a>
+                </li>
+            }
+
+            @if (!string.IsNullOrEmpty(config.ImprintLink))
+            {
+                <li class="menu-item">
+                    <a href="@config.ImprintLink" target="_blank" class="menu-link px-2">Imprint</a>
+                </li>
+            }
         </ul>
     </div>
 </div>

+ 1 - 1
Moonlight/Core/UI/Views/Admin/Sys/Settings.razor

@@ -83,7 +83,7 @@ else
         </div>
         <div class="col-md-9 col-12">
             <div class="card card-body">
-                <div class="row">
+                <div class="row g-5">
                     <LazyLoader @ref="LazyLoader" Load="Load">
                         @foreach (var prop in Properties)
                         {