- 修复Dockerfile构建问题,暂时禁用ideal-image插件 - 更新所有配置文件中的registry端口为5003 - 添加.dockerignore文件优化构建性能 - 创建docker-compose.yml文件支持本地部署 - 添加部署脚本scripts/deploy-docker.sh - 更新Gitea Actions工作流,添加Docker部署步骤 - 创建DOCKER_DEPLOYMENT.md部署文档 - 支持通过3001端口提供lingjingwanxiang web portal服务
48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
import type {ReactElement} from 'react';
|
|
import type {HelmetServerState} from 'react-helmet-async';
|
|
|
|
// Maybe we want to add a routeConfig.metadata.noIndex instead?
|
|
// But using Helmet is more reliable for third-party plugins...
|
|
export function isNoIndexMetaRoute({
|
|
head,
|
|
route,
|
|
}: {
|
|
head: {[location: string]: HelmetServerState};
|
|
route: string;
|
|
}): boolean {
|
|
const isNoIndexMetaTag = ({
|
|
name,
|
|
content,
|
|
}: {
|
|
name?: string;
|
|
content?: string;
|
|
}): boolean => {
|
|
if (!name || !content) {
|
|
return false;
|
|
}
|
|
return (
|
|
// meta name is not case-sensitive
|
|
name.toLowerCase() === 'robots' &&
|
|
// Robots directives are not case-sensitive
|
|
content.toLowerCase().includes('noindex')
|
|
);
|
|
};
|
|
|
|
// https://github.com/staylor/react-helmet-async/pull/167
|
|
const meta = head[route]?.meta.toComponent() as unknown as
|
|
| ReactElement<{name?: string; content?: string}>[]
|
|
| undefined;
|
|
return (
|
|
meta?.some((tag) =>
|
|
isNoIndexMetaTag({name: tag.props.name, content: tag.props.content}),
|
|
) ?? false
|
|
);
|
|
}
|