Compare commits

...

6 Commits

Author SHA1 Message Date
Leonmmcoset
9fc4a406a1 assets 2025-10-22 21:13:37 +08:00
Leonmmcoset
d3a64c0a77 add anc 2025-10-22 21:10:46 +08:00
Leonmmcoset
d8ab1d1146 assets 2025-10-21 21:36:48 +08:00
Leonmmcoset
03ad8363dc assets 2025-10-21 21:27:47 +08:00
Leonmmcoset
a2bd2773ca assets 2025-10-21 21:16:10 +08:00
Leonmmcoset
fccb58ad7d assets 2025-10-21 20:54:01 +08:00
4 changed files with 35 additions and 18 deletions

2
assets

Submodule assets updated: 921570f229...80718dfc8b

View File

@@ -1,8 +1,9 @@
package cache
import (
"github.com/stretchr/testify/assert"
"testing"
"github.com/stretchr/testify/assert"
)
func TestSet(t *testing.T) {

View File

@@ -776,6 +776,16 @@ func (s *settingProvider) PWA(ctx context.Context) *PWASetting {
}
}
// AnnouncementEnabled returns true if announcement is enabled.
func (s *settingProvider) AnnouncementEnabled(ctx context.Context) bool {
return s.getBoolean(ctx, "announcement_enabled", false)
}
// Announcement returns the site announcement content.
func (s *settingProvider) Announcement(ctx context.Context) string {
return s.getString(ctx, "announcement", "")
}
func IsTrueValue(val string) bool {
return val == "1" || val == "true"
}

View File

@@ -60,6 +60,10 @@ type SiteConfig struct {
// App settings
AppPromotion bool `json:"app_promotion,omitempty"`
// Announcement settings
AnnouncementEnabled bool `json:"announcement_enabled,omitempty"`
Announcement string `json:"announcement,omitempty"`
//EmailActive bool `json:"emailActive"`
//QQLogin bool `json:"QQLogin"`
//ScoreEnabled bool `json:"score_enabled"`
@@ -183,22 +187,24 @@ func (s *GetSettingService) GetSiteConfig(c *gin.Context) (*SiteConfig, error) {
customNavItems := settings.CustomNavItems(c)
customHTML := settings.CustomHTML(c)
return &SiteConfig{
InstanceID: siteBasic.ID,
SiteName: siteBasic.Name,
Themes: themes.Themes,
DefaultTheme: themes.DefaultTheme,
User: &userRes,
Logo: logo.Normal,
LogoLight: logo.Light,
CaptchaType: settings.CaptchaType(c),
TurnstileSiteID: settings.TurnstileCaptcha(c).Key,
ReCaptchaKey: reCaptcha.Key,
CapInstanceURL: capCaptcha.InstanceURL,
CapSiteKey: capCaptcha.SiteKey,
CapAssetServer: capCaptcha.AssetServer,
AppPromotion: appSetting.Promotion,
CustomNavItems: customNavItems,
CustomHTML: customHTML,
InstanceID: siteBasic.ID,
SiteName: siteBasic.Name,
Themes: themes.Themes,
DefaultTheme: themes.DefaultTheme,
User: &userRes,
Logo: logo.Normal,
LogoLight: logo.Light,
CaptchaType: settings.CaptchaType(c),
TurnstileSiteID: settings.TurnstileCaptcha(c).Key,
ReCaptchaKey: reCaptcha.Key,
CapInstanceURL: capCaptcha.InstanceURL,
CapSiteKey: capCaptcha.SiteKey,
CapAssetServer: capCaptcha.AssetServer,
AppPromotion: appSetting.Promotion,
CustomNavItems: customNavItems,
CustomHTML: customHTML,
AnnouncementEnabled: settings.AnnouncementEnabled(c),
Announcement: settings.Announcement(c),
}, nil
}