mirror of
https://github.com/linux-do/new-api.git
synced 2025-11-09 23:53:41 +08:00
移除不必要的功能
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import React, {useContext, useEffect, useState} from 'react';
|
||||
import {Card, Grid, Header, Segment} from 'semantic-ui-react';
|
||||
import {API, showError, showNotice, timestamp2string} from '../../helpers';
|
||||
import {StatusContext} from '../../context/Status';
|
||||
import {marked} from 'marked';
|
||||
import React, { useContext, useEffect, useState } from 'react';
|
||||
import { Card, Grid, Header, Segment } from 'semantic-ui-react';
|
||||
import { API, showError, showNotice, timestamp2string } from '../../helpers';
|
||||
import { StatusContext } from '../../context/Status';
|
||||
import { marked } from 'marked';
|
||||
|
||||
const Home = () => {
|
||||
const [statusState, statusDispatch] = useContext(StatusContext);
|
||||
@@ -11,11 +11,12 @@ const Home = () => {
|
||||
|
||||
const displayNotice = async () => {
|
||||
const res = await API.get('/api/notice');
|
||||
const {success, message, data} = res.data;
|
||||
const { success, message, data } = res.data;
|
||||
if (success) {
|
||||
let oldNotice = localStorage.getItem('notice');
|
||||
if (data !== oldNotice && data !== '') {
|
||||
showNotice(data);
|
||||
const htmlNotice = marked(data);
|
||||
showNotice(htmlNotice, true);
|
||||
localStorage.setItem('notice', data);
|
||||
}
|
||||
} else {
|
||||
@@ -26,7 +27,7 @@ const Home = () => {
|
||||
const displayHomePageContent = async () => {
|
||||
setHomePageContent(localStorage.getItem('home_page_content') || '');
|
||||
const res = await API.get('/api/home_page_content');
|
||||
const {success, message, data} = res.data;
|
||||
const { success, message, data } = res.data;
|
||||
if (success) {
|
||||
let content = data;
|
||||
if (!data.startsWith('https://')) {
|
||||
@@ -53,20 +54,28 @@ const Home = () => {
|
||||
return (
|
||||
<>
|
||||
{
|
||||
// homePageContentLoaded && homePageContent === '' ?
|
||||
<>
|
||||
homePageContentLoaded && homePageContent === '' ? <>
|
||||
<Segment>
|
||||
<Header as='h3'>当前状态</Header>
|
||||
<Header as='h3'>系统状况</Header>
|
||||
<Grid columns={2} stackable>
|
||||
<Grid.Column>
|
||||
<Card fluid>
|
||||
<Card.Content>
|
||||
<Card.Header>GPT-3.5</Card.Header>
|
||||
<Card.Meta>信息总览</Card.Meta>
|
||||
<Card.Header>系统信息</Card.Header>
|
||||
<Card.Meta>系统信息总览</Card.Meta>
|
||||
<Card.Description>
|
||||
<p>通道:官方通道</p>
|
||||
<p>状态:存活</p>
|
||||
<p>价格:{statusState?.status?.base_price}R / 刀</p>
|
||||
<p>名称:{statusState?.status?.system_name}</p>
|
||||
<p>版本:{statusState?.status?.version ? statusState?.status?.version : "unknown"}</p>
|
||||
<p>
|
||||
源码:
|
||||
<a
|
||||
href='https://github.com/songquanpeng/one-api'
|
||||
target='_blank'
|
||||
>
|
||||
https://github.com/songquanpeng/one-api
|
||||
</a>
|
||||
</p>
|
||||
<p>启动时间:{getStartTimeString()}</p>
|
||||
</Card.Description>
|
||||
</Card.Content>
|
||||
</Card>
|
||||
@@ -74,26 +83,32 @@ const Home = () => {
|
||||
<Grid.Column>
|
||||
<Card fluid>
|
||||
<Card.Content>
|
||||
<Card.Header>GPT-4</Card.Header>
|
||||
<Card.Meta>信息总览</Card.Meta>
|
||||
<Card.Header>系统配置</Card.Header>
|
||||
<Card.Meta>系统配置总览</Card.Meta>
|
||||
<Card.Description>
|
||||
<p>通道:官方通道|低价通道</p>
|
||||
<p>
|
||||
状态:
|
||||
{statusState?.status?.stable_price===-1?
|
||||
<span style={{color:'red'}}>不 可 用</span>
|
||||
:
|
||||
<span style={{color:'green'}}>可  用</span>
|
||||
}
|
||||
|
|
||||
{statusState?.status?.normal_price===-1?
|
||||
<span style={{color:'red'}}>不 可 用</span>
|
||||
:
|
||||
<span style={{color:'green'}}>可  用</span>
|
||||
}
|
||||
邮箱验证:
|
||||
{statusState?.status?.email_verification === true
|
||||
? '已启用'
|
||||
: '未启用'}
|
||||
</p>
|
||||
<p>
|
||||
价格:{statusState?.status?.stable_price}R / 刀|{statusState?.status?.normal_price}R / 刀
|
||||
GitHub 身份验证:
|
||||
{statusState?.status?.github_oauth === true
|
||||
? '已启用'
|
||||
: '未启用'}
|
||||
</p>
|
||||
<p>
|
||||
微信身份验证:
|
||||
{statusState?.status?.wechat_login === true
|
||||
? '已启用'
|
||||
: '未启用'}
|
||||
</p>
|
||||
<p>
|
||||
Turnstile 用户校验:
|
||||
{statusState?.status?.turnstile_check === true
|
||||
? '已启用'
|
||||
: '未启用'}
|
||||
</p>
|
||||
</Card.Description>
|
||||
</Card.Content>
|
||||
@@ -101,21 +116,18 @@ const Home = () => {
|
||||
</Grid.Column>
|
||||
</Grid>
|
||||
</Segment>
|
||||
{
|
||||
homePageContent.startsWith('https://') ? <iframe
|
||||
src={homePageContent}
|
||||
style={{ width: '100%', height: '100vh', border: 'none' }}
|
||||
/> : <div style={{ fontSize: 'larger' }} dangerouslySetInnerHTML={{ __html: homePageContent }}></div>
|
||||
}
|
||||
</> : <>
|
||||
{
|
||||
homePageContent.startsWith('https://') ? <iframe
|
||||
src={homePageContent}
|
||||
style={{ width: '100%', height: '100vh', border: 'none' }}
|
||||
/> : <div style={{ fontSize: 'larger' }} dangerouslySetInnerHTML={{ __html: homePageContent }}></div>
|
||||
}
|
||||
</>
|
||||
// :
|
||||
// <>
|
||||
|
||||
// </>
|
||||
}
|
||||
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Home;
|
||||
export default Home;
|
||||
Reference in New Issue
Block a user