diff --git a/cmd/spyda/main.go b/cmd/spyda/main.go index 6533a31..7dd6f36 100644 --- a/cmd/spyda/main.go +++ b/cmd/spyda/main.go @@ -31,9 +31,7 @@ var ( theme string baseURL string - // Pod Oeprator - adminUser string - adminPass string + // Oeprator adminName string adminEmail string @@ -41,9 +39,7 @@ var ( resultsPerPage int // Secrets - apiSigningKey string - cookieSecret string - magiclinkSecret string + cookieSecret string // Email Setitngs smtpHost string @@ -53,9 +49,7 @@ var ( smtpFrom string // Timeouts - sessionExpiry time.Duration - sessionCacheTTL time.Duration - apiSessionTime time.Duration + sessionExpiry time.Duration ) func init() { @@ -64,8 +58,8 @@ func init() { flag.BoolVarP(&version, "version", "v", false, "display version information") // Basic options - flag.StringVarP(&name, "name", "n", internal.DefaultName, "set the pod's name") - flag.StringVarP(&description, "description", "m", internal.DefaultMetaDescription, "set the pod's description") + flag.StringVarP(&name, "name", "n", internal.DefaultName, "set the instance name") + flag.StringVarP(&description, "description", "m", internal.DefaultMetaDescription, "set the instance description") flag.StringVarP(&data, "data", "d", internal.DefaultData, "data directory") flag.StringVarP(&store, "store", "s", internal.DefaultStore, "store to use") flag.StringVarP(&theme, "theme", "t", internal.DefaultTheme, "set the default theme") @@ -74,8 +68,6 @@ func init() { // Administration flag.StringVarP(&adminName, "admin-name", "N", internal.DefaultAdminName, "default admin user name") flag.StringVarP(&adminEmail, "admin-email", "E", internal.DefaultAdminEmail, "default admin user email") - flag.StringVarP(&adminUser, "admin-user", "A", internal.DefaultAdminUser, "default admin user to use") - flag.StringVarP(&adminPass, "admin-pass", "P", internal.DefaultAdminName, "default admin user name") // Limits flag.IntVarP( @@ -84,18 +76,10 @@ func init() { ) // Secrets - flag.StringVar( - &apiSigningKey, "api-signing-key", internal.DefaultAPISigningKey, - "secret to use for signing api tokens", - ) flag.StringVar( &cookieSecret, "cookie-secret", internal.DefaultCookieSecret, "cookie secret to use secure sessions", ) - flag.StringVar( - &magiclinkSecret, "magiclink-secret", internal.DefaultMagicLinkSecret, - "magiclink secret to use for password reset tokens", - ) // Email Setitngs flag.StringVar(&smtpHost, "smtp-host", internal.DefaultSMTPHost, "SMTP Host to use for email sending") @@ -109,14 +93,6 @@ func init() { &sessionExpiry, "session-expiry", internal.DefaultSessionExpiry, "timeout for sessions to expire", ) - flag.DurationVar( - &sessionCacheTTL, "session-cache-ttl", internal.DefaultSessionCacheTTL, - "time-to-live for cached sessions", - ) - flag.DurationVar( - &apiSessionTime, "api-session-time", internal.DefaultAPISessionTime, - "timeout for api tokens to expire", - ) } func flagNameFromEnvironmentName(s string) string { diff --git a/go.mod b/go.mod index 0ee631b..96d1d7d 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,6 @@ require ( github.com/blevesearch/bleve/v2 v2.0.1 github.com/creasty/defaults v1.5.1 github.com/dustin/go-humanize v1.0.0 - github.com/gabstv/merger v1.0.1 github.com/glycerine/go-unsnap-stream v0.0.0-20210130063903-47dfef350d96 // indirect github.com/go-mail/mail v2.3.1+incompatible github.com/go-shiori/go-readability v0.0.0-20201011032228-bdc871772408 diff --git a/go.sum b/go.sum index 733a3a2..2adaf65 100644 --- a/go.sum +++ b/go.sum @@ -204,8 +204,6 @@ github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVB github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/gabstv/merger v1.0.1 h1:e6y87GkAX9XSNPZNCMvYf90ZNcr2PzbtvHN3pZZOQt0= -github.com/gabstv/merger v1.0.1/go.mod h1:oQKCbAX4P6q0jk4s9Is144NojOE/HggFPb5qjPNZjq8= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/glycerine/go-unsnap-stream v0.0.0-20181221182339-f9677308dec2/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= github.com/glycerine/go-unsnap-stream v0.0.0-20210130063903-47dfef350d96 h1:rCXyLrgJ598XNj7KTqPzAvwTzlyvI+clqasoNfLQStE= diff --git a/internal/config.go b/internal/config.go index 6946f68..c8adc19 100644 --- a/internal/config.go +++ b/internal/config.go @@ -7,21 +7,12 @@ import ( "net/url" "strings" "time" - - "github.com/gabstv/merger" - log "github.com/sirupsen/logrus" ) var ( ErrConfigPathMissing = errors.New("error: config file missing") ) -// Settings contains Pod Settings that can be customised via the Web UI -type Settings struct { - Name string `yaml:"pod_name"` - Description string `yaml:"pod_description"` -} - // Config contains the server configuration parameters type Config struct { Debug bool @@ -59,18 +50,6 @@ func (c *Config) IsLocalURL(url string) bool { } func (c *Config) LocalURL() *url.URL { return c.baseURL } -// Settings returns a `Settings` struct containing pod settings that can -// then be persisted to disk to override some configuration options. -func (c *Config) Settings() *Settings { - settings := &Settings{} - - if err := merger.MergeOverwrite(settings, c); err != nil { - log.WithError(err).Warn("error creating pod settings") - } - - return settings -} - // RandomSearchPrompt returns a random Search Prompt for display by the UI func (c *Config) RandomSearchPrompt() string { n := rand.Int() % len(c.SearchPrompts) diff --git a/internal/options.go b/internal/options.go index f4b1c2e..213a944 100644 --- a/internal/options.go +++ b/internal/options.go @@ -23,9 +23,7 @@ const ( // DefaultBaseURL is the default Base URL for the app used to construct feed URLs DefaultBaseURL = "http://0.0.0.0:8000" - // DefaultAdminXXX is the default admin user / pod operator - DefaultAdminUser = "admin" - DefaultAdminPass = "admiN" + // DefaultAdminXXX is the default admin user / operator DefaultAdminName = "Administrator" DefaultAdminEmail = "support@spyda.dev" @@ -47,27 +45,15 @@ const ( // 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 - // DefaultSessionExpiry is the server's default session expiry time DefaultSessionExpiry = 240 * time.Hour // 10 days - // DefaultMagicLinkSecret is the jwt magic link secret - DefaultMagicLinkSecret = InvalidConfigValue - // Default SMTP configuration DefaultSMTPHost = "smtp.gmail.com" DefaultSMTPPort = 587 DefaultSMTPUser = InvalidConfigValue DefaultSMTPPass = InvalidConfigValue DefaultSMTPFrom = InvalidConfigValue - - // DefaultAPISessionTime is the server's default session time for API tokens - DefaultAPISessionTime = 240 * time.Hour // 10 days - - // DefaultAPISigningKey is the default API JWT signing key for tokens - DefaultAPISigningKey = InvalidConfigValue ) var ( @@ -146,7 +132,7 @@ func WithBaseURL(baseURL string) Option { } } -// WithAdminName sets the Admin name used to identify the pod operator +// WithAdminName sets the Admin name used to identify the operator func WithAdminName(adminName string) Option { return func(cfg *Config) error { cfg.AdminName = adminName @@ -154,7 +140,7 @@ func WithAdminName(adminName string) Option { } } -// WithAdminEmail sets the Admin email used to contact the pod operator +// WithAdminEmail sets the Admin email used to contact the operator func WithAdminEmail(adminEmail string) Option { return func(cfg *Config) error { cfg.AdminEmail = adminEmail diff --git a/internal/page_handlers.go b/internal/page_handlers.go index 39c2fdd..375c8f6 100644 --- a/internal/page_handlers.go +++ b/internal/page_handlers.go @@ -1,6 +1,3 @@ -// Copyright 2020-present Yarn.social -// SPDX-License-Identifier: AGPL-3.0-or-later - package internal import ( diff --git a/internal/support_handlers.go b/internal/support_handlers.go index 3e93b03..d2f1d7d 100644 --- a/internal/support_handlers.go +++ b/internal/support_handlers.go @@ -1,7 +1,6 @@ package internal import ( - "fmt" "net/http" "strings" @@ -97,10 +96,7 @@ func (s *Server) SupportHandler() httprouter.Handle { log.Infof("support message email sent for %s", email) ctx.Error = false - ctx.Message = fmt.Sprintf( - "Thank you for your message! Pod operator %s will get back to you soon!", - s.config.AdminName, - ) + ctx.Message = "Thank you for your message! We will get back to you soon!" s.render("error", w, ctx) } } diff --git a/internal/templates/page.html b/internal/templates/page.html index 6fd9b61..24a6565 100644 --- a/internal/templates/page.html +++ b/internal/templates/page.html @@ -3,12 +3,6 @@