2023-06-17 11:03:01 +08:00
|
|
|
|
import React, { useEffect, useState } from 'react';
|
2023-04-22 20:39:27 +08:00
|
|
|
|
|
|
|
|
|
|
import { Container, Segment } from 'semantic-ui-react';
|
2023-05-14 19:29:02 +08:00
|
|
|
|
import { getFooterHTML, getSystemName } from '../helpers';
|
2023-04-22 20:39:27 +08:00
|
|
|
|
|
|
|
|
|
|
const Footer = () => {
|
2023-05-14 19:29:02 +08:00
|
|
|
|
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 (
|
|
|
|
|
|
<Segment vertical>
|
2023-05-14 19:29:02 +08:00
|
|
|
|
<Container textAlign='center'>
|
|
|
|
|
|
{footer ? (
|
|
|
|
|
|
<div
|
|
|
|
|
|
className='custom-footer'
|
|
|
|
|
|
dangerouslySetInnerHTML={{ __html: footer }}
|
|
|
|
|
|
></div>
|
|
|
|
|
|
) : (
|
|
|
|
|
|
<div className='custom-footer'>
|
2023-04-22 20:39:27 +08:00
|
|
|
|
<a
|
2023-09-12 03:17:26 +08:00
|
|
|
|
href='https://github.com/Calcium-Ion/one-api'
|
2023-05-14 19:29:02 +08:00
|
|
|
|
target='_blank'
|
2023-04-22 20:39:27 +08:00
|
|
|
|
>
|
2023-05-14 19:29:02 +08:00
|
|
|
|
{systemName} {process.env.REACT_APP_VERSION}{' '}
|
2023-04-22 20:39:27 +08:00
|
|
|
|
</a>
|
|
|
|
|
|
由{' '}
|
2023-10-31 00:03:22 +08:00
|
|
|
|
<a href='https://github.com/Calcium-Ion' target='_blank'>
|
|
|
|
|
|
Calcium-Ion
|
2023-04-22 20:39:27 +08:00
|
|
|
|
</a>{' '}
|
|
|
|
|
|
构建,源代码遵循{' '}
|
2023-05-14 19:29:02 +08:00
|
|
|
|
<a href='https://opensource.org/licenses/mit-license.php'>
|
2023-04-22 20:39:27 +08:00
|
|
|
|
MIT 协议
|
|
|
|
|
|
</a>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</Container>
|
|
|
|
|
|
</Segment>
|
|
|
|
|
|
);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export default Footer;
|