add anc
This commit is contained in:
3
pkg/cache/driver_test.go
vendored
3
pkg/cache/driver_test.go
vendored
@@ -1,8 +1,9 @@
|
|||||||
package cache
|
package cache
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSet(t *testing.T) {
|
func TestSet(t *testing.T) {
|
||||||
|
|||||||
@@ -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 {
|
func IsTrueValue(val string) bool {
|
||||||
return val == "1" || val == "true"
|
return val == "1" || val == "true"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,10 @@ type SiteConfig struct {
|
|||||||
// App settings
|
// App settings
|
||||||
AppPromotion bool `json:"app_promotion,omitempty"`
|
AppPromotion bool `json:"app_promotion,omitempty"`
|
||||||
|
|
||||||
|
// Announcement settings
|
||||||
|
AnnouncementEnabled bool `json:"announcement_enabled,omitempty"`
|
||||||
|
Announcement string `json:"announcement,omitempty"`
|
||||||
|
|
||||||
//EmailActive bool `json:"emailActive"`
|
//EmailActive bool `json:"emailActive"`
|
||||||
//QQLogin bool `json:"QQLogin"`
|
//QQLogin bool `json:"QQLogin"`
|
||||||
//ScoreEnabled bool `json:"score_enabled"`
|
//ScoreEnabled bool `json:"score_enabled"`
|
||||||
@@ -183,22 +187,24 @@ func (s *GetSettingService) GetSiteConfig(c *gin.Context) (*SiteConfig, error) {
|
|||||||
customNavItems := settings.CustomNavItems(c)
|
customNavItems := settings.CustomNavItems(c)
|
||||||
customHTML := settings.CustomHTML(c)
|
customHTML := settings.CustomHTML(c)
|
||||||
return &SiteConfig{
|
return &SiteConfig{
|
||||||
InstanceID: siteBasic.ID,
|
InstanceID: siteBasic.ID,
|
||||||
SiteName: siteBasic.Name,
|
SiteName: siteBasic.Name,
|
||||||
Themes: themes.Themes,
|
Themes: themes.Themes,
|
||||||
DefaultTheme: themes.DefaultTheme,
|
DefaultTheme: themes.DefaultTheme,
|
||||||
User: &userRes,
|
User: &userRes,
|
||||||
Logo: logo.Normal,
|
Logo: logo.Normal,
|
||||||
LogoLight: logo.Light,
|
LogoLight: logo.Light,
|
||||||
CaptchaType: settings.CaptchaType(c),
|
CaptchaType: settings.CaptchaType(c),
|
||||||
TurnstileSiteID: settings.TurnstileCaptcha(c).Key,
|
TurnstileSiteID: settings.TurnstileCaptcha(c).Key,
|
||||||
ReCaptchaKey: reCaptcha.Key,
|
ReCaptchaKey: reCaptcha.Key,
|
||||||
CapInstanceURL: capCaptcha.InstanceURL,
|
CapInstanceURL: capCaptcha.InstanceURL,
|
||||||
CapSiteKey: capCaptcha.SiteKey,
|
CapSiteKey: capCaptcha.SiteKey,
|
||||||
CapAssetServer: capCaptcha.AssetServer,
|
CapAssetServer: capCaptcha.AssetServer,
|
||||||
AppPromotion: appSetting.Promotion,
|
AppPromotion: appSetting.Promotion,
|
||||||
CustomNavItems: customNavItems,
|
CustomNavItems: customNavItems,
|
||||||
CustomHTML: customHTML,
|
CustomHTML: customHTML,
|
||||||
|
AnnouncementEnabled: settings.AnnouncementEnabled(c),
|
||||||
|
Announcement: settings.Announcement(c),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user