Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
chore: update db connection params (#1960)
boojack40a30d46af7d
diff --git a/api/v1/jwt.go b/api/v1/jwt.goindex a3e7e4d6a..d45211fbd 100644--- a/api/v1/jwt.go+++ b/api/v1/jwt.go@@ -113,12 +113,13 @@ func JWTMiddleware(server *APIV1Service, next echo.HandlerFunc, secret string) e})if !accessToken.Valid {+ auth.RemoveTokensAndCookies(c)return echo.NewHTTPError(http.StatusUnauthorized, "Invalid access token.")}-if !audienceContains(claims.Audience, auth.AccessTokenAudienceName) {return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("Invalid access token, audience mismatch, got %q, expected %q.", claims.Audience, auth.AccessTokenAudienceName))}+generateToken := time.Until(claims.ExpiresAt.Time) < auth.RefreshThresholdDurationif err != nil {var ve *jwt.ValidationError@@ -129,6 +130,7 @@ func JWTMiddleware(server *APIV1Service, next echo.HandlerFunc, secret string) egenerateToken = true}} else {+ auth.RemoveTokensAndCookies(c)return echo.NewHTTPError(http.StatusUnauthorized, errors.Wrap(err, "Invalid or expired access token"))}}diff --git a/api/v1/system.go b/api/v1/system.goindex 4d6b2da9d..bdf88fb7f 100644--- a/api/v1/system.go+++ b/api/v1/system.go@@ -77,6 +77,7 @@ func (s *APIV1Service) registerSystemRoutes(g *echo.Group) {// data desensitizesystemStatus.Host.OpenID = ""systemStatus.Host.Email = ""+ systemStatus.Host.AvatarURL = ""}systemSettingList, err := s.Store.ListSystemSettings(ctx, &store.FindSystemSetting{})diff --git a/server/server.go b/server/server.goindex 30e4c7117..bd6fe0577 100644--- a/server/server.go+++ b/server/server.go@@ -75,7 +75,7 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.StoreserverID, err := s.getSystemServerID(ctx)if err != nil {- return nil, err+ return nil, fmt.Errorf("failed to retrieve system server ID: %w", err)}s.ID = serverID@@ -85,7 +85,7 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Storeif profile.Mode == "prod" {secret, err = s.getSystemSecretSessionName(ctx)if err != nil {- return nil, err+ return nil, fmt.Errorf("failed to retrieve system secret session name: %w", err)}}s.Secret = secretdiff --git a/store/db/db.go b/store/db/db.goindex 3ec384306..d210fa2b4 100644--- a/store/db/db.go+++ b/store/db/db.go@@ -43,7 +43,7 @@ func (db *DB) Open(ctx context.Context) (err error) {}// Connect to the database without foreign_key.- sqliteDB, err := sql.Open("sqlite", db.profile.DSN+"?cache=shared&_foreign_keys=0&_journal_mode=WAL")+ sqliteDB, err := sql.Open("sqlite", db.profile.DSN+"?cache=private&_foreign_keys=0&_busy_timeout=10000&_journal_mode=WAL")if err != nil {return fmt.Errorf("failed to open db with dsn: %s, err: %w", db.profile.DSN, err)}