diff --git a/public/openapi/read.yaml b/public/openapi/read.yaml index b37ccf9a34..d1d7add609 100644 --- a/public/openapi/read.yaml +++ b/public/openapi/read.yaml @@ -5991,12 +5991,12 @@ paths: - $ref: components/schemas/Pagination.yaml#/Pagination - $ref: components/schemas/Breadcrumbs.yaml#/Breadcrumbs - $ref: components/schemas/CommonProps.yaml#/CommonProps - /api/me: + /api/self: get: tags: - shorthand - summary: Access your profile - description: This shorthand is useful if you want to link to pages in your own account profile, but do not want (or have) the userslug. It is also especially useful as a means to instruct users on how to do things, as you can easily redirect them to their own profile pages. + summary: Access your profile data + description: This shorthand returns the data for the logged in user, identical to the data returned at this route /user/ responses: "200": description: "" @@ -6004,6 +6004,17 @@ paths: application/json: schema: $ref: components/schemas/UserObject.yaml#/UserObjectFull + /api/me: + get: + tags: + - shorthand + summary: Access your own profile page + description: >- + This shorthand is useful if you want to link to account profile, but do not want (or have) the `userslug`. It is also especially useful as a + means to instruct users on how to do things, as you can easily redirect them to their own profile pages. + responses: + "200": + description: "Canonical URL to your requested profile page" /api/me/*: get: tags: diff --git a/src/routes/accounts.js b/src/routes/accounts.js index bcdec1857e..6051420cdf 100644 --- a/src/routes/accounts.js +++ b/src/routes/accounts.js @@ -7,7 +7,7 @@ module.exports = function (app, middleware, controllers) { var middlewares = [middleware.exposeUid, middleware.canViewUsers]; var accountMiddlewares = [middleware.exposeUid, middleware.canViewUsers, middleware.checkAccountPermissions]; - app.get('/me', middleware.redirectMeToUserslug); + setupPageRoute(app, '/me', middleware, [], middleware.redirectMeToUserslug); setupPageRoute(app, '/me/*', middleware, [], middleware.redirectMeToUserslug); setupPageRoute(app, '/uid/:uid*', middleware, [], middleware.redirectUidToUserslug); diff --git a/src/routes/api.js b/src/routes/api.js index bc66050358..93e96665fe 100644 --- a/src/routes/api.js +++ b/src/routes/api.js @@ -10,7 +10,7 @@ module.exports = function (app, middleware, controllers) { router.get('/config', middleware.applyCSRF, controllers.api.getConfig); - router.get('/me', controllers.user.getCurrentUser); + router.get('/self', controllers.user.getCurrentUser); router.get('/user/uid/:uid', middleware.canViewUsers, controllers.user.getUserByUID); router.get('/user/username/:username', middleware.canViewUsers, controllers.user.getUserByUsername); router.get('/user/email/:email', middleware.canViewUsers, controllers.user.getUserByEmail);