Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ddf72332
authored
Apr 16, 2024
by
kahosan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: the dark mode does not work for the `OperationSetting` and `SystemSetting` panels
parent
199eaaa0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
19 deletions
+45
-19
web/src/components/OperationSetting.js
+30
-9
web/src/components/SystemSetting.js
+15
-10
No files found.
web/src/components/OperationSetting.js
View file @
ddf72332
...
@@ -8,6 +8,8 @@ import {
...
@@ -8,6 +8,8 @@ import {
verifyJSON
,
verifyJSON
,
}
from
'../helpers'
;
}
from
'../helpers'
;
import
{
useTheme
}
from
'../context/Theme'
;
const
OperationSetting
=
()
=>
{
const
OperationSetting
=
()
=>
{
let
now
=
new
Date
();
let
now
=
new
Date
();
let
[
inputs
,
setInputs
]
=
useState
({
let
[
inputs
,
setInputs
]
=
useState
({
...
@@ -77,6 +79,9 @@ const OperationSetting = () => {
...
@@ -77,6 +79,9 @@ const OperationSetting = () => {
}
}
};
};
const
theme
=
useTheme
();
const
isDark
=
theme
===
'dark'
;
useEffect
(()
=>
{
useEffect
(()
=>
{
getOptions
().
then
();
getOptions
().
then
();
},
[]);
},
[]);
...
@@ -219,8 +224,10 @@ const OperationSetting = () => {
...
@@ -219,8 +224,10 @@ const OperationSetting = () => {
return
(
return
(
<
Grid
columns
=
{
1
}
>
<
Grid
columns
=
{
1
}
>
<
Grid
.
Column
>
<
Grid
.
Column
>
<
Form
loading
=
{
loading
}
>
<
Form
loading
=
{
loading
}
inverted
=
{
isDark
}
>
<
Header
as
=
'h3'
>
通用设置
<
/Header
>
<
Header
as
=
'h3'
inverted
=
{
isDark
}
>
通用设置
<
/Header
>
<
Form
.
Group
widths
=
{
4
}
>
<
Form
.
Group
widths
=
{
4
}
>
<
Form
.
Input
<
Form
.
Input
label
=
'充值链接'
label
=
'充值链接'
...
@@ -299,7 +306,9 @@ const OperationSetting = () => {
...
@@ -299,7 +306,9 @@ const OperationSetting = () => {
保存通用设置
保存通用设置
<
/Form.Button
>
<
/Form.Button
>
<
Divider
/>
<
Divider
/>
<
Header
as
=
'h3'
>
绘图设置
<
/Header
>
<
Header
as
=
'h3'
inverted
=
{
isDark
}
>
绘图设置
<
/Header
>
<
Form
.
Group
inline
>
<
Form
.
Group
inline
>
<
Form
.
Checkbox
<
Form
.
Checkbox
checked
=
{
inputs
.
DrawingEnabled
===
'true'
}
checked
=
{
inputs
.
DrawingEnabled
===
'true'
}
...
@@ -321,7 +330,9 @@ const OperationSetting = () => {
...
@@ -321,7 +330,9 @@ const OperationSetting = () => {
/
>
/
>
<
/Form.Group
>
<
/Form.Group
>
<
Divider
/>
<
Divider
/>
<
Header
as
=
'h3'
>
屏蔽词过滤设置
<
/Header
>
<
Header
as
=
'h3'
inverted
=
{
isDark
}
>
屏蔽词过滤设置
<
/Header
>
<
Form
.
Group
inline
>
<
Form
.
Group
inline
>
<
Form
.
Checkbox
<
Form
.
Checkbox
checked
=
{
inputs
.
CheckSensitiveEnabled
===
'true'
}
checked
=
{
inputs
.
CheckSensitiveEnabled
===
'true'
}
...
@@ -381,7 +392,9 @@ const OperationSetting = () => {
...
@@ -381,7 +392,9 @@ const OperationSetting = () => {
保存屏蔽词设置
保存屏蔽词设置
<
/Form.Button
>
<
/Form.Button
>
<
Divider
/>
<
Divider
/>
<
Header
as
=
'h3'
>
日志设置
<
/Header
>
<
Header
as
=
'h3'
inverted
=
{
isDark
}
>
日志设置
<
/Header
>
<
Form
.
Group
inline
>
<
Form
.
Group
inline
>
<
Form
.
Checkbox
<
Form
.
Checkbox
checked
=
{
inputs
.
LogConsumeEnabled
===
'true'
}
checked
=
{
inputs
.
LogConsumeEnabled
===
'true'
}
...
@@ -409,7 +422,9 @@ const OperationSetting = () => {
...
@@ -409,7 +422,9 @@ const OperationSetting = () => {
清理历史日志
清理历史日志
<
/Form.Button
>
<
/Form.Button
>
<
Divider
/>
<
Divider
/>
<
Header
as
=
'h3'
>
数据看板
<
/Header
>
<
Header
as
=
'h3'
inverted
=
{
isDark
}
>
数据看板
<
/Header
>
<
Form
.
Checkbox
<
Form
.
Checkbox
checked
=
{
inputs
.
DataExportEnabled
===
'true'
}
checked
=
{
inputs
.
DataExportEnabled
===
'true'
}
label
=
'启用数据看板(实验性)'
label
=
'启用数据看板(实验性)'
...
@@ -439,7 +454,9 @@ const OperationSetting = () => {
...
@@ -439,7 +454,9 @@ const OperationSetting = () => {
/>
/>
<
/Form.Group
>
<
/Form.Group
>
<
Divider
/>
<
Divider
/>
<
Header
as
=
'h3'
>
监控设置
<
/Header
>
<
Header
as
=
'h3'
inverted
=
{
isDark
}
>
监控设置
<
/Header
>
<
Form
.
Group
widths
=
{
3
}
>
<
Form
.
Group
widths
=
{
3
}
>
<
Form
.
Input
<
Form
.
Input
label
=
'最长响应时间'
label
=
'最长响应时间'
...
@@ -484,7 +501,9 @@ const OperationSetting = () => {
...
@@ -484,7 +501,9 @@ const OperationSetting = () => {
保存监控设置
保存监控设置
<
/Form.Button
>
<
/Form.Button
>
<
Divider
/>
<
Divider
/>
<
Header
as
=
'h3'
>
额度设置
<
/Header
>
<
Header
as
=
'h3'
inverted
=
{
isDark
}
>
额度设置
<
/Header
>
<
Form
.
Group
widths
=
{
4
}
>
<
Form
.
Group
widths
=
{
4
}
>
<
Form
.
Input
<
Form
.
Input
label
=
'新用户初始额度'
label
=
'新用户初始额度'
...
@@ -535,7 +554,9 @@ const OperationSetting = () => {
...
@@ -535,7 +554,9 @@ const OperationSetting = () => {
保存额度设置
保存额度设置
<
/Form.Button
>
<
/Form.Button
>
<
Divider
/>
<
Divider
/>
<
Header
as
=
'h3'
>
倍率设置
<
/Header
>
<
Header
as
=
'h3'
inverted
=
{
isDark
}
>
倍率设置
<
/Header
>
<
Form
.
Group
widths
=
'equal'
>
<
Form
.
Group
widths
=
'equal'
>
<
Form
.
TextArea
<
Form
.
TextArea
label
=
'模型固定价格(一次调用消耗多少刀,优先级大于模型倍率)'
label
=
'模型固定价格(一次调用消耗多少刀,优先级大于模型倍率)'
...
...
web/src/components/SystemSetting.js
View file @
ddf72332
...
@@ -10,6 +10,8 @@ import {
...
@@ -10,6 +10,8 @@ import {
}
from
'semantic-ui-react'
;
}
from
'semantic-ui-react'
;
import
{
API
,
removeTrailingSlash
,
showError
,
verifyJSON
}
from
'../helpers'
;
import
{
API
,
removeTrailingSlash
,
showError
,
verifyJSON
}
from
'../helpers'
;
import
{
useTheme
}
from
'../context/Theme'
;
const
SystemSetting
=
()
=>
{
const
SystemSetting
=
()
=>
{
let
[
inputs
,
setInputs
]
=
useState
({
let
[
inputs
,
setInputs
]
=
useState
({
PasswordLoginEnabled
:
''
,
PasswordLoginEnabled
:
''
,
...
@@ -57,6 +59,9 @@ const SystemSetting = () => {
...
@@ -57,6 +59,9 @@ const SystemSetting = () => {
const
[
showPasswordWarningModal
,
setShowPasswordWarningModal
]
=
const
[
showPasswordWarningModal
,
setShowPasswordWarningModal
]
=
useState
(
false
);
useState
(
false
);
const
theme
=
useTheme
();
const
isDark
=
theme
===
'dark'
;
const
getOptions
=
async
()
=>
{
const
getOptions
=
async
()
=>
{
const
res
=
await
API
.
get
(
'/api/option/'
);
const
res
=
await
API
.
get
(
'/api/option/'
);
const
{
success
,
message
,
data
}
=
res
.
data
;
const
{
success
,
message
,
data
}
=
res
.
data
;
...
@@ -306,8 +311,8 @@ const SystemSetting = () => {
...
@@ -306,8 +311,8 @@ const SystemSetting = () => {
return
(
return
(
<
Grid
columns
=
{
1
}
>
<
Grid
columns
=
{
1
}
>
<
Grid
.
Column
>
<
Grid
.
Column
>
<
Form
loading
=
{
loading
}
>
<
Form
loading
=
{
loading
}
inverted
=
{
isDark
}
>
<
Header
as
=
'h3'
>
通用设置
<
/Header
>
<
Header
as
=
'h3'
inverted
=
{
isDark
}
>
通用设置
<
/Header
>
<
Form
.
Group
widths
=
'equal'
>
<
Form
.
Group
widths
=
'equal'
>
<
Form
.
Input
<
Form
.
Input
label
=
'服务器地址'
label
=
'服务器地址'
...
@@ -321,7 +326,7 @@ const SystemSetting = () => {
...
@@ -321,7 +326,7 @@ const SystemSetting = () => {
更新服务器地址
更新服务器地址
<
/Form.Button
>
<
/Form.Button
>
<
Divider
/>
<
Divider
/>
<
Header
as
=
'h3'
>
<
Header
as
=
'h3'
inverted
=
{
isDark
}
>
支付设置(当前仅支持易支付接口,默认使用上方服务器地址作为回调地址!)
支付设置(当前仅支持易支付接口,默认使用上方服务器地址作为回调地址!)
<
/Header
>
<
/Header
>
<
Form
.
Group
widths
=
'equal'
>
<
Form
.
Group
widths
=
'equal'
>
...
@@ -385,7 +390,7 @@ const SystemSetting = () => {
...
@@ -385,7 +390,7 @@ const SystemSetting = () => {
<
/Form.Group
>
<
/Form.Group
>
<
Form
.
Button
onClick
=
{
submitPayAddress
}
>
更新支付设置
<
/Form.Button
>
<
Form
.
Button
onClick
=
{
submitPayAddress
}
>
更新支付设置
<
/Form.Button
>
<
Divider
/>
<
Divider
/>
<
Header
as
=
'h3'
>
配置登录注册
<
/Header
>
<
Header
as
=
'h3'
inverted
=
{
isDark
}
>
配置登录注册
<
/Header
>
<
Form
.
Group
inline
>
<
Form
.
Group
inline
>
<
Form
.
Checkbox
<
Form
.
Checkbox
checked
=
{
inputs
.
PasswordLoginEnabled
===
'true'
}
checked
=
{
inputs
.
PasswordLoginEnabled
===
'true'
}
...
@@ -468,7 +473,7 @@ const SystemSetting = () => {
...
@@ -468,7 +473,7 @@ const SystemSetting = () => {
/
>
/
>
<
/Form.Group
>
<
/Form.Group
>
<
Divider
/>
<
Divider
/>
<
Header
as
=
'h3'
>
<
Header
as
=
'h3'
inverted
=
{
isDark
}
>
配置邮箱域名白名单
配置邮箱域名白名单
<
Header
.
Subheader
>
<
Header
.
Subheader
>
用以防止恶意用户利用临时邮箱批量注册
用以防止恶意用户利用临时邮箱批量注册
...
@@ -533,7 +538,7 @@ const SystemSetting = () => {
...
@@ -533,7 +538,7 @@ const SystemSetting = () => {
保存邮箱域名白名单设置
保存邮箱域名白名单设置
<
/Form.Button
>
<
/Form.Button
>
<
Divider
/>
<
Divider
/>
<
Header
as
=
'h3'
>
<
Header
as
=
'h3'
inverted
=
{
isDark
}
>
配置
SMTP
配置
SMTP
<
Header
.
Subheader
>
用以支持系统的邮件发送
<
/Header.Subheader
>
<
Header
.
Subheader
>
用以支持系统的邮件发送
<
/Header.Subheader
>
<
/Header
>
<
/Header
>
...
@@ -592,7 +597,7 @@ const SystemSetting = () => {
...
@@ -592,7 +597,7 @@ const SystemSetting = () => {
<
/Form.Group
>
<
/Form.Group
>
<
Form
.
Button
onClick
=
{
submitSMTP
}
>
保存
SMTP
设置
<
/Form.Button
>
<
Form
.
Button
onClick
=
{
submitSMTP
}
>
保存
SMTP
设置
<
/Form.Button
>
<
Divider
/>
<
Divider
/>
<
Header
as
=
'h3'
>
<
Header
as
=
'h3'
inverted
=
{
isDark
}
>
配置
GitHub
OAuth
App
配置
GitHub
OAuth
App
<
Header
.
Subheader
>
<
Header
.
Subheader
>
用以支持通过
GitHub
进行登录注册,
用以支持通过
GitHub
进行登录注册,
...
@@ -634,7 +639,7 @@ const SystemSetting = () => {
...
@@ -634,7 +639,7 @@ const SystemSetting = () => {
保存
GitHub
OAuth
设置
保存
GitHub
OAuth
设置
<
/Form.Button
>
<
/Form.Button
>
<
Divider
/>
<
Divider
/>
<
Header
as
=
'h3'
>
<
Header
as
=
'h3'
inverted
=
{
isDark
}
>
配置
WeChat
Server
配置
WeChat
Server
<
Header
.
Subheader
>
<
Header
.
Subheader
>
用以支持通过微信进行登录注册,
用以支持通过微信进行登录注册,
...
@@ -679,7 +684,7 @@ const SystemSetting = () => {
...
@@ -679,7 +684,7 @@ const SystemSetting = () => {
保存
WeChat
Server
设置
保存
WeChat
Server
设置
<
/Form.Button
>
<
/Form.Button
>
<
Divider
/>
<
Divider
/>
<
Header
as
=
'h3'
>
配置
Telegram
登录
<
/Header
>
<
Header
as
=
'h3'
inverted
=
{
isDark
}
>
配置
Telegram
登录
<
/Header
>
<
Form
.
Group
inline
>
<
Form
.
Group
inline
>
<
Form
.
Input
<
Form
.
Input
label
=
'Telegram Bot Token'
label
=
'Telegram Bot Token'
...
@@ -700,7 +705,7 @@ const SystemSetting = () => {
...
@@ -700,7 +705,7 @@ const SystemSetting = () => {
保存
Telegram
登录设置
保存
Telegram
登录设置
<
/Form.Button
>
<
/Form.Button
>
<
Divider
/>
<
Divider
/>
<
Header
as
=
'h3'
>
<
Header
as
=
'h3'
inverted
=
{
isDark
}
>
配置
Turnstile
配置
Turnstile
<
Header
.
Subheader
>
<
Header
.
Subheader
>
用以支持用户校验,
用以支持用户校验,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment