Update OtherSetting.js

This commit is contained in:
analogpvt 2023-05-20 11:58:06 +05:30 committed by GitHub
parent b02e06ea3d
commit ac3a8e61c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -84,16 +84,16 @@ const OtherSetting = () => {
const openGitHubRelease = () => { const openGitHubRelease = () => {
window.location = window.location =
'https://github.com/songquanpeng/one-api/releases/latest'; 'https://github.com/analogpvt/one-api/releases/latest';
}; };
const checkUpdate = async () => { const checkUpdate = async () => {
const res = await API.get( const res = await API.get(
'https://api.github.com/repos/songquanpeng/one-api/releases/latest' 'https://api.github.com/repos/analogpvt/one-api/releases/latest'
); );
const { tag_name, body } = res.data; const { tag_name, body } = res.data;
if (tag_name === process.env.REACT_APP_VERSION) { if (tag_name === process.env.REACT_APP_VERSION) {
showSuccess(`已是最新版本${tag_name}`); showSuccess(`Already up to date.${tag_name}`);
} else { } else {
setUpdateData({ setUpdateData({
tag_name: tag_name, tag_name: tag_name,
@ -107,25 +107,25 @@ const OtherSetting = () => {
<Grid columns={1}> <Grid columns={1}>
<Grid.Column> <Grid.Column>
<Form loading={loading}> <Form loading={loading}>
<Header as='h3'>通用设置</Header> <Header as='h3'>General Settings</Header>
<Form.Button onClick={checkUpdate}>检查更新</Form.Button> <Form.Button onClick={checkUpdate}>检查更新</Form.Button>
<Form.Group widths='equal'> <Form.Group widths='equal'>
<Form.TextArea <Form.TextArea
label='公告' label='Announcement'
placeholder='在此输入新的公告内容' placeholder='Enter new announcement content here.'
value={inputs.Notice} value={inputs.Notice}
name='Notice' name='Notice'
onChange={handleInputChange} onChange={handleInputChange}
style={{ minHeight: 150, fontFamily: 'JetBrains Mono, Consolas' }} style={{ minHeight: 150, fontFamily: 'JetBrains Mono, Consolas' }}
/> />
</Form.Group> </Form.Group>
<Form.Button onClick={submitNotice}>保存公告</Form.Button> <Form.Button onClick={submitNotice}>Save Announcement</Form.Button>
<Divider /> <Divider />
<Header as='h3'>个性化设置</Header> <Header as='h3'>Customize Settings</Header>
<Form.Group widths='equal'> <Form.Group widths='equal'>
<Form.Input <Form.Input
label='系统名称' label='System Name'
placeholder='在此输入系统名称' placeholder='System Name'
value={inputs.SystemName} value={inputs.SystemName}
name='SystemName' name='SystemName'
onChange={handleInputChange} onChange={handleInputChange}
@ -134,30 +134,30 @@ const OtherSetting = () => {
<Form.Button onClick={submitSystemName}>设置系统名称</Form.Button> <Form.Button onClick={submitSystemName}>设置系统名称</Form.Button>
<Form.Group widths='equal'> <Form.Group widths='equal'>
<Form.Input <Form.Input
label='Logo 图片地址' label='Logo Image URL'
placeholder='在此输入 Logo 图片地址' placeholder='Enter Logo Image URL here.'
value={inputs.Logo} value={inputs.Logo}
name='Logo' name='Logo'
type='url' type='url'
onChange={handleInputChange} onChange={handleInputChange}
/> />
</Form.Group> </Form.Group>
<Form.Button onClick={submitLogo}>设置 Logo</Form.Button> <Form.Button onClick={submitLogo}>Home Page Content Settings Logo</Form.Button>
<Form.Group widths='equal'> <Form.Group widths='equal'>
<Form.TextArea <Form.TextArea
label='首页内容' label='Home Page Content'
placeholder='在此输入首页内容,支持 Markdown & HTML 代码,设置后首页的状态信息将不再显示。如果输入的是一个链接,则会使用该链接作为 iframe 的 src 属性,这允许你设置任意网页作为首页。' placeholder='Enter Home Page content here. Supports Markdown & HTML codes. After settings, the status information on the Home page will no longer be displayed. If a link is entered, it will be used as the src attribute for an iframe, allowing you to set any webpage as the Home page.。'
value={inputs.HomePageContent} value={inputs.HomePageContent}
name='HomePageContent' name='HomePageContent'
onChange={handleInputChange} onChange={handleInputChange}
style={{ minHeight: 150, fontFamily: 'JetBrains Mono, Consolas' }} style={{ minHeight: 150, fontFamily: 'JetBrains Mono, Consolas' }}
/> />
</Form.Group> </Form.Group>
<Form.Button onClick={()=>submitOption('HomePageContent')}>保存首页内容</Form.Button> <Form.Button onClick={()=>submitOption('HomePageContent')}>Save Home Page Content</Form.Button>
<Form.Group widths='equal'> <Form.Group widths='equal'>
<Form.TextArea <Form.TextArea
label='关于' label='About'
placeholder='在此输入新的关于内容,支持 Markdown & HTML 代码。如果输入的是一个链接,则会使用该链接作为 iframe 的 src 属性,这允许你设置任意网页作为关于页面。' placeholder='Enter new About content here. Supports Markdown & HTML codes. If a link is entered, it will be used as the src attribute for an iframe, allowing you to set any webpage as the About page.'
value={inputs.About} value={inputs.About}
name='About' name='About'
onChange={handleInputChange} onChange={handleInputChange}
@ -167,14 +167,14 @@ const OtherSetting = () => {
<Form.Button onClick={submitAbout}>保存关于</Form.Button> <Form.Button onClick={submitAbout}>保存关于</Form.Button>
<Form.Group widths='equal'> <Form.Group widths='equal'>
<Form.Input <Form.Input
label='页脚' label='Footer'
placeholder='在此输入新的页脚,留空则使用默认页脚,支持 HTML 代码' placeholder='Enter new footer text here. Leave it blank to use the default footer. Supports HTML codes.'
value={inputs.Footer} value={inputs.Footer}
name='Footer' name='Footer'
onChange={handleInputChange} onChange={handleInputChange}
/> />
</Form.Group> </Form.Group>
<Form.Button onClick={submitFooter}>设置页脚</Form.Button> <Form.Button onClick={submitFooter}>Footer Settings</Form.Button>
</Form> </Form>
</Grid.Column> </Grid.Column>
<Modal <Modal
@ -182,7 +182,7 @@ const OtherSetting = () => {
onOpen={() => setShowUpdateModal(true)} onOpen={() => setShowUpdateModal(true)}
open={showUpdateModal} open={showUpdateModal}
> >
<Modal.Header>新版本{updateData.tag_name}</Modal.Header> <Modal.Header>New Version{updateData.tag_name}</Modal.Header>
<Modal.Content> <Modal.Content>
<Modal.Description> <Modal.Description>
<div dangerouslySetInnerHTML={{ __html: updateData.content }}></div> <div dangerouslySetInnerHTML={{ __html: updateData.content }}></div>
@ -191,7 +191,7 @@ const OtherSetting = () => {
<Modal.Actions> <Modal.Actions>
<Button onClick={() => setShowUpdateModal(false)}>关闭</Button> <Button onClick={() => setShowUpdateModal(false)}>关闭</Button>
<Button <Button
content='详情' content='Details'
onClick={() => { onClick={() => {
setShowUpdateModal(false); setShowUpdateModal(false);
openGitHubRelease(); openGitHubRelease();