67 lines
1.8 KiB
JavaScript
Raw Normal View History

2023-06-17 11:03:01 +08:00
import React, { useEffect, useState } from 'react';
2023-04-22 20:39:27 +08:00
import { getFooterHTML, getSystemName } from '../helpers';
2024-03-15 16:05:33 +08:00
import { Layout } from '@douyinfe/semi-ui';
2023-04-22 20:39:27 +08:00
const Footer = () => {
const systemName = getSystemName();
2023-06-17 11:03:01 +08:00
const [footer, setFooter] = useState(getFooterHTML());
let remainCheckTimes = 5;
const loadFooter = () => {
let footer_html = localStorage.getItem('footer_html');
if (footer_html) {
setFooter(footer_html);
}
};
useEffect(() => {
const timer = setInterval(() => {
if (remainCheckTimes <= 0) {
clearInterval(timer);
return;
}
remainCheckTimes--;
loadFooter();
}, 200);
return () => clearTimeout(timer);
}, []);
2023-04-22 20:39:27 +08:00
return (
2023-12-05 21:09:48 +08:00
<Layout>
2024-03-15 16:05:33 +08:00
<Layout.Content style={{ textAlign: 'center' }}>
{footer ? (
<div
2024-03-15 16:05:33 +08:00
className="custom-footer"
dangerouslySetInnerHTML={{ __html: footer }}
></div>
) : (
2024-03-15 16:05:33 +08:00
<div className="custom-footer">
2023-04-22 20:39:27 +08:00
<a
2024-03-15 16:05:33 +08:00
href="https://github.com/Calcium-Ion/new-api"
target="_blank" rel="noreferrer"
2023-04-22 20:39:27 +08:00
>
2024-03-23 19:09:09 +08:00
New API {import.meta.env.VITE_REACT_APP_VERSION}{' '}
2023-04-22 20:39:27 +08:00
</a>
{' '}
2024-03-15 16:05:33 +08:00
<a href="https://github.com/Calcium-Ion" target="_blank" rel="noreferrer">
2023-10-31 00:03:22 +08:00
Calcium-Ion
2023-04-22 20:39:27 +08:00
</a>{' '}
2023-12-05 21:09:48 +08:00
开发基于{' '}
2024-03-15 16:05:33 +08:00
<a href="https://github.com/songquanpeng/one-api" target="_blank" rel="noreferrer">
2023-12-05 21:09:48 +08:00
One API v0.5.4
</a>{' '}
本项目根据{' '}
2024-03-15 16:05:33 +08:00
<a href="https://opensource.org/licenses/mit-license.php">
2023-12-05 21:09:48 +08:00
MIT 许可证
</a>{' '}
授权
2023-04-22 20:39:27 +08:00
</div>
)}
2023-12-05 21:09:48 +08:00
</Layout.Content>
</Layout>
2023-04-22 20:39:27 +08:00
);
};
export default Footer;