2020-12-18 08:11:42 +00:00
|
|
|
package config
|
|
|
|
|
2022-07-05 21:13:34 +00:00
|
|
|
var Sponsor = Env(EnvDemo, EnvSponsor, EnvTest)
|
2022-04-22 15:38:40 +00:00
|
|
|
|
2023-03-27 17:27:19 +00:00
|
|
|
// DisableSettings checks if users should not be allowed to change settings.
|
|
|
|
func (c *Config) DisableSettings() bool {
|
|
|
|
return c.options.DisableSettings
|
|
|
|
}
|
2020-12-18 08:11:42 +00:00
|
|
|
|
2023-03-27 17:27:19 +00:00
|
|
|
// DisableRestart checks if users should not be allowed to restart the server from the user interface.
|
|
|
|
func (c *Config) DisableRestart() bool {
|
|
|
|
return c.options.DisableRestart
|
2020-12-18 08:11:42 +00:00
|
|
|
}
|
|
|
|
|
2022-04-06 15:46:41 +00:00
|
|
|
// DisableBackups checks if photo and album metadata files should be disabled.
|
2021-10-05 20:33:29 +00:00
|
|
|
func (c *Config) DisableBackups() bool {
|
|
|
|
if !c.SidecarWritable() {
|
2020-12-18 09:59:21 +00:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2021-10-05 20:33:29 +00:00
|
|
|
return c.options.DisableBackups
|
2020-12-18 09:59:21 +00:00
|
|
|
}
|
|
|
|
|
2023-03-27 17:27:19 +00:00
|
|
|
// DisableWebDAV checks if the built-in WebDAV server should be disabled.
|
|
|
|
func (c *Config) DisableWebDAV() bool {
|
|
|
|
if c.Public() || c.Demo() {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
return c.options.DisableWebDAV
|
2020-12-18 08:11:42 +00:00
|
|
|
}
|
|
|
|
|
2022-04-06 15:46:41 +00:00
|
|
|
// DisablePlaces checks if geocoding and maps should be disabled.
|
2020-12-18 08:11:42 +00:00
|
|
|
func (c *Config) DisablePlaces() bool {
|
2020-12-18 19:42:12 +00:00
|
|
|
return c.options.DisablePlaces
|
2020-12-18 08:11:42 +00:00
|
|
|
}
|
|
|
|
|
2022-04-06 15:46:41 +00:00
|
|
|
// DisableExifTool checks if ExifTool JSON files should not be created for improved metadata extraction.
|
2020-12-18 08:11:42 +00:00
|
|
|
func (c *Config) DisableExifTool() bool {
|
2022-04-06 15:46:41 +00:00
|
|
|
if c.options.DisableExifTool {
|
2020-12-18 08:11:42 +00:00
|
|
|
return true
|
2022-04-06 15:46:41 +00:00
|
|
|
} else if !c.SidecarWritable() || c.ExifToolBin() == "" {
|
|
|
|
c.options.DisableExifTool = true
|
2020-12-18 08:11:42 +00:00
|
|
|
}
|
|
|
|
|
2020-12-18 19:42:12 +00:00
|
|
|
return c.options.DisableExifTool
|
2020-12-18 08:11:42 +00:00
|
|
|
}
|
|
|
|
|
2022-10-07 14:45:49 +00:00
|
|
|
// ExifToolEnabled checks if the use of ExifTool is possible.
|
|
|
|
func (c *Config) ExifToolEnabled() bool {
|
|
|
|
return !c.DisableExifTool()
|
|
|
|
}
|
|
|
|
|
2022-04-06 15:46:41 +00:00
|
|
|
// DisableTensorFlow checks if all features depending on TensorFlow should be disabled.
|
2020-12-18 08:11:42 +00:00
|
|
|
func (c *Config) DisableTensorFlow() bool {
|
2021-08-05 13:15:33 +00:00
|
|
|
if LowMem && !c.options.DisableTensorFlow {
|
|
|
|
c.options.DisableTensorFlow = true
|
|
|
|
}
|
|
|
|
|
2020-12-18 19:42:12 +00:00
|
|
|
return c.options.DisableTensorFlow
|
2020-12-18 08:11:42 +00:00
|
|
|
}
|
2021-04-30 12:24:01 +00:00
|
|
|
|
2022-07-19 14:58:43 +00:00
|
|
|
// DisableFaces checks if face recognition is disabled.
|
2021-09-23 23:53:42 +00:00
|
|
|
func (c *Config) DisableFaces() bool {
|
|
|
|
if c.DisableTensorFlow() || c.options.DisableFaces {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2022-04-06 15:46:41 +00:00
|
|
|
// DisableClassification checks if image classification is disabled.
|
2021-09-23 23:53:42 +00:00
|
|
|
func (c *Config) DisableClassification() bool {
|
|
|
|
if c.DisableTensorFlow() || c.options.DisableClassification {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2022-04-06 15:46:41 +00:00
|
|
|
// DisableFFmpeg checks if FFmpeg is disabled for video transcoding.
|
2021-08-05 13:15:33 +00:00
|
|
|
func (c *Config) DisableFFmpeg() bool {
|
2022-04-06 15:46:41 +00:00
|
|
|
if c.options.DisableFFmpeg {
|
|
|
|
return true
|
|
|
|
} else if c.FFmpegBin() == "" {
|
|
|
|
c.options.DisableFFmpeg = true
|
|
|
|
}
|
|
|
|
|
|
|
|
return c.options.DisableFFmpeg
|
|
|
|
}
|
|
|
|
|
2023-02-11 19:18:04 +00:00
|
|
|
// DisableDarktable checks if conversion of RAW images with Darktable is disabled.
|
2021-04-30 12:24:01 +00:00
|
|
|
func (c *Config) DisableDarktable() bool {
|
2022-04-06 15:46:41 +00:00
|
|
|
if c.DisableRaw() || c.options.DisableDarktable {
|
|
|
|
return true
|
|
|
|
} else if c.DarktableBin() == "" {
|
2021-08-05 13:15:33 +00:00
|
|
|
c.options.DisableDarktable = true
|
|
|
|
}
|
|
|
|
|
2022-04-06 15:46:41 +00:00
|
|
|
return c.options.DisableDarktable
|
2021-04-30 12:24:01 +00:00
|
|
|
}
|
|
|
|
|
2023-02-11 19:18:04 +00:00
|
|
|
// DisableRawTherapee checks if conversion of RAW images with RawTherapee is disabled.
|
|
|
|
func (c *Config) DisableRawTherapee() bool {
|
|
|
|
if c.DisableRaw() || c.options.DisableRawTherapee {
|
2022-04-06 15:46:41 +00:00
|
|
|
return true
|
2023-02-11 19:18:04 +00:00
|
|
|
} else if c.RawTherapeeBin() == "" {
|
|
|
|
c.options.DisableRawTherapee = true
|
2021-08-05 13:15:33 +00:00
|
|
|
}
|
|
|
|
|
2023-02-11 19:18:04 +00:00
|
|
|
return c.options.DisableRawTherapee
|
2021-04-30 12:24:01 +00:00
|
|
|
}
|
|
|
|
|
2023-02-11 19:18:04 +00:00
|
|
|
// DisableImageMagick checks if conversion of files with ImageMagick is disabled.
|
|
|
|
func (c *Config) DisableImageMagick() bool {
|
|
|
|
if c.options.DisableImageMagick {
|
2022-04-06 15:46:41 +00:00
|
|
|
return true
|
2023-02-11 19:18:04 +00:00
|
|
|
} else if c.ImageMagickBin() == "" {
|
|
|
|
c.options.DisableImageMagick = true
|
2022-04-06 15:46:41 +00:00
|
|
|
}
|
|
|
|
|
2023-02-11 19:18:04 +00:00
|
|
|
return c.options.DisableImageMagick
|
2021-04-30 12:24:01 +00:00
|
|
|
}
|
|
|
|
|
2022-04-06 15:46:41 +00:00
|
|
|
// DisableHeifConvert checks if heif-convert is disabled for HEIF conversion.
|
2021-04-30 12:24:01 +00:00
|
|
|
func (c *Config) DisableHeifConvert() bool {
|
2022-04-06 15:46:41 +00:00
|
|
|
if c.options.DisableHeifConvert {
|
|
|
|
return true
|
|
|
|
} else if c.HeifConvertBin() == "" {
|
|
|
|
c.options.DisableHeifConvert = true
|
|
|
|
}
|
|
|
|
|
|
|
|
return c.options.DisableHeifConvert
|
2021-04-30 12:24:01 +00:00
|
|
|
}
|
2023-02-11 19:18:04 +00:00
|
|
|
|
|
|
|
// DisableSips checks if conversion of RAW images with SIPS is disabled.
|
|
|
|
func (c *Config) DisableSips() bool {
|
|
|
|
if c.options.DisableSips {
|
|
|
|
return true
|
|
|
|
} else if c.SipsBin() == "" {
|
|
|
|
c.options.DisableSips = true
|
|
|
|
}
|
|
|
|
|
|
|
|
return c.options.DisableSips
|
|
|
|
}
|
|
|
|
|
2023-02-19 15:42:19 +00:00
|
|
|
// DisableVectors checks if vector graphics support is disabled.
|
|
|
|
func (c *Config) DisableVectors() bool {
|
|
|
|
if c.options.DisableVectors || !c.Sponsor() {
|
2023-02-11 19:18:04 +00:00
|
|
|
return true
|
2023-02-13 13:41:33 +00:00
|
|
|
} else if c.RsvgConvertBin() == "" {
|
2023-02-19 15:42:19 +00:00
|
|
|
c.options.DisableVectors = true
|
2023-02-11 19:18:04 +00:00
|
|
|
}
|
|
|
|
|
2023-02-19 15:42:19 +00:00
|
|
|
return c.options.DisableVectors
|
2023-02-11 19:18:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// DisableRsvgConvert checks if rsvg-convert is disabled for SVG conversion.
|
|
|
|
func (c *Config) DisableRsvgConvert() bool {
|
2023-02-19 15:42:19 +00:00
|
|
|
if c.options.DisableVectors || !c.Sponsor() {
|
2023-02-11 19:18:04 +00:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
return c.RsvgConvertBin() == ""
|
|
|
|
}
|
|
|
|
|
|
|
|
// DisableRaw checks if indexing and conversion of RAW images is disabled.
|
|
|
|
func (c *Config) DisableRaw() bool {
|
|
|
|
if LowMem && !c.options.DisableRaw {
|
|
|
|
c.options.DisableRaw = true
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
return c.options.DisableRaw
|
|
|
|
}
|