mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-12-24 09:00:06 +08:00
lint: napcat.webui
This commit is contained in:
parent
9b1ea32808
commit
52c3712200
@ -15,12 +15,12 @@ import { IoAdd, IoRemove } from 'react-icons/io5';
|
|||||||
import FileManager from '@/controllers/file_manager';
|
import FileManager from '@/controllers/file_manager';
|
||||||
|
|
||||||
interface MoveModalProps {
|
interface MoveModalProps {
|
||||||
isOpen: boolean
|
isOpen: boolean;
|
||||||
moveTargetPath: string
|
moveTargetPath: string;
|
||||||
selectionInfo: string
|
selectionInfo: string;
|
||||||
onClose: () => void
|
onClose: () => void;
|
||||||
onMove: () => void
|
onMove: () => void;
|
||||||
onSelect: (dir: string) => void // 新增回调
|
onSelect: (dir: string) => void; // 新增回调
|
||||||
}
|
}
|
||||||
|
|
||||||
// 将 DirectoryTree 改为递归组件
|
// 将 DirectoryTree 改为递归组件
|
||||||
@ -30,9 +30,9 @@ function DirectoryTree ({
|
|||||||
onSelect,
|
onSelect,
|
||||||
selectedPath,
|
selectedPath,
|
||||||
}: {
|
}: {
|
||||||
basePath: string
|
basePath: string;
|
||||||
onSelect: (dir: string) => void
|
onSelect: (dir: string) => void;
|
||||||
selectedPath?: string
|
selectedPath?: string;
|
||||||
}) {
|
}) {
|
||||||
const [dirs, setDirs] = useState<string[]>([]);
|
const [dirs, setDirs] = useState<string[]>([]);
|
||||||
const [expanded, setExpanded] = useState(false);
|
const [expanded, setExpanded] = useState(false);
|
||||||
@ -112,9 +112,9 @@ function DirectoryTree ({
|
|||||||
: (
|
: (
|
||||||
dirs.map((dirName) => {
|
dirs.map((dirName) => {
|
||||||
const childPath =
|
const childPath =
|
||||||
basePath === '/' && /^[A-Z]:$/i.test(dirName)
|
basePath === '/' && /^[A-Z]:$/i.test(dirName)
|
||||||
? dirName
|
? dirName
|
||||||
: path.join(basePath, dirName);
|
: path.join(basePath, dirName);
|
||||||
return (
|
return (
|
||||||
<DirectoryTree
|
<DirectoryTree
|
||||||
key={childPath}
|
key={childPath}
|
||||||
|
|||||||
@ -3,10 +3,10 @@ import { Input } from '@heroui/input';
|
|||||||
import { useRef, useState } from 'react';
|
import { useRef, useState } from 'react';
|
||||||
|
|
||||||
export interface FileInputProps {
|
export interface FileInputProps {
|
||||||
onChange: (file: File) => Promise<void> | void
|
onChange: (file: File) => Promise<void> | void;
|
||||||
onDelete?: () => Promise<void> | void
|
onDelete?: () => Promise<void> | void;
|
||||||
label?: string
|
label?: string;
|
||||||
accept?: string
|
accept?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const FileInput: React.FC<FileInputProps> = ({
|
const FileInput: React.FC<FileInputProps> = ({
|
||||||
@ -34,7 +34,7 @@ const FileInput: React.FC<FileInputProps> = ({
|
|||||||
if (file) {
|
if (file) {
|
||||||
await onChange(file);
|
await onChange(file);
|
||||||
}
|
}
|
||||||
} catch (_error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
} finally {
|
} finally {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
@ -49,7 +49,7 @@ const FileInput: React.FC<FileInputProps> = ({
|
|||||||
try {
|
try {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
if (onDelete) await onDelete();
|
if (onDelete) await onDelete();
|
||||||
} catch (_error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
} finally {
|
} finally {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
|
|||||||
@ -51,7 +51,7 @@ const RealTimeLogs = () => {
|
|||||||
.join('\r\n');
|
.join('\r\n');
|
||||||
Xterm.current?.clear();
|
Xterm.current?.clear();
|
||||||
Xterm.current?.write(_data);
|
Xterm.current?.write(_data);
|
||||||
} catch (_error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
toast.error('获取实时日志失败');
|
toast.error('获取实时日志失败');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,13 +20,13 @@ const modalTitle = {
|
|||||||
export interface NetworkFormModalProps<
|
export interface NetworkFormModalProps<
|
||||||
T extends keyof OneBotConfig['network']
|
T extends keyof OneBotConfig['network']
|
||||||
> {
|
> {
|
||||||
isOpen: boolean
|
isOpen: boolean;
|
||||||
field: T
|
field: T;
|
||||||
data?: OneBotConfig['network'][T][0]
|
data?: OneBotConfig['network'][T][0];
|
||||||
onOpenChange: (isOpen: boolean) => void
|
onOpenChange: (isOpen: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const NetworkFormModal = <T extends keyof OneBotConfig['network']>(
|
const NetworkFormModal = <T extends keyof OneBotConfig['network']> (
|
||||||
props: NetworkFormModalProps<T>
|
props: NetworkFormModalProps<T>
|
||||||
) => {
|
) => {
|
||||||
const { isOpen, onOpenChange, field, data } = props;
|
const { isOpen, onOpenChange, field, data } = props;
|
||||||
@ -41,7 +41,7 @@ const NetworkFormModal = <T extends keyof OneBotConfig['network']>(
|
|||||||
await updateNetworkConfig(field, data);
|
await updateNetworkConfig(field, data);
|
||||||
}
|
}
|
||||||
toast.success('保存配置成功');
|
toast.success('保存配置成功');
|
||||||
} catch (_error) {
|
} catch (error) {
|
||||||
const msg = (error as Error).message;
|
const msg = (error as Error).message;
|
||||||
|
|
||||||
toast.error(`保存配置失败: ${msg}`);
|
toast.error(`保存配置失败: ${msg}`);
|
||||||
|
|||||||
@ -23,8 +23,8 @@ import { generateDefaultJson, parse } from '@/utils/zod';
|
|||||||
import DisplayStruct from './display_struct';
|
import DisplayStruct from './display_struct';
|
||||||
|
|
||||||
export interface OneBotApiDebugProps {
|
export interface OneBotApiDebugProps {
|
||||||
path: OneBotHttpApiPath
|
path: OneBotHttpApiPath;
|
||||||
data: OneBotHttpApiContent
|
data: OneBotHttpApiContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
const OneBotApiDebug: React.FC<OneBotApiDebugProps> = (props) => {
|
const OneBotApiDebug: React.FC<OneBotApiDebugProps> = (props) => {
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import { Image } from '@heroui/image';
|
import { Image } from '@heroui/image';
|
||||||
import React from 'react';
|
|
||||||
|
|
||||||
import bkg_color from '@/assets/images/bkg-color.png';
|
import bkg_color from '@/assets/images/bkg-color.png';
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,8 @@ import { LogLevel } from '@/const/enum';
|
|||||||
import { serverRequest } from '@/utils/request';
|
import { serverRequest } from '@/utils/request';
|
||||||
|
|
||||||
export interface Log {
|
export interface Log {
|
||||||
level: LogLevel
|
level: LogLevel;
|
||||||
message: string
|
message: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class WebUIManager {
|
export default class WebUIManager {
|
||||||
@ -34,7 +34,7 @@ export default class WebUIManager {
|
|||||||
return data.data;
|
return data.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async proxy<T>(url = '') {
|
public static async proxy<T> (url = '') {
|
||||||
const data = await serverRequest.get<ServerResponse<string>>(
|
const data = await serverRequest.get<ServerResponse<string>>(
|
||||||
'/base/proxy?url=' + encodeURIComponent(url)
|
'/base/proxy?url=' + encodeURIComponent(url)
|
||||||
);
|
);
|
||||||
@ -100,7 +100,7 @@ export default class WebUIManager {
|
|||||||
const data = JSON.parse(event.data);
|
const data = JSON.parse(event.data);
|
||||||
data.message = data.message.replace(/\n/g, '\r\n');
|
data.message = data.message.replace(/\n/g, '\r\n');
|
||||||
writer([data]);
|
writer([data]);
|
||||||
} catch (_error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -134,7 +134,7 @@ export default class WebUIManager {
|
|||||||
try {
|
try {
|
||||||
const data = JSON.parse(event.data) as SystemStatus;
|
const data = JSON.parse(event.data) as SystemStatus;
|
||||||
writer(data);
|
writer(data);
|
||||||
} catch (_error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -42,7 +42,7 @@ const findTitle = (menus: MenuItem[], pathname: string): string[] => {
|
|||||||
|
|
||||||
return paths;
|
return paths;
|
||||||
};
|
};
|
||||||
const Layout: React.FC<{ children: React.ReactNode }> = ({ children }) => {
|
const Layout: React.FC<{ children: React.ReactNode; }> = ({ children }) => {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const contentRef = useRef<HTMLDivElement>(null);
|
const contentRef = useRef<HTMLDivElement>(null);
|
||||||
const [openSideBar, setOpenSideBar] = useLocalStorage(key.sideBarOpen, true);
|
const [openSideBar, setOpenSideBar] = useLocalStorage(key.sideBarOpen, true);
|
||||||
|
|||||||
@ -42,7 +42,7 @@ const ChangePasswordCard = () => {
|
|||||||
setToken('');
|
setToken('');
|
||||||
localStorage.removeItem(key.token);
|
localStorage.removeItem(key.token);
|
||||||
navigate('/web_login');
|
navigate('/web_login');
|
||||||
} catch (_error) {
|
} catch (error) {
|
||||||
const msg = (error as Error).message;
|
const msg = (error as Error).message;
|
||||||
toast.error(`修改失败: ${msg}`);
|
toast.error(`修改失败: ${msg}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,7 +22,7 @@ const LoginConfigCard = () => {
|
|||||||
formState: { isSubmitting },
|
formState: { isSubmitting },
|
||||||
setValue: setOnebotValue,
|
setValue: setOnebotValue,
|
||||||
} = useForm<{
|
} = useForm<{
|
||||||
quickLoginQQ: string
|
quickLoginQQ: string;
|
||||||
}>({
|
}>({
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
quickLoginQQ: '',
|
quickLoginQQ: '',
|
||||||
@ -37,7 +37,7 @@ const LoginConfigCard = () => {
|
|||||||
try {
|
try {
|
||||||
await QQManager.setQuickLoginQQ(data.quickLoginQQ);
|
await QQManager.setQuickLoginQQ(data.quickLoginQQ);
|
||||||
toast.success('保存成功');
|
toast.success('保存成功');
|
||||||
} catch (_error) {
|
} catch (error) {
|
||||||
const msg = (error as Error).message;
|
const msg = (error as Error).message;
|
||||||
toast.error(`保存失败: ${msg}`);
|
toast.error(`保存失败: ${msg}`);
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ const LoginConfigCard = () => {
|
|||||||
try {
|
try {
|
||||||
await refreshQuickLogin();
|
await refreshQuickLogin();
|
||||||
toast.success('刷新成功');
|
toast.success('刷新成功');
|
||||||
} catch (_error) {
|
} catch (error) {
|
||||||
const msg = (error as Error).message;
|
const msg = (error as Error).message;
|
||||||
toast.error(`刷新失败: ${msg}`);
|
toast.error(`刷新失败: ${msg}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,7 @@ const OneBotConfigCard = () => {
|
|||||||
try {
|
try {
|
||||||
await saveConfigWithoutNetwork(data);
|
await saveConfigWithoutNetwork(data);
|
||||||
toast.success('保存成功');
|
toast.success('保存成功');
|
||||||
} catch (_error) {
|
} catch (error) {
|
||||||
const msg = (error as Error).message;
|
const msg = (error as Error).message;
|
||||||
toast.error(`保存失败: ${msg}`);
|
toast.error(`保存失败: ${msg}`);
|
||||||
}
|
}
|
||||||
@ -45,7 +45,7 @@ const OneBotConfigCard = () => {
|
|||||||
setLoading(true);
|
setLoading(true);
|
||||||
await refreshConfig();
|
await refreshConfig();
|
||||||
if (shotTip) toast.success('刷新成功');
|
if (shotTip) toast.success('刷新成功');
|
||||||
} catch (_error) {
|
} catch (error) {
|
||||||
const msg = (error as Error).message;
|
const msg = (error as Error).message;
|
||||||
toast.error(`刷新失败: ${msg}`);
|
toast.error(`刷新失败: ${msg}`);
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@ -53,7 +53,7 @@ const ServerConfigCard = () => {
|
|||||||
try {
|
try {
|
||||||
await WebUIManager.updateWebUIConfig(data);
|
await WebUIManager.updateWebUIConfig(data);
|
||||||
toast.success('保存成功');
|
toast.success('保存成功');
|
||||||
} catch (_error) {
|
} catch (error) {
|
||||||
const msg = (error as Error).message;
|
const msg = (error as Error).message;
|
||||||
toast.error(`保存失败: ${msg}`);
|
toast.error(`保存失败: ${msg}`);
|
||||||
}
|
}
|
||||||
@ -63,7 +63,7 @@ const ServerConfigCard = () => {
|
|||||||
try {
|
try {
|
||||||
await refreshConfig();
|
await refreshConfig();
|
||||||
toast.success('刷新成功');
|
toast.success('刷新成功');
|
||||||
} catch (_error) {
|
} catch (error) {
|
||||||
const msg = (error as Error).message;
|
const msg = (error as Error).message;
|
||||||
toast.error(`刷新失败: ${msg}`);
|
toast.error(`刷新失败: ${msg}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,8 +21,8 @@ import { colorKeys, generateTheme, loadTheme } from '@/utils/theme';
|
|||||||
import WebUIManager from '@/controllers/webui_manager';
|
import WebUIManager from '@/controllers/webui_manager';
|
||||||
|
|
||||||
export type PreviewThemeCardProps = {
|
export type PreviewThemeCardProps = {
|
||||||
theme: ThemeInfo
|
theme: ThemeInfo;
|
||||||
onPreview: () => void
|
onPreview: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const values = [
|
const values = [
|
||||||
@ -110,7 +110,7 @@ const ThemeConfigCard = () => {
|
|||||||
formState: { isSubmitting },
|
formState: { isSubmitting },
|
||||||
setValue: setOnebotValue,
|
setValue: setOnebotValue,
|
||||||
} = useForm<{
|
} = useForm<{
|
||||||
theme: ThemeConfig
|
theme: ThemeConfig;
|
||||||
}>({
|
}>({
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
theme: {
|
theme: {
|
||||||
@ -146,7 +146,7 @@ const ThemeConfigCard = () => {
|
|||||||
await WebUIManager.setThemeConfig(data.theme);
|
await WebUIManager.setThemeConfig(data.theme);
|
||||||
toast.success('保存成功');
|
toast.success('保存成功');
|
||||||
loadTheme();
|
loadTheme();
|
||||||
} catch (_error) {
|
} catch (error) {
|
||||||
const msg = (error as Error).message;
|
const msg = (error as Error).message;
|
||||||
toast.error(`保存失败: ${msg}`);
|
toast.error(`保存失败: ${msg}`);
|
||||||
}
|
}
|
||||||
@ -156,7 +156,7 @@ const ThemeConfigCard = () => {
|
|||||||
try {
|
try {
|
||||||
await refreshAsync();
|
await refreshAsync();
|
||||||
toast.success('刷新成功');
|
toast.success('刷新成功');
|
||||||
} catch (_error) {
|
} catch (error) {
|
||||||
const msg = (error as Error).message;
|
const msg = (error as Error).message;
|
||||||
toast.error(`刷新失败: ${msg}`);
|
toast.error(`刷新失败: ${msg}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,7 +48,7 @@ const WebUIConfigCard = () => {
|
|||||||
setCustomIcons(data.customIcons);
|
setCustomIcons(data.customIcons);
|
||||||
setB64img(data.background);
|
setB64img(data.background);
|
||||||
toast.success('保存成功');
|
toast.success('保存成功');
|
||||||
} catch (_error) {
|
} catch (error) {
|
||||||
const msg = (error as Error).message;
|
const msg = (error as Error).message;
|
||||||
toast.error(`保存失败: ${msg}`);
|
toast.error(`保存失败: ${msg}`);
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ const WebUIConfigCard = () => {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
} catch (_error) {
|
} catch (error) {
|
||||||
toast.error('上传失败: ' + (error as Error).message);
|
toast.error('上传失败: ' + (error as Error).message);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
@ -85,7 +85,7 @@ const WebUIConfigCard = () => {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
} catch (_error) {
|
} catch (error) {
|
||||||
toast.error('删除失败: ' + (error as Error).message);
|
toast.error('删除失败: ' + (error as Error).message);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|||||||
@ -41,8 +41,8 @@ export default function FileManagerPage () {
|
|||||||
currentPath = currentPath.slice(1);
|
currentPath = currentPath.slice(1);
|
||||||
}
|
}
|
||||||
const [editingFile, setEditingFile] = useState<{
|
const [editingFile, setEditingFile] = useState<{
|
||||||
path: string
|
path: string;
|
||||||
content: string
|
content: string;
|
||||||
} | null>(null);
|
} | null>(null);
|
||||||
const [isCreateModalOpen, setIsCreateModalOpen] = useState(false);
|
const [isCreateModalOpen, setIsCreateModalOpen] = useState(false);
|
||||||
const [newFileName, setNewFileName] = useState('');
|
const [newFileName, setNewFileName] = useState('');
|
||||||
@ -175,7 +175,7 @@ export default function FileManagerPage () {
|
|||||||
setIsCreateModalOpen(false);
|
setIsCreateModalOpen(false);
|
||||||
setNewFileName('');
|
setNewFileName('');
|
||||||
loadFiles();
|
loadFiles();
|
||||||
} catch (_error) {
|
} catch (error) {
|
||||||
toast.error((error as Error)?.message || '创建失败');
|
toast.error((error as Error)?.message || '创建失败');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -29,7 +29,7 @@ export default function LogsPage () {
|
|||||||
try {
|
try {
|
||||||
const result = await WebUIManager.getLogContent(selectedLog);
|
const result = await WebUIManager.getLogContent(selectedLog);
|
||||||
setLogContent(result);
|
setLogContent(result);
|
||||||
} catch (_error) {
|
} catch (error) {
|
||||||
const msg = (error as Error).message;
|
const msg = (error as Error).message;
|
||||||
toast.error(`加载日志失败: ${msg}`);
|
toast.error(`加载日志失败: ${msg}`);
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@ -19,21 +19,21 @@ import useConfig from '@/hooks/use-config';
|
|||||||
import useDialog from '@/hooks/use-dialog';
|
import useDialog from '@/hooks/use-dialog';
|
||||||
|
|
||||||
export interface SectionProps {
|
export interface SectionProps {
|
||||||
title: string
|
title: string;
|
||||||
color?:
|
color?:
|
||||||
| 'violet'
|
| 'violet'
|
||||||
| 'yellow'
|
| 'yellow'
|
||||||
| 'blue'
|
| 'blue'
|
||||||
| 'cyan'
|
| 'cyan'
|
||||||
| 'green'
|
| 'green'
|
||||||
| 'pink'
|
| 'pink'
|
||||||
| 'foreground'
|
| 'foreground';
|
||||||
icon: React.ReactNode
|
icon: React.ReactNode;
|
||||||
children: React.ReactNode
|
children: React.ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EmptySectionProps {
|
export interface EmptySectionProps {
|
||||||
isEmpty: boolean
|
isEmpty: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const EmptySection: React.FC<EmptySectionProps> = ({ isEmpty }) => {
|
const EmptySection: React.FC<EmptySectionProps> = ({ isEmpty }) => {
|
||||||
@ -84,7 +84,7 @@ export default function NetworkPage () {
|
|||||||
try {
|
try {
|
||||||
await refreshConfig();
|
await refreshConfig();
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
} catch (_error) {
|
} catch (error) {
|
||||||
const msg = (error as Error).message;
|
const msg = (error as Error).message;
|
||||||
|
|
||||||
toast.error(`获取配置失败: ${msg}`);
|
toast.error(`获取配置失败: ${msg}`);
|
||||||
@ -112,7 +112,7 @@ export default function NetworkPage () {
|
|||||||
await deleteNetworkConfig(field, name);
|
await deleteNetworkConfig(field, name);
|
||||||
toast.success('删除配置成功');
|
toast.success('删除配置成功');
|
||||||
resolve();
|
resolve();
|
||||||
} catch (_error) {
|
} catch (error) {
|
||||||
const msg = (error as Error).message;
|
const msg = (error as Error).message;
|
||||||
|
|
||||||
toast.error(`删除配置失败: ${msg}`);
|
toast.error(`删除配置失败: ${msg}`);
|
||||||
@ -134,7 +134,7 @@ export default function NetworkPage () {
|
|||||||
try {
|
try {
|
||||||
await enableNetworkConfig(field, name);
|
await enableNetworkConfig(field, name);
|
||||||
toast.success('更新配置成功');
|
toast.success('更新配置成功');
|
||||||
} catch (_error) {
|
} catch (error) {
|
||||||
const msg = (error as Error).message;
|
const msg = (error as Error).message;
|
||||||
|
|
||||||
toast.error(`更新配置失败: ${msg}`);
|
toast.error(`更新配置失败: ${msg}`);
|
||||||
@ -150,7 +150,7 @@ export default function NetworkPage () {
|
|||||||
try {
|
try {
|
||||||
await enableDebugNetworkConfig(field, name);
|
await enableDebugNetworkConfig(field, name);
|
||||||
toast.success('更新配置成功');
|
toast.success('更新配置成功');
|
||||||
} catch (_error) {
|
} catch (error) {
|
||||||
const msg = (error as Error).message;
|
const msg = (error as Error).message;
|
||||||
|
|
||||||
toast.error(`更新配置失败: ${msg}`);
|
toast.error(`更新配置失败: ${msg}`);
|
||||||
@ -165,7 +165,7 @@ export default function NetworkPage () {
|
|||||||
onOpen();
|
onOpen();
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderCard = <T extends keyof OneBotConfig['network']>(
|
const renderCard = <T extends keyof OneBotConfig['network']> (
|
||||||
type: T,
|
type: T,
|
||||||
item: OneBotConfig['network'][T][0],
|
item: OneBotConfig['network'][T][0],
|
||||||
showType = false
|
showType = false
|
||||||
|
|||||||
@ -23,8 +23,8 @@ import { TerminalInstance } from '@/components/terminal/terminal-instance';
|
|||||||
import terminalManager from '@/controllers/terminal_manager';
|
import terminalManager from '@/controllers/terminal_manager';
|
||||||
|
|
||||||
interface TerminalTab {
|
interface TerminalTab {
|
||||||
id: string
|
id: string;
|
||||||
title: string
|
title: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function TerminalPage () {
|
export default function TerminalPage () {
|
||||||
|
|||||||
@ -34,7 +34,7 @@ export default function QQLoginPage () {
|
|||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
try {
|
try {
|
||||||
await QQManager.setQuickLogin(uinValue);
|
await QQManager.setQuickLogin(uinValue);
|
||||||
} catch (_error) {
|
} catch (error) {
|
||||||
const msg = (error as Error).message;
|
const msg = (error as Error).message;
|
||||||
|
|
||||||
toast.error(`快速登录QQ失败: ${msg}`);
|
toast.error(`快速登录QQ失败: ${msg}`);
|
||||||
@ -60,7 +60,7 @@ export default function QQLoginPage () {
|
|||||||
} else {
|
} else {
|
||||||
setQrcode(data.qrcodeurl);
|
setQrcode(data.qrcodeurl);
|
||||||
}
|
}
|
||||||
} catch (_error) {
|
} catch (error) {
|
||||||
const msg = (error as Error).message;
|
const msg = (error as Error).message;
|
||||||
|
|
||||||
toast.error(`获取二维码失败: ${msg}`);
|
toast.error(`获取二维码失败: ${msg}`);
|
||||||
@ -82,7 +82,7 @@ export default function QQLoginPage () {
|
|||||||
|
|
||||||
setQQList(qqList);
|
setQQList(qqList);
|
||||||
} catch (_error) {
|
} catch (_error) {
|
||||||
const msg = (error as Error).message;
|
const msg = (_error as Error).message;
|
||||||
|
|
||||||
toast.error(`获取QQ列表失败: ${msg}`);
|
toast.error(`获取QQ列表失败: ${msg}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,7 @@ export default function WebLoginPage () {
|
|||||||
setLocalToken(data);
|
setLocalToken(data);
|
||||||
navigate('/qq_login', { replace: true });
|
navigate('/qq_login', { replace: true });
|
||||||
}
|
}
|
||||||
} catch (_error) {
|
} catch (error) {
|
||||||
toast.error((error as Error).message);
|
toast.error((error as Error).message);
|
||||||
} finally {
|
} finally {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
|
|||||||
14
package.json
14
package.json
@ -4,14 +4,14 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "4.9.21",
|
"version": "4.9.21",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:universal": "npm run build:webui && vite build --mode universal || exit 1",
|
"build:universal": "npm run build:webui && npm run dev:universal || exit 1",
|
||||||
"build:framework": "npm run build:webui && vite build --mode framework || exit 1",
|
"build:framework": "npm run build:webui && npm run dev:framework || exit 1",
|
||||||
"build:shell": "npm run build:webui && vite build --mode shell || exit 1",
|
"build:shell": "npm run build:webui && npm run dev:shell || exit 1",
|
||||||
"build:webui": "cd napcat.webui && npm run build",
|
"build:webui": "cd napcat.webui && npm run build",
|
||||||
"dev:universal": "vite build --mode universal",
|
"dev:universal": "tsc --noEmit && vite build --mode universal",
|
||||||
"dev:framework": "vite build --mode framework",
|
"dev:framework": "tsc --noEmit && vite build --mode framework",
|
||||||
"dev:shell": "vite build --mode shell",
|
"dev:shell": "tsc --noEmit && vite build --mode shell",
|
||||||
"dev:shell-analysis": "vite build --mode shell-analysis",
|
"dev:shell-analysis": "tsc --noEmit && vite build --mode shell-analysis",
|
||||||
"dev:webui": "cd napcat.webui && npm run dev",
|
"dev:webui": "cd napcat.webui && npm run dev",
|
||||||
"tsc": "npm run tsc:core && npm run tsc:webui",
|
"tsc": "npm run tsc:core && npm run tsc:webui",
|
||||||
"tsc:core": "tsc --noEmit",
|
"tsc:core": "tsc --noEmit",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user