fix: use theme background as default
This commit is contained in:
parent
71ea41cb07
commit
7e5f3995b4
5 changed files with 22 additions and 28 deletions
|
@ -45,20 +45,22 @@ export class RootFrame extends React.Component<Props, State, {}> {
|
|||
}
|
||||
|
||||
makeBgStyle = (): Object => {
|
||||
if (
|
||||
this.props.login.preferences != null &&
|
||||
this.props.login.preferences.bg.url !== ""
|
||||
) {
|
||||
const bgConfig = this.props.login.preferences.bg;
|
||||
return {
|
||||
background: `url("${bgConfig.url}") ${bgConfig.repeat} ${bgConfig.position} ${bgConfig.align}`,
|
||||
};
|
||||
}
|
||||
if (this.props.ui.clientCfg.allowSetBg) {
|
||||
if (
|
||||
this.props.login.preferences != null &&
|
||||
this.props.login.preferences.bg.url !== ""
|
||||
) {
|
||||
const bgConfig = this.props.login.preferences.bg;
|
||||
return {
|
||||
background: `url("${bgConfig.url}") ${bgConfig.repeat} ${bgConfig.position} ${bgConfig.align}`,
|
||||
};
|
||||
}
|
||||
|
||||
if (this.props.login.preferences.bg.bgColor !== "") {
|
||||
return {
|
||||
backgroundColor: this.props.login.preferences.bg.bgColor,
|
||||
};
|
||||
if (this.props.login.preferences.bg.bgColor !== "") {
|
||||
return {
|
||||
backgroundColor: this.props.login.preferences.bg.bgColor,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (this.props.ui.clientCfg.bg.url !== "") {
|
||||
|
|
|
@ -38,10 +38,11 @@ var (
|
|||
DefaultSiteName = "Quickshare"
|
||||
DefaultSiteDesc = "Quickshare"
|
||||
DefaultBgConfig = &BgConfig{
|
||||
Url: "",
|
||||
Repeat: "repeat",
|
||||
Position: "top",
|
||||
Align: "fixed",
|
||||
BgColor: "#ccc",
|
||||
BgColor: "",
|
||||
}
|
||||
DefaultAllowSetBg = false
|
||||
DefaultAutoTheme = true
|
||||
|
@ -266,12 +267,6 @@ func CheckPreferences(prefers *Preferences, fillDefault bool) error {
|
|||
}
|
||||
|
||||
func CheckBgConfig(cfg *BgConfig, fillDefault bool) error {
|
||||
if cfg.Url == "" && cfg.BgColor == "" {
|
||||
if !fillDefault {
|
||||
return errors.New("one of Bg.Url or Bg.BgColor must be defined")
|
||||
}
|
||||
cfg.BgColor = DefaultBgConfig.BgColor
|
||||
}
|
||||
if !BgRepeatValues[cfg.Repeat] {
|
||||
return fmt.Errorf("invalid repeat value (%s)", cfg.Repeat)
|
||||
}
|
||||
|
@ -291,9 +286,6 @@ func CheckBgConfig(cfg *BgConfig, fillDefault bool) error {
|
|||
if cfg.Align == "" {
|
||||
cfg.Align = DefaultBgConfig.Align
|
||||
}
|
||||
if cfg.BgColor == "" {
|
||||
cfg.BgColor = DefaultBgConfig.BgColor
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -123,11 +123,11 @@ func DefaultConfigStruct() *Config {
|
|||
SiteName: "Quickshare",
|
||||
SiteDesc: "Quick and simple file sharing",
|
||||
Bg: &db.BgConfig{
|
||||
Url: "/static/img/textured_paper.png",
|
||||
Url: "",
|
||||
Repeat: "repeat",
|
||||
Position: "center",
|
||||
Align: "fixed",
|
||||
BgColor: "#ccc",
|
||||
BgColor: "",
|
||||
},
|
||||
AllowSetBg: false,
|
||||
AutoTheme: true,
|
||||
|
|
|
@ -167,11 +167,11 @@ func initDeps(cfg gocfg.ICfg) *depidx.Deps {
|
|||
SiteName: cfg.StringOr("Site.ClientCfg.SiteName", "Quickshare"),
|
||||
SiteDesc: cfg.StringOr("Site.ClientCfg.SiteDesc", "Quick and simple file sharing"),
|
||||
Bg: &db.BgConfig{
|
||||
Url: cfg.StringOr("Site.ClientCfg.Bg.Url", "/static/img/textured_paper.png"),
|
||||
Url: cfg.StringOr("Site.ClientCfg.Bg.Url", ""),
|
||||
Repeat: cfg.StringOr("Site.ClientCfg.Bg.Repeat", "repeat"),
|
||||
Position: cfg.StringOr("Site.ClientCfg.Bg.Position", "center"),
|
||||
Align: cfg.StringOr("Site.ClientCfg.Bg.Align", "fixed"),
|
||||
BgColor: cfg.StringOr("Site.ClientCfg.Bg.BgColor", "#ccc"),
|
||||
BgColor: cfg.StringOr("Site.ClientCfg.Bg.BgColor", ""),
|
||||
},
|
||||
},
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue