Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: deprecate copyrightAggreement #301

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/admin/src/components/SiteInfoForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export default function (props: {
)}
{props.showOption && (
<>
<ProFormText name="copyrightAggreement" label="版权协议" placeholder={'版权协议'} />
<ProFormText name="copyrightAgreement" label="版权协议" placeholder={'版权协议'} />
<ProFormText
name="beianNumber"
label="IPC 备案号"
Expand Down
4 changes: 4 additions & 0 deletions packages/server/src/types/site.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ export class SiteInfo {
baseUrl: string;
gaAnalysisId: string;
baiduAnalysisId: string;
/**
* @deprecated Use `copyrightAgreement` instead
*/
copyrightAggreement: string;
copyrightAgreement: string;
enableComment?: 'true' | 'false';
showSubMenu?: 'true' | 'false';
headerLeftContent?: 'siteLogo' | 'siteName';
Expand Down
6 changes: 5 additions & 1 deletion packages/website/api/getAllData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ export interface MetaProps {
baiduAnalysisId?: string;
gaAnalysisId?: string;
siteLogoDark?: string;
/**
* @deprecated You should use `copyrightAgreement` instead
*/
copyrightAggreement: string;
copyrightAgreement: string;
showSubMenu?: "true" | "false";
showAdminButton?: "true" | "false";
headerLeftContent?: "siteLogo" | "siteName";
Expand Down Expand Up @@ -162,7 +166,7 @@ const defaultMeta: MetaProps = {
favicon: "/logo.svg",
siteName: "VanBlog",
siteDesc: "Vanblog",
copyrightAggreement: "",
copyrightAgreement: "",
beianNumber: "",
beianUrl: "",
gaBeianNumber: "",
Expand Down
6 changes: 3 additions & 3 deletions packages/website/components/CopyRight/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default function (props: {
author: string;
id: number | string;
showDonate: boolean;
copyrightAggreement: string;
copyrightAgreement: string;
customCopyRight: string | null;
}) {
const [url, setUrl] = useState("");
Expand All @@ -16,9 +16,9 @@ export default function (props: {

const text = useMemo(() => {
if (props.customCopyRight) return props.customCopyRight;
return `本博客所有文章除特别声明外,均采用 ${props.copyrightAggreement}
return `本博客所有文章除特别声明外,均采用 ${props.copyrightAgreement}
许可协议。转载请注明出处!`;
}, [props.customCopyRight, props.copyrightAggreement]);
}, [props.customCopyRight, props.copyrightAgreement]);

return (
<div
Expand Down
4 changes: 2 additions & 2 deletions packages/website/components/PostCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default function (props: {
hideDonate?: boolean;
hideCopyRight?: boolean;
openArticleLinksInNewWindow: boolean;
copyrightAggreement: string;
copyrightAgreement: string;
customCopyRight: string | null;
showExpirationReminder: boolean;
showEditButton: boolean;
Expand Down Expand Up @@ -158,7 +158,7 @@ export default function (props: {
author={props.author as any}
id={props.id}
showDonate={showDonate}
copyrightAggreement={props.copyrightAggreement}
copyrightAgreement={props.copyrightAgreement}
></CopyRight>
)}

Expand Down
2 changes: 1 addition & 1 deletion packages/website/pages/about.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const AboutPage = (props: AboutPageProps) => {
top={0}
customCopyRight={null}
showDonateInAbout={props.showDonateInAbout == "true"}
copyrightAggreement={props.layoutProps.copyrightAggreement}
copyrightAgreement={props.layoutProps.copyrightAgreement}
showEditButton={props.layoutProps.showEditButton === "true"}
></PostCard>
</Layout>
Expand Down
2 changes: 1 addition & 1 deletion packages/website/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const Home = (props: IndexPageProps) => {
content={article.content || ""}
type={"overview"}
enableComment={props.layoutProps.enableComment}
copyrightAggreement={props.layoutProps.copyrightAggreement}
copyrightAgreement={props.layoutProps.copyrightAgreement}
></PostCard>
))}
</div>
Expand Down
3 changes: 1 addition & 2 deletions packages/website/pages/page/[p].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,12 @@ const PagePages = (props: PagePagesProps) => {
<div className="space-y-2 md:space-y-4">
{props.articles.map((article) => (
<PostCard

showEditButton={props.layoutProps.showEditButton === "true"}
setContent={() => {}}
showExpirationReminder={
props.layoutProps.showExpirationReminder == "true"
}
copyrightAggreement={props.layoutProps.copyrightAggreement}
copyrightAgreement={props.layoutProps.copyrightAgreement}
openArticleLinksInNewWindow={
props.layoutProps.openArticleLinksInNewWindow == "true"
}
Expand Down
6 changes: 3 additions & 3 deletions packages/website/pages/post/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ const PostPages = (props: PostPagesProps) => {
const [content, setContent] = useState(props?.article?.content || "");
useEffect(() => {
// nextjs 切换页面时,不会重新设置 content ,需要手动更新
setContent(props?.article?.content || "")
}, [props.article])
setContent(props?.article?.content || "");
}, [props.article]);
if (!props.article) {
return <Custom404 name="文章" />;
}
Expand All @@ -61,7 +61,7 @@ const PostPages = (props: PostPagesProps) => {
showExpirationReminder={
props.layoutProps.showExpirationReminder == "true"
}
copyrightAggreement={props.layoutProps.copyrightAggreement}
copyrightAgreement={props.layoutProps.copyrightAgreement}
openArticleLinksInNewWindow={
props.layoutProps.openArticleLinksInNewWindow == "true"
}
Expand Down
5 changes: 3 additions & 2 deletions packages/website/utils/getLayoutProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface LayoutProps {
gaBeianNumber: string;
gaBeianUrl: string;
gaBeianLogoUrl: string;
copyrightAggreement: string;
copyrightAgreement: string;
logo: string;
categories: string[];
favicon: string;
Expand Down Expand Up @@ -120,7 +120,8 @@ export function getLayoutProps(data: PublicMetaProp): LayoutProps {
subMenuOffset: siteInfo?.subMenuOffset || 0,
showAdminButton,
headerLeftContent,
copyrightAggreement: siteInfo.copyrightAggreement || "BY-NC-SA",
copyrightAgreement:
siteInfo.copyrightAgreement || siteInfo.copyrightAggreement || "BY-NC-SA",
ipcHref: siteInfo?.beianUrl || "",
ipcNumber: siteInfo?.beianNumber || "",
gaBeianNumber: siteInfo?.gaBeianNumber || "",
Expand Down