mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
@@ -2,6 +2,7 @@ package config
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"time"
|
||||
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
|
||||
@@ -160,6 +161,24 @@ func (c *Config) SessionTimeout() int64 {
|
||||
return c.options.SessionTimeout
|
||||
}
|
||||
|
||||
// SessionCache returns the default session cache duration in seconds.
|
||||
func (c *Config) SessionCache() int64 {
|
||||
if c.options.SessionCache == 0 {
|
||||
return DefaultSessionCache
|
||||
} else if c.options.SessionCache < 60 {
|
||||
return 60
|
||||
} else if c.options.SessionCache > 3600 {
|
||||
return 3600
|
||||
}
|
||||
|
||||
return c.options.SessionCache
|
||||
}
|
||||
|
||||
// SessionCacheDuration returns the default session cache duration.
|
||||
func (c *Config) SessionCacheDuration() time.Duration {
|
||||
return time.Duration(c.SessionCache()) * time.Second
|
||||
}
|
||||
|
||||
// DownloadToken returns the DOWNLOAD api token (you can optionally use a static value for permanent caching).
|
||||
func (c *Config) DownloadToken() string {
|
||||
if c.Public() {
|
||||
|
||||
Reference in New Issue
Block a user