This commit is contained in:
手瓜一十雪
2026-05-22 22:27:19 +08:00
parent f226c83595
commit 9d652be35d
5 changed files with 30 additions and 5 deletions
+3
View File
@@ -1,5 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".."
},
"include": [
"*.ts",
"**/*.ts"
+3
View File
@@ -1,5 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".."
},
"include": [
"*.ts",
"**/*.ts"
+2 -1
View File
@@ -492,7 +492,8 @@ async function handleLoginInner (context: { isLogined: boolean; }, logger: LogWr
try {
// 检查是否配置了自动登录账号,并尝试 WebUi 快速/密码回退登录。
// 这可以避免在已经有自动登录配置的情况下过早输出二维码。
const hasAutoLogin = process.env['NAPCAT_QUICK_ACCOUNT'] || (WebUiDataRuntime.getQQQuickLoginList().length > 0); // 假如有历史登录列表
const quickLoginList = WebUiDataRuntime.getQQQuickLoginList() || [];
const hasAutoLogin = process.env['NAPCAT_QUICK_ACCOUNT'] || (quickLoginList.length > 0); // 假如有历史登录列表
if (hasAutoLogin || process.env['NAPCAT_QUICK_PASSWORD'] || process.env['NAPCAT_QUICK_PASSWORD_MD5']) {
hasAttemptedFallback = true;
}
@@ -92,7 +92,7 @@ const BackupConfigCard: React.FC = () => {
onPress={handleExportConfig}
title='导出配置'
>
<LuDownload size={20} />
<LuUpload size={20} />
</Button>
<label className='cursor-pointer'>
<input
@@ -108,7 +108,7 @@ const BackupConfigCard: React.FC = () => {
as='span'
title='导入配置'
>
<LuUpload size={20} />
<LuDownload size={20} />
</Button>
</label>
</div>
@@ -436,15 +436,33 @@ const ThemeConfigCard = () => {
}
}
await FileManager.uploadWebUIFont(file);
toast.success('上传成功,即将刷新页面');
// 先自动把选择的字体模式设置为 custom,并保存配置,避免刷新后又变成了旧的/没保存的模式
const updatedTheme = { ...theme, fontMode: 'custom' };
await WebUIManager.setThemeConfig(updatedTheme);
originalDataRef.current = updatedTheme;
updateFontCache('custom');
setHasUnsavedChanges(false);
loadTheme();
toast.success('上传并保存成功,即将刷新页面');
setTimeout(() => window.location.reload(), 1000);
} catch (error) {
toast.error('上传失败: ' + (error as Error).message);
toast.error('上传或保存失败: ' + (error as Error).message);
}
}}
onDelete={async () => {
try {
await FileManager.deleteWebUIFont();
// 删除字体后,若当前选中的是自定义字体,则将其重置为系统默认(或其它)并保存,以防页面报错
if (theme.fontMode === 'custom') {
const updatedTheme = { ...theme, fontMode: 'system' };
await WebUIManager.setThemeConfig(updatedTheme);
originalDataRef.current = updatedTheme;
updateFontCache('system');
setHasUnsavedChanges(false);
loadTheme();
}
toast.success('删除成功,即将刷新页面');
setTimeout(() => window.location.reload(), 1000);
} catch (error) {