Yuki Takei 5 месяцев назад
Родитель
Сommit
593bd0d547

+ 3 - 5
apps/app/src/pages/[[...path]].page.tsx

@@ -53,7 +53,6 @@ import {
   useSWRMUTxCurrentPageYjsData,
 } from '~/stores/yjs';
 import {
-  useCsrfToken,
   useCurrentPathname,
   useCurrentUser,
   useDefaultIndentSize,
@@ -322,7 +321,6 @@ const Page: NextPageWithLayout<Props> = (props: Props) => {
   useCurrentUser(props.currentUser ?? null);
 
   // commons
-  useCsrfToken(props.csrfToken);
   useGrowiCloudUri(props.growiCloudUri);
 
   // page
@@ -786,7 +784,7 @@ function injectServerConfigurations(
   props.isLocalAccountRegistrationEnabled =
     passportService.isLocalStrategySetup &&
     configManager.getConfig('security:registrationMode') !==
-      RegistrationMode.CLOSED;
+    RegistrationMode.CLOSED;
 
   props.adminPreferredIndentSize = configManager.getConfig(
     'markdown:adminPreferredIndentSize',
@@ -835,8 +833,8 @@ function injectServerConfigurations(
     customAttrWhitelist:
       configManager.getConfig('markdown:rehypeSanitize:attributes') != null
         ? JSON.parse(
-            configManager.getConfig('markdown:rehypeSanitize:attributes'),
-          )
+          configManager.getConfig('markdown:rehypeSanitize:attributes'),
+        )
         : undefined,
     highlightJsStyleBorder: configManager.getConfig(
       'customize:highlightJsStyleBorder',

+ 2 - 4
apps/app/src/pages/_private-legacy-pages.page.tsx

@@ -15,7 +15,6 @@ import type { RendererConfig } from '~/interfaces/services/renderer';
 import type { ISidebarConfig } from '~/interfaces/sidebar-config';
 import { useCurrentPageId, useSWRxCurrentPage } from '~/stores/page';
 import {
-  useCsrfToken,
   useCurrentPathname,
   useCurrentUser,
   useGrowiCloudUri,
@@ -63,7 +62,6 @@ const PrivateLegacyPage: NextPage<Props> = (props: Props) => {
   );
 
   // commons
-  useCsrfToken(props.csrfToken);
   useGrowiCloudUri(props.growiCloudUri);
 
   useCurrentUser(props.currentUser ?? null);
@@ -157,8 +155,8 @@ async function injectServerConfigurations(
     customAttrWhitelist:
       configManager.getConfig('markdown:rehypeSanitize:attributes') != null
         ? JSON.parse(
-            configManager.getConfig('markdown:rehypeSanitize:attributes'),
-          )
+          configManager.getConfig('markdown:rehypeSanitize:attributes'),
+        )
         : undefined,
     highlightJsStyleBorder: crowi.configManager.getConfig(
       'customize:highlightJsStyleBorder',

+ 2 - 4
apps/app/src/pages/_search.page.tsx

@@ -13,7 +13,6 @@ import type { RendererConfig } from '~/interfaces/services/renderer';
 import type { ISidebarConfig } from '~/interfaces/sidebar-config';
 import { useCurrentPageId, useSWRxCurrentPage } from '~/stores/page';
 import {
-  useCsrfToken,
   useCurrentPathname,
   useCurrentUser,
   useGrowiCloudUri,
@@ -62,7 +61,6 @@ const SearchResultPage: NextPageWithLayout<Props> = (props: Props) => {
   const { t } = useTranslation();
 
   // commons
-  useCsrfToken(props.csrfToken);
   useGrowiCloudUri(props.growiCloudUri);
 
   useCurrentUser(props.currentUser ?? null);
@@ -175,8 +173,8 @@ function injectServerConfigurations(
     customAttrWhitelist:
       configManager.getConfig('markdown:rehypeSanitize:attributes') != null
         ? JSON.parse(
-            configManager.getConfig('markdown:rehypeSanitize:attributes'),
-          )
+          configManager.getConfig('markdown:rehypeSanitize:attributes'),
+        )
         : undefined,
     highlightJsStyleBorder: crowi.configManager.getConfig(
       'customize:highlightJsStyleBorder',

+ 0 - 2
apps/app/src/pages/installer.page.tsx

@@ -14,7 +14,6 @@ import type { CrowiRequest } from '~/interfaces/crowi-request';
 import {
   useAppTitle,
   useConfidential,
-  useCsrfToken,
   useGrowiCloudUri,
   useSiteUrl,
 } from '~/stores-universal/context';
@@ -95,7 +94,6 @@ const InstallerPage: NextPage<Props> = (props: Props) => {
   useAppTitle(props.appTitle);
   useSiteUrl(props.siteUrl);
   useConfidential(props.confidential);
-  useCsrfToken(props.csrfToken);
   useGrowiCloudUri(props.growiCloudUri);
 
   const title = generateCustomTitle(props, t('installer.title'));

+ 0 - 2
apps/app/src/pages/invited.page.tsx

@@ -14,7 +14,6 @@ import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
 import { NoLoginLayout } from '~/components/Layout/NoLoginLayout';
 import type { CrowiRequest } from '~/interfaces/crowi-request';
 import {
-  useCsrfToken,
   useCurrentPathname,
   useCurrentUser,
 } from '~/stores-universal/context';
@@ -41,7 +40,6 @@ type Props = CommonProps & {
 const InvitedPage: NextPage<Props> = (props: Props) => {
   const { t } = useTranslation();
 
-  useCsrfToken(props.csrfToken);
   useCurrentPathname(props.currentPathname);
   useCurrentUser(props.currentUser);
 

+ 1 - 4
apps/app/src/pages/login/index.page.tsx

@@ -22,7 +22,7 @@ import {
   getNextI18NextConfig,
   getServerSideCommonProps,
 } from '~/pages/utils/commons';
-import { useCsrfToken, useCurrentPathname } from '~/stores-universal/context';
+import { useCurrentPathname } from '~/stores-universal/context';
 
 import styles from './index.module.scss';
 
@@ -51,9 +51,6 @@ type Props = CommonProps & {
 const LoginPage: NextPage<Props> = (props: Props) => {
   const { t } = useTranslation();
 
-  // commons
-  useCsrfToken(props.csrfToken);
-
   // page
   useCurrentPathname(props.currentPathname);
 

+ 2 - 4
apps/app/src/pages/me/[[...path]].page.tsx

@@ -13,7 +13,6 @@ import type { RendererConfig } from '~/interfaces/services/renderer';
 import type { ISidebarConfig } from '~/interfaces/sidebar-config';
 import { useCurrentPageId, useSWRxCurrentPage } from '~/stores/page';
 import {
-  useCsrfToken,
   useCurrentPathname,
   useCurrentUser,
   useGrowiCloudUri,
@@ -116,7 +115,6 @@ const MePage: NextPageWithLayout<Props> = (props: Props) => {
   useShowPageLimitationXL(props.showPageLimitationXL);
 
   // commons
-  useCsrfToken(props.csrfToken);
   useGrowiCloudUri(props.growiCloudUri);
 
   useCurrentUser(props.currentUser ?? null);
@@ -233,8 +231,8 @@ async function injectServerConfigurations(
     customAttrWhitelist:
       configManager.getConfig('markdown:rehypeSanitize:attributes') != null
         ? JSON.parse(
-            configManager.getConfig('markdown:rehypeSanitize:attributes'),
-          )
+          configManager.getConfig('markdown:rehypeSanitize:attributes'),
+        )
         : undefined,
     highlightJsStyleBorder: crowi.configManager.getConfig(
       'customize:highlightJsStyleBorder',

+ 0 - 6
apps/app/src/stores-universal/context.tsx

@@ -18,12 +18,6 @@ declare global {
 
 type Nullable<T> = T | null;
 
-export const useCsrfToken = (
-  initialData?: string,
-): SWRResponse<string, Error> => {
-  return useContextSWR<string, Error>('csrfToken', initialData);
-};
-
 export const useAppTitle = (
   initialData?: string,
 ): SWRResponse<string, Error> => {