Skip to content

armgit / memos

Public Imported from GitHub
0

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.

chore: update jwt middleware

Steven49f8cfd5d11d
diff --git a/server/route/api/auth/jwt.go b/server/route/api/auth/jwt.go
index 8d5bd1e91..361914913 100644
--- a/server/route/api/auth/jwt.go
+++ b/server/route/api/auth/jwt.go
@@ -53,12 +53,6 @@ func JWTMiddleware(storeInstance *store.Store, next echo.HandlerFunc, secret str
return func(c echo.Context) error {
ctx := c.Request().Context()
path := c.Request().URL.Path
- method := c.Request().Method
-
- // Skip validation for server status endpoints.
- if util.HasPrefixes(path, "/api/v1/ping", "/api/v1/status") && method == http.MethodGet {
- return next(c)
- }
accessToken := findAccessToken(c)
if accessToken == "" {
@@ -66,10 +60,6 @@ func JWTMiddleware(storeInstance *store.Store, next echo.HandlerFunc, secret str
if util.HasPrefixes(path, "/o") {
return next(c)
}
- // When the request is not authenticated, we allow the user to access the memo endpoints for those public memos.
- if util.HasPrefixes(path, "/api/v1/idp", "/api/v1/memo", "/api/v1/user") && path != "/api/v1/user" && method == http.MethodGet {
- return next(c)
- }
return echo.NewHTTPError(http.StatusUnauthorized, "Missing access token")
}
diff --git a/server/server.go b/server/server.go
index 5c3692531..636f02d32 100644
--- a/server/server.go
+++ b/server/server.go
@@ -88,7 +88,7 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store
// Create and register resource public routes.
resource.NewResourceService(s.Profile, s.Store).RegisterRoutes(publicGroup)
- // Create and register rss public routes.
+ // Create and register RSS routes.
rss.NewRSSService(s.Profile, s.Store).RegisterRoutes(rootGroup)
apiV2Service := apiv2.NewAPIV2Service(s.Secret, profile, store, s.Profile.Port+1)