diff --git a/assets b/assets index d4819ee..aa80ca5 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit d4819eeaf4ed3d443165def69cb89267d31b81da +Subproject commit aa80ca5bb2609d75fc9706d12edd5c6e9a0c76b7 diff --git a/inventory/setting.go b/inventory/setting.go index 1a31699..4bbf3e9 100644 --- a/inventory/setting.go +++ b/inventory/setting.go @@ -518,6 +518,9 @@ var DefaultSettings = map[string]string{ "qq_login_config": `{"direct_sign_in":false}`, "license": "", "custom_nav_items": "[]", + "headless_footer_html": "", + "headless_bottom_html": "", + "sidebar_bottom_html": "", } func init() { diff --git a/pkg/setting/provider.go b/pkg/setting/provider.go index 4b00c66..0fc9534 100644 --- a/pkg/setting/provider.go +++ b/pkg/setting/provider.go @@ -200,6 +200,8 @@ type ( CustomProps(ctx context.Context) []types.CustomProps // CustomNavItems returns the custom nav items settings. CustomNavItems(ctx context.Context) []CustomNavItem + // CustomHTML returns the custom HTML settings. + CustomHTML(ctx context.Context) *CustomHTML } UseFirstSiteUrlCtxKey = struct{} ) @@ -227,6 +229,13 @@ type ( } ) +func (s *settingProvider) CustomHTML(ctx context.Context) *CustomHTML { + return &CustomHTML{ + HeadlessFooter: s.getString(ctx, "headless_footer_html", ""), + HeadlessBody: s.getString(ctx, "headless_bottom_html", ""), + SidebarBottom: s.getString(ctx, "sidebar_bottom_html", ""), + } +} func (s *settingProvider) CustomNavItems(ctx context.Context) []CustomNavItem { raw := s.getString(ctx, "custom_nav_items", "[]") var items []CustomNavItem diff --git a/pkg/setting/types.go b/pkg/setting/types.go index 759dea1..28344ab 100644 --- a/pkg/setting/types.go +++ b/pkg/setting/types.go @@ -215,3 +215,9 @@ type CustomNavItem struct { Name string `json:"name"` URL string `json:"url"` } + +type CustomHTML struct { + HeadlessFooter string `json:"headless_footer,omitempty"` + HeadlessBody string `json:"headless_bottom,omitempty"` + SidebarBottom string `json:"sidebar_bottom,omitempty"` +} diff --git a/service/basic/site.go b/service/basic/site.go index ec295d1..287c0ed 100644 --- a/service/basic/site.go +++ b/service/basic/site.go @@ -21,6 +21,7 @@ type SiteConfig struct { Logo string `json:"logo,omitempty"` LogoLight string `json:"logo_light,omitempty"` CustomNavItems []setting.CustomNavItem `json:"custom_nav_items,omitempty"` + CustomHTML *setting.CustomHTML `json:"custom_html,omitempty"` // Login Section LoginCaptcha bool `json:"login_captcha,omitempty"` @@ -130,6 +131,7 @@ func (s *GetSettingService) GetSiteConfig(c *gin.Context) (*SiteConfig, error) { capCaptcha := settings.CapCaptcha(c) appSetting := settings.AppSetting(c) customNavItems := settings.CustomNavItems(c) + customHTML := settings.CustomHTML(c) return &SiteConfig{ InstanceID: siteBasic.ID, SiteName: siteBasic.Name, @@ -146,6 +148,7 @@ func (s *GetSettingService) GetSiteConfig(c *gin.Context) (*SiteConfig, error) { CapAssetServer: capCaptcha.AssetServer, AppPromotion: appSetting.Promotion, CustomNavItems: customNavItems, + CustomHTML: customHTML, }, nil }