mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-06 21:10:23 +00:00
Refactor UI components for consistent styling
Unified card and component styles across the frontend by removing background image logic and related conditional classes. Updated color schemes, shadows, and spacing for a more consistent appearance. Improved error handling and response structure in the backend update handler.
This commit is contained in:
@@ -188,10 +188,20 @@ export const UpdateNapCatHandler: RequestHandler = async (_req, res) => {
|
||||
try {
|
||||
// 获取最新release信息
|
||||
const latestRelease = await getLatestRelease() as Release;
|
||||
|
||||
// 验证 release 响应
|
||||
if (!latestRelease || !latestRelease.tag_name) {
|
||||
throw new Error('无法获取最新版本信息,请稍后重试');
|
||||
}
|
||||
|
||||
if (!latestRelease.assets || !Array.isArray(latestRelease.assets)) {
|
||||
throw new Error('无法获取下载资源列表,可能是 GitHub API 请求限制,请稍后重试');
|
||||
}
|
||||
|
||||
const ReleaseName = WebUiDataRuntime.getWorkingEnv() === NapCatCoreWorkingEnv.Framework ? 'NapCat.Framework.zip' : 'NapCat.Shell.zip';
|
||||
const shellZipAsset = latestRelease.assets.find(asset => asset.name === ReleaseName);
|
||||
if (!shellZipAsset) {
|
||||
throw new Error(`未找到${ReleaseName}文件`);
|
||||
throw new Error(`未找到${ReleaseName}文件,可用的资源: ${latestRelease.assets.map(a => a.name).join(', ')}`);
|
||||
}
|
||||
|
||||
// 创建临时目录
|
||||
@@ -279,12 +289,13 @@ export const UpdateNapCatHandler: RequestHandler = async (_req, res) => {
|
||||
// 发送成功响应
|
||||
const message = failedFiles.length > 0
|
||||
? `更新完成,重启应用以应用剩余${failedFiles.length}个文件的更新`
|
||||
: '更新完成';
|
||||
: '更新完成,请重启 NapCat 以应用更新';
|
||||
sendSuccess(res, {
|
||||
status: 'completed',
|
||||
message,
|
||||
newVersion: latestRelease.tag_name,
|
||||
failedFilesCount: failedFiles.length
|
||||
failedFilesCount: failedFiles.length,
|
||||
needRestart: true
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user