Compare commits

...

2 Commits

Author SHA1 Message Date
bietiaop
813a541e7f fix: config首次加载 2025-01-25 13:36:56 +08:00
Mlikiowa
efd489bfd4 release: v4.4.7 2025-01-25 04:56:25 +00:00
4 changed files with 18 additions and 7 deletions

View File

@@ -4,7 +4,7 @@
"name": "NapCatQQ",
"slug": "NapCat.Framework",
"description": "高性能的 OneBot 11 协议实现",
"version": "4.4.6",
"version": "4.4.7",
"icon": "./logo.png",
"authors": [
{

View File

@@ -1,12 +1,14 @@
import { Tab, Tabs } from '@heroui/tabs'
import { useLocalStorage } from '@uidotdev/usehooks'
import { useEffect } from 'react'
import { useEffect, useState } from 'react'
import { useForm } from 'react-hook-form'
import toast from 'react-hot-toast'
import { useMediaQuery } from 'react-responsive'
import key from '@/const/key'
import PageLoading from '@/components/page_loading'
import useConfig from '@/hooks/use-config'
import useMusic from '@/hooks/use-music'
@@ -15,6 +17,7 @@ import WebUIConfigCard from './webui'
export default function ConfigPage() {
const { config, saveConfigWithoutNetwork, refreshConfig } = useConfig()
const [loading, setLoading] = useState(false)
const {
control: onebotControl,
handleSubmit: handleOnebotSubmit,
@@ -82,13 +85,16 @@ export default function ConfigPage() {
}
})
const onRefresh = async () => {
const onRefresh = async (shotTip = true) => {
try {
setLoading(true)
await refreshConfig()
toast.success('刷新成功')
if (shotTip) toast.success('刷新成功')
} catch (error) {
const msg = (error as Error).message
toast.error(`刷新失败: ${msg}`)
} finally {
setLoading(false)
}
}
@@ -97,6 +103,10 @@ export default function ConfigPage() {
resetWebUI()
}, [config])
useEffect(() => {
onRefresh(false)
}, [])
return (
<section className="w-[1000px] max-w-full md:mx-auto gap-4 py-8 px-2 md:py-10">
<Tabs
@@ -106,12 +116,13 @@ export default function ConfigPage() {
isVertical={isMediumUp}
classNames={{
tabList: 'sticky flex top-14 bg-opacity-50 backdrop-blur-sm',
panel: 'w-full',
panel: 'w-full relative',
base: 'md:!w-auto flex-grow-0 flex-shrink-0 mr-0',
cursor: 'bg-opacity-60 backdrop-blur-sm'
}}
>
<Tab title="OneBot配置" key="onebot">
<PageLoading loading={loading} />
<OneBotConfigCard
isSubmitting={isOnebotSubmitting}
onRefresh={onRefresh}

View File

@@ -2,7 +2,7 @@
"name": "napcat",
"private": true,
"type": "module",
"version": "4.4.6",
"version": "4.4.7",
"scripts": {
"build:universal": "npm run build:webui && vite build --mode universal || exit 1",
"build:framework": "npm run build:webui && vite build --mode framework || exit 1",

View File

@@ -1 +1 @@
export const napCatVersion = '4.4.6';
export const napCatVersion = '4.4.7';