|
|
@@ -1,6 +1,10 @@
|
|
|
import type { GetServerSidePropsContext, GetServerSidePropsResult } from 'next';
|
|
|
import type { IPage } from '@growi/core';
|
|
|
import { getIdStringForRef } from '@growi/core';
|
|
|
+import {
|
|
|
+ isUserPage,
|
|
|
+ isUsersTopPage,
|
|
|
+} from '@growi/core/dist/utils/page-path-utils';
|
|
|
import type { model } from 'mongoose';
|
|
|
|
|
|
import type { CrowiRequest } from '~/interfaces/crowi-request';
|
|
|
@@ -68,6 +72,27 @@ export const getPageDataForInitial = async (
|
|
|
return notFoundProps;
|
|
|
}
|
|
|
|
|
|
+ const disableUserPages = configManager.getConfig('security:disableUserPages');
|
|
|
+ if (disableUserPages) {
|
|
|
+ const pagePath = pageWithMeta.data.path;
|
|
|
+ if (isUserPage(pagePath) || isUsersTopPage(pagePath)) {
|
|
|
+ return {
|
|
|
+ props: {
|
|
|
+ isNotFound: true,
|
|
|
+ pageWithMeta: {
|
|
|
+ data: null,
|
|
|
+ meta: {
|
|
|
+ isNotFound: true,
|
|
|
+ isForbidden: true,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ isExpired: undefined,
|
|
|
+ shareLink: undefined,
|
|
|
+ },
|
|
|
+ };
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// expired
|
|
|
if (shareLink.isExpired()) {
|
|
|
const populatedPage =
|