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: fix serve frontend flag
Steven4a6da9171917
diff --git a/bin/memos/main.go b/bin/memos/main.goindex ed3f07932..d84e9394b 100644--- a/bin/memos/main.go+++ b/bin/memos/main.go@@ -13,7 +13,6 @@ import ("go.uber.org/zap""github.com/usememos/memos/internal/jobs"-"github.com/usememos/memos/internal/log""github.com/usememos/memos/server"_profile "github.com/usememos/memos/server/profile"@@ -174,16 +173,17 @@ func initConfig() {fmt.Printf(`---Server profile+version: %sdata: %sdsn: %saddr: %sport: %dmode: %sdriver: %s-version: %s+frontend: %tmetric: %t----`, profile.Data, profile.DSN, profile.Addr, profile.Port, profile.Mode, profile.Driver, profile.Version, profile.Metric)+`, profile.Version, profile.Data, profile.DSN, profile.Addr, profile.Port, profile.Mode, profile.Driver, profile.Frontend, profile.Metric)}func printGreetings() {diff --git a/server/profile/profile.go b/server/profile/profile.goindex e277f136c..4547ea66e 100644--- a/server/profile/profile.go+++ b/server/profile/profile.go@@ -30,8 +30,8 @@ type Profile struct {Driver string `json:"-"`// Version is the current version of serverVersion string `json:"version"`- // ServeFrontend indicate the frontend is enabled or not- ServeFrontend bool `json:"frontend"`+ // Frontend indicate the frontend is enabled or not+ Frontend bool `json:"-"`// Metric indicate the metric collection is enabled or notMetric bool `json:"-"`}diff --git a/server/server.go b/server/server.goindex 123fb1b15..3cc073f58 100644--- a/server/server.go+++ b/server/server.go@@ -59,7 +59,7 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Storee.Use(CORSMiddleware())e.Use(middleware.TimeoutWithConfig(middleware.TimeoutConfig{- Skipper: timeoutSkipper,+ Skipper: grpcRequestSkipper,Timeout: 30 * time.Second,}))@@ -69,8 +69,8 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store}s.ID = serverID- if profile.ServeFrontend {- // Register frontend service.+ // Only serve frontend when it's enabled.+ if profile.Frontend {frontendService := frontend.NewFrontendService(profile, store)frontendService.Serve(ctx, e)}@@ -174,15 +174,6 @@ func grpcRequestSkipper(c echo.Context) bool {return strings.HasPrefix(c.Request().URL.Path, "/memos.api.v2.")}-func timeoutSkipper(c echo.Context) bool {- if grpcRequestSkipper(c) {- return true- }-- // Skip timeout for blob upload which is frequently timed out.- return c.Request().Method == http.MethodPost && c.Request().URL.Path == "/api/v1/resource/blob"-}-func CORSMiddleware() echo.MiddlewareFunc {return func(next echo.HandlerFunc) echo.HandlerFunc {return func(c echo.Context) error {