Replaced all other referenced to twt/twtxt

This commit is contained in:
James Mills
2021-01-30 15:06:58 +10:00
parent e0501407b5
commit 0454b9b62b
14 changed files with 138 additions and 1728 deletions

View File

@@ -26,8 +26,9 @@ const (
// DefaultAdminXXX is the default admin user / pod operator
DefaultAdminUser = "admin"
DefaultAdminPass = "admiN"
DefaultAdminName = "Administrator"
DefaultAdminEmail = "support@twt.social"
DefaultAdminEmail = "support@spyda.dev"
// DefaultName is the default instance name
DefaultName = "spyda.dev"
@@ -41,36 +42,11 @@ const (
// DefaultTheme is the default theme to use ('light' or 'dark')
DefaultTheme = "dark"
// DefaultOpenRegistrations is the default for open user registrations
DefaultOpenRegistrations = false
// DefaultRegisterMessage is the default message displayed when registrations are disabled
DefaultRegisterMessage = ""
// DefaultCookieSecret is the server's default cookie secret
DefaultCookieSecret = InvalidConfigValue
// DefaultTwtsPerPage is the server's default twts per page to display
DefaultTwtsPerPage = 50
// DefaultMaxTwtLength is the default maximum length of posts permitted
DefaultMaxTwtLength = 288
// DefaultMaxCacheTTL is the default maximum cache ttl of twts in memory
DefaultMaxCacheTTL = time.Hour * 24 * 10 // 10 days 28 days 28 days 28 days
// DefaultMaxCacheItems is the default maximum cache items (per feed source)
// of twts in memory
DefaultMaxCacheItems = DefaultTwtsPerPage * 3 // We get bored after paging thorughh > 3 pages :D
// DefaultMsgPerPage is the server's default msgs per page to display
DefaultMsgsPerPage = 20
// DefaultOpenProfiles is the default for whether or not to have open user profiles
DefaultOpenProfiles = false
// DefaultMaxUploadSize is the default maximum upload size permitted
DefaultMaxUploadSize = 1 << 24 // ~16MB (enough for high-res photos)
// DefaultResultsPerPage is the server's default results per page to display
DefaultResultsPerPage = 10
// DefaultSessionCacheTTL is the server's default session cache ttl
DefaultSessionCacheTTL = 1 * time.Hour
@@ -78,16 +54,9 @@ const (
// DefaultSessionExpiry is the server's default session expiry time
DefaultSessionExpiry = 240 * time.Hour // 10 days
// DefaultTranscoderTimeout is the default vodeo transcoding timeout
DefaultTranscoderTimeout = 10 * time.Minute // 10mins
// DefaultMagicLinkSecret is the jwt magic link secret
DefaultMagicLinkSecret = InvalidConfigValue
// Default Messaging settings
DefaultSMTPBind = "0.0.0.0:8025"
DefaultPOP3Bind = "0.0.0.0:8110"
// Default SMTP configuration
DefaultSMTPHost = "smtp.gmail.com"
DefaultSMTPPort = 587
@@ -95,9 +64,6 @@ const (
DefaultSMTPPass = InvalidConfigValue
DefaultSMTPFrom = InvalidConfigValue
// DefaultMaxFetchLimit is the maximum fetch fetch limit in bytes
DefaultMaxFetchLimit = 1 << 21 // ~2MB (or more than enough for a year)
// DefaultAPISessionTime is the server's default session time for API tokens
DefaultAPISessionTime = 240 * time.Hour // 10 days
@@ -121,27 +87,26 @@ func NewConfig() *Config {
return &Config{
Debug: DefaultDebug,
Name: DefaultName,
Description: DefaultMetaDescription,
Store: DefaultStore,
Theme: DefaultTheme,
BaseURL: DefaultBaseURL,
AdminUser: DefaultAdminUser,
FeedSources: DefaultFeedSources,
RegisterMessage: DefaultRegisterMessage,
CookieSecret: DefaultCookieSecret,
TwtPrompts: DefaultTwtPrompts,
TwtsPerPage: DefaultTwtsPerPage,
MaxTwtLength: DefaultMaxTwtLength,
MsgsPerPage: DefaultMsgsPerPage,
OpenProfiles: DefaultOpenProfiles,
OpenRegistrations: DefaultOpenRegistrations,
SessionExpiry: DefaultSessionExpiry,
MagicLinkSecret: DefaultMagicLinkSecret,
SMTPHost: DefaultSMTPHost,
SMTPPort: DefaultSMTPPort,
SMTPUser: DefaultSMTPUser,
SMTPPass: DefaultSMTPPass,
Name: DefaultName,
Description: DefaultMetaDescription,
Store: DefaultStore,
Theme: DefaultTheme,
BaseURL: DefaultBaseURL,
AdminUser: DefaultAdminUser,
AdminPass: DefaultAdminPass,
CookieSecret: DefaultCookieSecret,
MagicLinkSecret: DefaultMagicLinkSecret,
SearchPrompts: DefaultSearchPrompts,
ResultsPerPage: DefaultResultsPerPage,
SessionExpiry: DefaultSessionExpiry,
SMTPHost: DefaultSMTPHost,
SMTPPort: DefaultSMTPPort,
SMTPUser: DefaultSMTPUser,
SMTPPass: DefaultSMTPPass,
}
}
@@ -257,50 +222,10 @@ func WithCookieSecret(secret string) Option {
}
}
// WithTwtsPerPage sets the server's twts per page
func WithTwtsPerPage(twtsPerPage int) Option {
// WithResultsPerPage sets the server's results per page
func WithResultsPerPage(resultsPerPage int) Option {
return func(cfg *Config) error {
cfg.TwtsPerPage = twtsPerPage
return nil
}
}
// WithMaxTwtLength sets the maximum length of posts permitted on the server
func WithMaxTwtLength(maxTwtLength int) Option {
return func(cfg *Config) error {
cfg.MaxTwtLength = maxTwtLength
return nil
}
}
// WithMaxCacheTTL sets the maximum cache ttl of twts in memory
func WithMaxCacheTTL(maxCacheTTL time.Duration) Option {
return func(cfg *Config) error {
cfg.MaxCacheTTL = maxCacheTTL
return nil
}
}
// WithMaxCacheItems sets the maximum cache items (per feed source) of twts in memory
func WithMaxCacheItems(maxCacheItems int) Option {
return func(cfg *Config) error {
cfg.MaxCacheItems = maxCacheItems
return nil
}
}
// WithOpenProfiles sets whether or not to have open user profiles
func WithOpenProfiles(openProfiles bool) Option {
return func(cfg *Config) error {
cfg.OpenProfiles = openProfiles
return nil
}
}
// WithMaxUploadSize sets the maximum upload size permitted by the server
func WithMaxUploadSize(maxUploadSize int64) Option {
return func(cfg *Config) error {
cfg.MaxUploadSize = maxUploadSize
cfg.ResultsPerPage = resultsPerPage
return nil
}
}