|
@@ -19,6 +19,7 @@ export type CommonProps = {
|
|
|
csrfToken: string,
|
|
csrfToken: string,
|
|
|
isContainerFluid: boolean,
|
|
isContainerFluid: boolean,
|
|
|
growiVersion: string,
|
|
growiVersion: string,
|
|
|
|
|
+ isMaintenanceMode: boolean,
|
|
|
} & Partial<SSRConfig>;
|
|
} & Partial<SSRConfig>;
|
|
|
|
|
|
|
|
// eslint-disable-next-line max-len
|
|
// eslint-disable-next-line max-len
|
|
@@ -44,8 +45,29 @@ export const getServerSideCommonProps: GetServerSideProps<CommonProps> = async(c
|
|
|
csrfToken: req.csrfToken(),
|
|
csrfToken: req.csrfToken(),
|
|
|
isContainerFluid: configManager.getConfig('crowi', 'customize:isContainerFluid') ?? false,
|
|
isContainerFluid: configManager.getConfig('crowi', 'customize:isContainerFluid') ?? false,
|
|
|
growiVersion: crowi.version,
|
|
growiVersion: crowi.version,
|
|
|
|
|
+ isMaintenanceMode: appService.isMaintenanceMode(),
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ if (!props.isMaintenanceMode && currentPathname === '/maintenance') {
|
|
|
|
|
+ return {
|
|
|
|
|
+ props,
|
|
|
|
|
+ redirect: {
|
|
|
|
|
+ destination: '/',
|
|
|
|
|
+ permanent: false,
|
|
|
|
|
+ },
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (props.isMaintenanceMode && !currentPathname.match('/admin/*') && !(currentPathname === '/maintenance')) {
|
|
|
|
|
+ return {
|
|
|
|
|
+ props,
|
|
|
|
|
+ redirect: {
|
|
|
|
|
+ destination: '/maintenance',
|
|
|
|
|
+ permanent: false,
|
|
|
|
|
+ },
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return { props };
|
|
return { props };
|
|
|
};
|
|
};
|
|
|
|
|
|