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