Config: Make options available to all users
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
parent
6da54f9e75
commit
0e415fec1c
8 changed files with 30 additions and 64 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
**By using the software and services we provide, you agree to our [Terms of Service](https://www.photoprism.app/terms), including our [Privacy Policy](https://www.photoprism.app/privacy) and the following Code of Conduct. It explains the "dos and don’ts" when interacting with our team and other community members.**
|
||||
|
||||
*Last Updated: May 12, 2023*
|
||||
*Last Updated: May 13, 2023*
|
||||
|
||||
## Rules
|
||||
|
||||
|
@ -18,7 +18,7 @@ Because we want our Code of Conduct to be easy to understand and implement, we h
|
|||
|
||||
Not everyone has experience with Open Source communities and intuitively knows what is acceptable. In that case, the following guidelines and examples are meant to provide a quick overview and help you avoid the most common pitfalls:
|
||||
|
||||
(a) Do not feel entitled to free software, support, or advice, especially if you are not a contributor, [member](https://link.photoprism.app/membership), or paying customer. Don't expect contributors to report to you and [meet deadlines](https://docs.photoprism.app/developer-guide/code-quality/#go-slow-before-you-go-fast) as if they work for you or owe you something, even if you donated a small amount. We also ask that you do not use GitHub Issues or other development tools to start general discussions, get technical support, or express personal opinions.
|
||||
(a) Do not [feel entitled](https://www.reddit.com/r/photoprism/comments/13emwf0/did_you_guys_really_nerf_hardware_transcoding/) to free software, support, or advice, especially if you are not a contributor, [member](https://link.photoprism.app/membership), or paying customer. Don't expect contributors to report to you and [meet deadlines](https://docs.photoprism.app/developer-guide/code-quality/#go-slow-before-you-go-fast) as if they work for you or owe you something, even if you donated a small amount. We also ask that you do not use GitHub Issues or other development tools to start general discussions, get technical support, or express personal opinions.
|
||||
|
||||
(b) Honor **Rule #2**, [read the docs](https://docs.photoprism.app) and [determine the cause of your problem](https://docs.photoprism.app/getting-started/troubleshooting/) before opening invalid bug reports, starting a public "shitstorm", or insulting other community members in our chat rooms. Aside from being annoying for everyone, it also keeps our team from working on features and enhancements that users like you are waiting for.
|
||||
|
||||
|
|
|
@ -426,16 +426,12 @@ func (c *Config) ApiUri() string {
|
|||
|
||||
// CdnUrl returns the optional content delivery network URI without trailing slash.
|
||||
func (c *Config) CdnUrl(res string) string {
|
||||
if c.NoSponsor() {
|
||||
return res
|
||||
}
|
||||
|
||||
return strings.TrimRight(c.options.CdnUrl, "/") + res
|
||||
}
|
||||
|
||||
// CdnVideo checks if videos should be streamed using the configured CDN.
|
||||
func (c *Config) CdnVideo() bool {
|
||||
if c.NoSponsor() || c.options.CdnUrl == "" {
|
||||
if c.options.CdnUrl == "" {
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -500,7 +496,7 @@ func (c *Config) SiteAuthor() string {
|
|||
|
||||
// SiteTitle returns the main site title (default is application name).
|
||||
func (c *Config) SiteTitle() string {
|
||||
if c.options.SiteTitle == "" || c.NoSponsor() {
|
||||
if c.options.SiteTitle == "" {
|
||||
return c.Name()
|
||||
}
|
||||
|
||||
|
@ -519,7 +515,7 @@ func (c *Config) SiteDescription() string {
|
|||
|
||||
// SitePreview returns the site preview image URL for sharing.
|
||||
func (c *Config) SitePreview() string {
|
||||
if c.options.SitePreview == "" || c.NoSponsor() {
|
||||
if c.options.SitePreview == "" {
|
||||
return fmt.Sprintf("https://i.photoprism.app/prism?cover=64&style=centered%%20dark&caption=none&title=%s", url.QueryEscape(c.AppName()))
|
||||
}
|
||||
|
||||
|
@ -532,10 +528,6 @@ func (c *Config) SitePreview() string {
|
|||
|
||||
// LegalInfo returns the legal info text for the page footer.
|
||||
func (c *Config) LegalInfo() string {
|
||||
if c.NoSponsor() {
|
||||
return SignUpInfo
|
||||
}
|
||||
|
||||
if s := c.CliGlobalString("imprint"); s != "" {
|
||||
log.Warnf("config: option 'imprint' is deprecated, please use 'legal-info'")
|
||||
return s
|
||||
|
@ -546,10 +538,6 @@ func (c *Config) LegalInfo() string {
|
|||
|
||||
// LegalUrl returns the legal info url.
|
||||
func (c *Config) LegalUrl() string {
|
||||
if c.NoSponsor() {
|
||||
return SignUpURL
|
||||
}
|
||||
|
||||
if s := c.CliGlobalString("imprint-url"); s != "" {
|
||||
log.Warnf("config: option 'imprint-url' is deprecated, please use 'legal-url'")
|
||||
return s
|
||||
|
@ -604,11 +592,6 @@ func (c *Config) Sponsor() bool {
|
|||
return Sponsor
|
||||
}
|
||||
|
||||
// NoSponsor reports if you prefer not to support our mission.
|
||||
func (c *Config) NoSponsor() bool {
|
||||
return !c.Sponsor() && !c.Demo()
|
||||
}
|
||||
|
||||
// Experimental checks if experimental features should be enabled.
|
||||
func (c *Config) Experimental() bool {
|
||||
return c.options.Experimental
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
func (c *Config) AppName() string {
|
||||
name := strings.TrimSpace(c.options.AppName)
|
||||
|
||||
if c.NoSponsor() || name == "" {
|
||||
if name == "" {
|
||||
name = c.SiteTitle()
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ func (c *Config) AppMode() string {
|
|||
func (c *Config) AppIcon() string {
|
||||
defaultIcon := "logo"
|
||||
|
||||
if c.NoSponsor() || c.options.AppIcon == "" || c.options.AppIcon == defaultIcon {
|
||||
if c.options.AppIcon == "" || c.options.AppIcon == defaultIcon {
|
||||
// Default.
|
||||
} else if strings.Contains(c.options.AppIcon, "/") {
|
||||
return c.options.AppIcon
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
|
||||
// DefaultTheme returns the default user interface theme name.
|
||||
func (c *Config) DefaultTheme() string {
|
||||
if c.options.DefaultTheme == "" || c.NoSponsor() {
|
||||
if c.options.DefaultTheme == "" {
|
||||
return "default"
|
||||
}
|
||||
|
||||
|
|
|
@ -14,15 +14,15 @@ func TestConfig_DefaultTheme(t *testing.T) {
|
|||
c.options.Sponsor = false
|
||||
c.options.Test = false
|
||||
c.options.DefaultTheme = "grayscale"
|
||||
assert.Equal(t, "default", c.DefaultTheme())
|
||||
assert.Equal(t, "grayscale", c.DefaultTheme())
|
||||
c.options.Sponsor = true
|
||||
assert.Equal(t, "grayscale", c.DefaultTheme())
|
||||
c.options.Sponsor = false
|
||||
c.options.Test = true
|
||||
assert.Equal(t, "default", c.DefaultTheme())
|
||||
assert.Equal(t, "grayscale", c.DefaultTheme())
|
||||
c.options.Sponsor = false
|
||||
c.options.Test = false
|
||||
assert.Equal(t, "default", c.DefaultTheme())
|
||||
assert.Equal(t, "grayscale", c.DefaultTheme())
|
||||
c.options.Sponsor = true
|
||||
c.options.DefaultTheme = ""
|
||||
assert.Equal(t, "default", c.DefaultTheme())
|
||||
|
|
|
@ -31,7 +31,7 @@ func (c *Config) FaceOverlap() int {
|
|||
|
||||
// FaceClusterSize returns the size threshold for faces forming a cluster in pixels.
|
||||
func (c *Config) FaceClusterSize() int {
|
||||
if c.NoSponsor() || c.options.FaceClusterSize < 20 || c.options.FaceClusterSize > 10000 {
|
||||
if c.options.FaceClusterSize < 20 || c.options.FaceClusterSize > 10000 {
|
||||
return face.ClusterSizeThreshold
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ func (c *Config) FaceClusterSize() int {
|
|||
|
||||
// FaceClusterScore returns the quality threshold for faces forming a cluster.
|
||||
func (c *Config) FaceClusterScore() int {
|
||||
if c.NoSponsor() || c.options.FaceClusterScore < 1 || c.options.FaceClusterScore > 100 {
|
||||
if c.options.FaceClusterScore < 1 || c.options.FaceClusterScore > 100 {
|
||||
return face.ClusterScoreThreshold
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ func (c *Config) FaceClusterScore() int {
|
|||
|
||||
// FaceClusterCore returns the number of faces forming a cluster core.
|
||||
func (c *Config) FaceClusterCore() int {
|
||||
if c.NoSponsor() || c.options.FaceClusterCore < 1 || c.options.FaceClusterCore > 100 {
|
||||
if c.options.FaceClusterCore < 1 || c.options.FaceClusterCore > 100 {
|
||||
return face.ClusterCore
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ func (c *Config) FaceClusterCore() int {
|
|||
|
||||
// FaceClusterDist returns the radius of faces forming a cluster core.
|
||||
func (c *Config) FaceClusterDist() float64 {
|
||||
if c.NoSponsor() || c.options.FaceClusterDist < 0.1 || c.options.FaceClusterDist > 1.5 {
|
||||
if c.options.FaceClusterDist < 0.1 || c.options.FaceClusterDist > 1.5 {
|
||||
return face.ClusterDist
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ func (c *Config) FaceClusterDist() float64 {
|
|||
|
||||
// FaceMatchDist returns the offset distance when matching faces with clusters.
|
||||
func (c *Config) FaceMatchDist() float64 {
|
||||
if c.NoSponsor() || c.options.FaceMatchDist < 0.1 || c.options.FaceMatchDist > 1.5 {
|
||||
if c.options.FaceMatchDist < 0.1 || c.options.FaceMatchDist > 1.5 {
|
||||
return face.MatchDist
|
||||
}
|
||||
|
||||
|
|
|
@ -20,9 +20,6 @@ func (c *Config) FFmpegEnabled() bool {
|
|||
func (c *Config) FFmpegEncoder() ffmpeg.AvcEncoder {
|
||||
if c.options.FFmpegEncoder == "" || c.options.FFmpegEncoder == ffmpeg.SoftwareEncoder.String() {
|
||||
return ffmpeg.SoftwareEncoder
|
||||
} else if c.NoSponsor() {
|
||||
log.Infof("ffmpeg: hardware transcoding is available to members only")
|
||||
return ffmpeg.SoftwareEncoder
|
||||
}
|
||||
|
||||
return ffmpeg.FindEncoder(c.options.FFmpegEncoder)
|
||||
|
|
|
@ -327,15 +327,13 @@ var Flags = CliFlags{
|
|||
Name: "default-theme",
|
||||
Usage: "standard user interface theme `NAME`",
|
||||
EnvVar: EnvVar("DEFAULT_THEME"),
|
||||
},
|
||||
Tags: []string{Essentials}}, {
|
||||
}}, {
|
||||
Flag: cli.StringFlag{
|
||||
Name: "app-name",
|
||||
Usage: "progressive web app `NAME` when installed on a device",
|
||||
Value: "",
|
||||
EnvVar: EnvVar("APP_NAME"),
|
||||
},
|
||||
Tags: []string{Essentials}}, {
|
||||
}}, {
|
||||
Flag: cli.StringFlag{
|
||||
Name: "app-mode",
|
||||
Usage: "progressive web app `MODE` (fullscreen, standalone, minimal-ui, browser)",
|
||||
|
@ -346,8 +344,7 @@ var Flags = CliFlags{
|
|||
Name: "app-icon",
|
||||
Usage: "home screen `ICON` (logo, app, crisp, mint, bold, square)",
|
||||
EnvVar: EnvVar("APP_ICON"),
|
||||
},
|
||||
Tags: []string{Essentials}}, {
|
||||
}}, {
|
||||
Flag: cli.StringFlag{
|
||||
Name: "app-color",
|
||||
Usage: "splash screen `COLOR` code",
|
||||
|
@ -360,30 +357,26 @@ var Flags = CliFlags{
|
|||
Value: "",
|
||||
Hidden: true,
|
||||
EnvVar: EnvVar("IMPRINT"),
|
||||
},
|
||||
Tags: []string{Essentials}}, {
|
||||
}}, {
|
||||
Flag: cli.StringFlag{
|
||||
Name: "legal-info",
|
||||
Usage: "legal information `TEXT`, displayed in the page footer",
|
||||
Value: "",
|
||||
EnvVar: EnvVar("LEGAL_INFO"),
|
||||
},
|
||||
Tags: []string{Essentials}}, {
|
||||
}}, {
|
||||
Flag: cli.StringFlag{
|
||||
Name: "imprint-url",
|
||||
Usage: "legal information `URL`",
|
||||
Value: "",
|
||||
Hidden: true,
|
||||
EnvVar: EnvVar("IMPRINT_URL"),
|
||||
},
|
||||
Tags: []string{Essentials}}, {
|
||||
}}, {
|
||||
Flag: cli.StringFlag{
|
||||
Name: "legal-url",
|
||||
Usage: "legal information `URL`",
|
||||
Value: "",
|
||||
EnvVar: EnvVar("LEGAL_URL"),
|
||||
},
|
||||
Tags: []string{Essentials}}, {
|
||||
}}, {
|
||||
Flag: cli.StringFlag{
|
||||
Name: "wallpaper-uri",
|
||||
Usage: "login screen background image `URI`",
|
||||
|
@ -394,14 +387,12 @@ var Flags = CliFlags{
|
|||
Name: "cdn-url",
|
||||
Usage: "content delivery network `URL`",
|
||||
EnvVar: EnvVar("CDN_URL"),
|
||||
},
|
||||
Tags: []string{Essentials}}, {
|
||||
}}, {
|
||||
Flag: cli.BoolFlag{
|
||||
Name: "cdn-video",
|
||||
Usage: "stream videos over the specified CDN",
|
||||
EnvVar: EnvVar("CDN_VIDEO"),
|
||||
},
|
||||
Tags: []string{Essentials}}, {
|
||||
}}, {
|
||||
Flag: cli.StringFlag{
|
||||
Name: "site-url, url",
|
||||
Usage: "public site `URL`",
|
||||
|
@ -418,8 +409,7 @@ var Flags = CliFlags{
|
|||
Usage: "site `TITLE`",
|
||||
Value: "",
|
||||
EnvVar: EnvVar("SITE_TITLE"),
|
||||
},
|
||||
Tags: []string{Essentials}}, {
|
||||
}}, {
|
||||
Flag: cli.StringFlag{
|
||||
Name: "site-caption",
|
||||
Usage: "site `CAPTION`",
|
||||
|
@ -583,8 +573,7 @@ var Flags = CliFlags{
|
|||
Usage: "FFmpeg AVC encoder `NAME`",
|
||||
Value: "libx264",
|
||||
EnvVar: EnvVar("FFMPEG_ENCODER"),
|
||||
},
|
||||
Tags: []string{Essentials}}, {
|
||||
}}, {
|
||||
Flag: cli.IntFlag{
|
||||
Name: "ffmpeg-bitrate, vb",
|
||||
Usage: "maximum FFmpeg encoding `BITRATE` (Mbit/s)",
|
||||
|
@ -755,22 +744,19 @@ var Flags = CliFlags{
|
|||
Usage: "`NUMBER` of faces forming a cluster core (1-100)",
|
||||
Value: face.ClusterCore,
|
||||
EnvVar: EnvVar("FACE_CLUSTER_CORE"),
|
||||
},
|
||||
Tags: []string{Essentials}}, {
|
||||
}}, {
|
||||
Flag: cli.Float64Flag{
|
||||
Name: "face-cluster-dist",
|
||||
Usage: "similarity `DISTANCE` of faces forming a cluster core (0.1-1.5)",
|
||||
Value: face.ClusterDist,
|
||||
EnvVar: EnvVar("FACE_CLUSTER_DIST"),
|
||||
},
|
||||
Tags: []string{Essentials}}, {
|
||||
}}, {
|
||||
Flag: cli.Float64Flag{
|
||||
Name: "face-match-dist",
|
||||
Usage: "similarity `OFFSET` for matching faces with existing clusters (0.1-1.5)",
|
||||
Value: face.MatchDist,
|
||||
EnvVar: EnvVar("FACE_MATCH_DIST"),
|
||||
},
|
||||
Tags: []string{Essentials}}, {
|
||||
}}, {
|
||||
Flag: cli.StringFlag{
|
||||
Name: "pid-filename",
|
||||
Usage: "process id `FILE` *daemon-mode only*",
|
||||
|
|
Loading…
Reference in a new issue