mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-12-20 21:50:10 +08:00
build: fix
This commit is contained in:
parent
57eef9cb86
commit
9b1ea32808
@ -24,6 +24,15 @@ const commaDangle = val => {
|
|||||||
val.rules.camelcase = 'off';
|
val.rules.camelcase = 'off';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 未使用的变量强制报错 */
|
||||||
|
if (val?.rules?.['@typescript-eslint/no-unused-vars']) {
|
||||||
|
val.rules['@typescript-eslint/no-unused-vars'] = ['error', {
|
||||||
|
argsIgnorePattern: '^_',
|
||||||
|
varsIgnorePattern: '^_',
|
||||||
|
caughtErrorsIgnorePattern: '^_',
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
2
napcat.webui/eslint.config.mjs
Normal file
2
napcat.webui/eslint.config.mjs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
import eslintConfig from '../eslint.config.mjs';
|
||||||
|
export default eslintConfig;
|
||||||
@ -44,7 +44,7 @@ function DirectoryTree ({
|
|||||||
// 直接使用 basePath 调用接口,移除 process.platform 判断
|
// 直接使用 basePath 调用接口,移除 process.platform 判断
|
||||||
const list = await FileManager.listDirectories(basePath);
|
const list = await FileManager.listDirectories(basePath);
|
||||||
setDirs(list.map((item) => item.name));
|
setDirs(list.map((item) => item.name));
|
||||||
} catch (error) {
|
} catch (_error) {
|
||||||
// ...error handling...
|
// ...error handling...
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -24,7 +24,7 @@ export default function Hitokoto () {
|
|||||||
const text = `${data?.hitokoto} —— ${data?.from} ${data?.from_who}`;
|
const text = `${data?.hitokoto} —— ${data?.from} ${data?.from_who}`;
|
||||||
navigator.clipboard.writeText(text);
|
navigator.clipboard.writeText(text);
|
||||||
toast.success('复制成功');
|
toast.success('复制成功');
|
||||||
} catch (error) {
|
} catch (_error) {
|
||||||
toast.error('复制失败, 请手动复制');
|
toast.error('复制失败, 请手动复制');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -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('获取实时日志失败');
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ const RealTimeLogs = () => {
|
|||||||
return () => {
|
return () => {
|
||||||
source.close();
|
source.close();
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (_error) {
|
||||||
toast.error('获取实时日志失败');
|
toast.error('获取实时日志失败');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -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}`);
|
||||||
|
|||||||
@ -77,7 +77,7 @@ const OneBotApiDebug: React.FC<OneBotApiDebugProps> = (props) => {
|
|||||||
});
|
});
|
||||||
toast.dismiss(r);
|
toast.dismiss(r);
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (_error) {
|
||||||
toast.error('请求体 JSON 格式错误');
|
toast.error('请求体 JSON 格式错误');
|
||||||
setIsFetching(false);
|
setIsFetching(false);
|
||||||
toast.dismiss(r);
|
toast.dismiss(r);
|
||||||
|
|||||||
@ -15,7 +15,7 @@ import CodeEditor from '@/components/code_editor';
|
|||||||
import type { CodeEditorRef } from '@/components/code_editor';
|
import type { CodeEditorRef } from '@/components/code_editor';
|
||||||
|
|
||||||
export interface OneBotSendModalProps {
|
export interface OneBotSendModalProps {
|
||||||
sendMessage: (msg: string) => void
|
sendMessage: (msg: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const OneBotSendModal: React.FC<OneBotSendModalProps> = (props) => {
|
const OneBotSendModal: React.FC<OneBotSendModalProps> = (props) => {
|
||||||
@ -34,7 +34,7 @@ const OneBotSendModal: React.FC<OneBotSendModalProps> = (props) => {
|
|||||||
sendMessage(msg);
|
sendMessage(msg);
|
||||||
toast.success('消息发送成功');
|
toast.success('消息发送成功');
|
||||||
onClose();
|
onClose();
|
||||||
} catch (error) {
|
} catch (_error) {
|
||||||
toast.error('消息发送失败');
|
toast.error('消息发送失败');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -7,36 +7,36 @@ const TailwindMarkdown: React.FC<{ content: string }> = ({ content }) => {
|
|||||||
className='prose prose-sm sm:prose lg:prose-lg xl:prose-xl'
|
className='prose prose-sm sm:prose lg:prose-lg xl:prose-xl'
|
||||||
remarkPlugins={[remarkGfm]}
|
remarkPlugins={[remarkGfm]}
|
||||||
components={{
|
components={{
|
||||||
h1: ({ node, ...props }) => (
|
h1: ({ node: _node, ...props }) => (
|
||||||
<h1 className='text-2xl font-bold' {...props} />
|
<h1 className='text-2xl font-bold' {...props} />
|
||||||
),
|
),
|
||||||
h2: ({ node, ...props }) => (
|
h2: ({ node: _node, ...props }) => (
|
||||||
<h2 className='text-xl font-bold' {...props} />
|
<h2 className='text-xl font-bold' {...props} />
|
||||||
),
|
),
|
||||||
h3: ({ node, ...props }) => (
|
h3: ({ node: _node, ...props }) => (
|
||||||
<h3 className='text-lg font-bold' {...props} />
|
<h3 className='text-lg font-bold' {...props} />
|
||||||
),
|
),
|
||||||
p: ({ node, ...props }) => <p className='m-0' {...props} />,
|
p: ({ node: _node, ...props }) => <p className='m-0' {...props} />,
|
||||||
a: ({ node, ...props }) => (
|
a: ({ node: _node, ...props }) => (
|
||||||
<a
|
<a
|
||||||
className='text-primary-500 inline-block hover:underline'
|
className='text-primary-500 inline-block hover:underline'
|
||||||
target='_blank'
|
target='_blank'
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
ul: ({ node, ...props }) => (
|
ul: ({ node: _node, ...props }) => (
|
||||||
<ul className='list-disc list-inside' {...props} />
|
<ul className='list-disc list-inside' {...props} />
|
||||||
),
|
),
|
||||||
ol: ({ node, ...props }) => (
|
ol: ({ node: _node, ...props }) => (
|
||||||
<ol className='list-decimal list-inside' {...props} />
|
<ol className='list-decimal list-inside' {...props} />
|
||||||
),
|
),
|
||||||
blockquote: ({ node, ...props }) => (
|
blockquote: ({ node: _node, ...props }) => (
|
||||||
<blockquote
|
<blockquote
|
||||||
className='border-l-4 border-default-300 pl-4 italic'
|
className='border-l-4 border-default-300 pl-4 italic'
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
code: ({ node, ...props }) => (
|
code: ({ node: _node, ...props }) => (
|
||||||
<code className='bg-default-100 p-1 rounded text-xs' {...props} />
|
<code className='bg-default-100 p-1 rounded text-xs' {...props} />
|
||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
|
|||||||
@ -18,7 +18,7 @@ export function TerminalInstance ({ id }: TerminalInstanceProps) {
|
|||||||
if (parsed.data) {
|
if (parsed.data) {
|
||||||
termRef.current?.write(parsed.data);
|
termRef.current?.write(parsed.data);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (_e) {
|
||||||
termRef.current?.write(data);
|
termRef.current?.write(data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -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);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -27,7 +27,7 @@ export function useWebSocketDebug (url: string, token: string) {
|
|||||||
try {
|
try {
|
||||||
const data = JSON.parse(event.data);
|
const data = JSON.parse(event.data);
|
||||||
messageHistory.unshift(data);
|
messageHistory.unshift(data);
|
||||||
} catch (error) {
|
} catch (_error) {
|
||||||
toast.error('WebSocket 消息解析失败');
|
toast.error('WebSocket 消息解析失败');
|
||||||
}
|
}
|
||||||
}, []),
|
}, []),
|
||||||
|
|||||||
@ -59,7 +59,7 @@ const Layout: React.FC<{ children: React.ReactNode }> = ({ children }) => {
|
|||||||
navigate('/web_login', { replace: true });
|
navigate('/web_login', { replace: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (_error) {
|
||||||
navigate('/web_login', { replace: true });
|
navigate('/web_login', { replace: 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}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|||||||
@ -86,7 +86,7 @@ export default function FileManagerPage () {
|
|||||||
try {
|
try {
|
||||||
const fileList = await FileManager.listFiles(currentPath);
|
const fileList = await FileManager.listFiles(currentPath);
|
||||||
setFiles(sortFiles(fileList, sortDescriptor));
|
setFiles(sortFiles(fileList, sortDescriptor));
|
||||||
} catch (error) {
|
} catch (_error) {
|
||||||
toast.error('加载文件列表失败');
|
toast.error('加载文件列表失败');
|
||||||
setFiles([]);
|
setFiles([]);
|
||||||
}
|
}
|
||||||
@ -123,7 +123,7 @@ export default function FileManagerPage () {
|
|||||||
try {
|
try {
|
||||||
const content = await FileManager.readFile(filePath);
|
const content = await FileManager.readFile(filePath);
|
||||||
setEditingFile({ path: filePath, content });
|
setEditingFile({ path: filePath, content });
|
||||||
} catch (error) {
|
} catch (_error) {
|
||||||
toast.error('打开文件失败');
|
toast.error('打开文件失败');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -135,7 +135,7 @@ export default function FileManagerPage () {
|
|||||||
toast.success('保存成功');
|
toast.success('保存成功');
|
||||||
setEditingFile(null);
|
setEditingFile(null);
|
||||||
loadFiles();
|
loadFiles();
|
||||||
} catch (error) {
|
} catch (_error) {
|
||||||
toast.error('保存失败');
|
toast.error('保存失败');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -149,7 +149,7 @@ export default function FileManagerPage () {
|
|||||||
await FileManager.delete(filePath);
|
await FileManager.delete(filePath);
|
||||||
toast.success('删除成功');
|
toast.success('删除成功');
|
||||||
loadFiles();
|
loadFiles();
|
||||||
} catch (error) {
|
} catch (_error) {
|
||||||
toast.error('删除失败');
|
toast.error('删除失败');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -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 || '创建失败');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -198,7 +198,7 @@ export default function FileManagerPage () {
|
|||||||
toast.success('批量删除成功');
|
toast.success('批量删除成功');
|
||||||
setSelectedFiles(new Set());
|
setSelectedFiles(new Set());
|
||||||
loadFiles();
|
loadFiles();
|
||||||
} catch (error) {
|
} catch (_error) {
|
||||||
toast.error('批量删除失败');
|
toast.error('批量删除失败');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -217,7 +217,7 @@ export default function FileManagerPage () {
|
|||||||
setRenamingFile('');
|
setRenamingFile('');
|
||||||
setNewFileName('');
|
setNewFileName('');
|
||||||
loadFiles();
|
loadFiles();
|
||||||
} catch (error) {
|
} catch (_error) {
|
||||||
toast.error('重命名失败');
|
toast.error('重命名失败');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -233,7 +233,7 @@ export default function FileManagerPage () {
|
|||||||
setIsMoveModalOpen(false);
|
setIsMoveModalOpen(false);
|
||||||
setMoveTargetPath('');
|
setMoveTargetPath('');
|
||||||
loadFiles();
|
loadFiles();
|
||||||
} catch (error) {
|
} catch (_error) {
|
||||||
toast.error('移动失败');
|
toast.error('移动失败');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -256,7 +256,7 @@ export default function FileManagerPage () {
|
|||||||
setMoveTargetPath('');
|
setMoveTargetPath('');
|
||||||
setSelectedFiles(new Set());
|
setSelectedFiles(new Set());
|
||||||
loadFiles();
|
loadFiles();
|
||||||
} catch (error) {
|
} catch (_error) {
|
||||||
toast.error('批量移动失败');
|
toast.error('批量移动失败');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -313,7 +313,7 @@ export default function FileManagerPage () {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
loadFiles();
|
loadFiles();
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (_error) {
|
||||||
toast.error('上传失败');
|
toast.error('上传失败');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -59,7 +59,7 @@ const QQInfo: React.FC = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export interface SystemStatusCardProps {
|
export interface SystemStatusCardProps {
|
||||||
setArchInfo: (arch: string | undefined) => void
|
setArchInfo: (arch: string | undefined) => void;
|
||||||
}
|
}
|
||||||
const SystemStatusCard: React.FC<SystemStatusCardProps> = ({ setArchInfo }) => {
|
const SystemStatusCard: React.FC<SystemStatusCardProps> = ({ setArchInfo }) => {
|
||||||
const [systemStatus, setSystemStatus] = useState<SystemStatus>();
|
const [systemStatus, setSystemStatus] = useState<SystemStatus>();
|
||||||
@ -68,7 +68,7 @@ const SystemStatusCard: React.FC<SystemStatusCardProps> = ({ setArchInfo }) => {
|
|||||||
try {
|
try {
|
||||||
const event = WebUIManager.getSystemStatus(setSystemStatus);
|
const event = WebUIManager.getSystemStatus(setSystemStatus);
|
||||||
return event;
|
return event;
|
||||||
} catch (error) {
|
} catch (_error) {
|
||||||
toast.error('获取系统状态失败');
|
toast.error('获取系统状态失败');
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|||||||
@ -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 {
|
||||||
|
|||||||
@ -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}`);
|
||||||
|
|||||||
@ -75,7 +75,7 @@ export default function TerminalPage () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
setTabs((prev) => prev.filter((tab) => tab.id !== id));
|
setTabs((prev) => prev.filter((tab) => tab.id !== id));
|
||||||
} catch (error) {
|
} catch (_error) {
|
||||||
toast.error('关闭终端失败');
|
toast.error('关闭终端失败');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -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}`);
|
||||||
@ -72,7 +72,7 @@ export default function QQLoginPage () {
|
|||||||
try {
|
try {
|
||||||
const data = await QQManager.getQQQuickLoginListNew();
|
const data = await QQManager.getQQQuickLoginListNew();
|
||||||
setQQList(data);
|
setQQList(data);
|
||||||
} catch (error) {
|
} catch (_error) {
|
||||||
try {
|
try {
|
||||||
const data = await QQManager.getQQQuickLoginList();
|
const data = await QQManager.getQQQuickLoginList();
|
||||||
|
|
||||||
@ -81,7 +81,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);
|
||||||
|
|||||||
@ -13,6 +13,9 @@
|
|||||||
"dev:shell": "vite build --mode shell",
|
"dev:shell": "vite build --mode shell",
|
||||||
"dev:shell-analysis": "vite build --mode shell-analysis",
|
"dev:shell-analysis": "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:core": "tsc --noEmit",
|
||||||
|
"tsc:webui": "cd napcat.webui && tsc --noEmit",
|
||||||
"lint": "npm run lint:core && npm run lint:webui",
|
"lint": "npm run lint:core && npm run lint:webui",
|
||||||
"lint:fix": "npm run lint:fix:core && npm run lint:fix:webui",
|
"lint:fix": "npm run lint:fix:core && npm run lint:fix:webui",
|
||||||
"lint:core": "eslint src/**/*.{js,ts}",
|
"lint:core": "eslint src/**/*.{js,ts}",
|
||||||
@ -70,4 +73,4 @@
|
|||||||
"silk-wasm": "^3.6.1",
|
"silk-wasm": "^3.6.1",
|
||||||
"ws": "^8.18.3"
|
"ws": "^8.18.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,51 +1,51 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES2021",
|
"target": "ES2021",
|
||||||
"useDefineForClassFields": true,
|
"useDefineForClassFields": true,
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"lib": [
|
"lib": [
|
||||||
"ES2021",
|
"ES2021",
|
||||||
"DOM",
|
"DOM",
|
||||||
"DOM.Iterable"
|
"DOM.Iterable"
|
||||||
],
|
],
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"moduleResolution": "Node",
|
"moduleResolution": "Node",
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"allowImportingTsExtensions": false,
|
"allowImportingTsExtensions": false,
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noUnusedLocals": true,
|
"noUnusedLocals": true,
|
||||||
"noUnusedParameters": true,
|
"noUnusedParameters": true,
|
||||||
"noFallthroughCasesInSwitch": true,
|
"noFallthroughCasesInSwitch": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": [
|
"@/*": [
|
||||||
"./src/*"
|
"./src/*"
|
||||||
],
|
],
|
||||||
"@webapi/*": [
|
"@webapi/*": [
|
||||||
"./src/webui/src/*"
|
"./src/webui/src/*"
|
||||||
]
|
]
|
||||||
},
|
|
||||||
"noImplicitAny": true,
|
|
||||||
"strictNullChecks": true,
|
|
||||||
"strictFunctionTypes": true,
|
|
||||||
"strictBindCallApply": true,
|
|
||||||
"alwaysStrict": true,
|
|
||||||
"noImplicitThis": true,
|
|
||||||
"noImplicitReturns": true,
|
|
||||||
"noPropertyAccessFromIndexSignature": true,
|
|
||||||
"noUncheckedIndexedAccess": true,
|
|
||||||
"exactOptionalPropertyTypes": false,// 精准可选
|
|
||||||
"forceConsistentCasingInFileNames": true,
|
|
||||||
"useUnknownInCatchVariables": true,
|
|
||||||
"noImplicitOverride": true,
|
|
||||||
"strictPropertyInitialization": true
|
|
||||||
},
|
},
|
||||||
"include": [
|
"noImplicitAny": true,
|
||||||
"src/**/*.ts"
|
"strictNullChecks": true,
|
||||||
]
|
"strictFunctionTypes": true,
|
||||||
}
|
"strictBindCallApply": true,
|
||||||
|
"alwaysStrict": true,
|
||||||
|
"noImplicitThis": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noPropertyAccessFromIndexSignature": true,
|
||||||
|
"noUncheckedIndexedAccess": true,
|
||||||
|
"exactOptionalPropertyTypes": false, // 精准可选
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"useUnknownInCatchVariables": true,
|
||||||
|
"noImplicitOverride": true,
|
||||||
|
"strictPropertyInitialization": true
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/**/*.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user