From 9084a30e8da17fb9a5ea933bbb0470195b99c9e1 Mon Sep 17 00:00:00 2001 From: Kuingsmile <96409857+Kuingsmile@users.noreply.github.com> Date: Mon, 30 Jun 2025 17:10:18 +0800 Subject: [PATCH] :bug: Fix(custom): truncate update log for better readability in dialog --- src/main/lifeCycle/index.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/lifeCycle/index.ts b/src/main/lifeCycle/index.ts index 37f1560c..246feae6 100644 --- a/src/main/lifeCycle/index.ts +++ b/src/main/lifeCycle/index.ts @@ -79,6 +79,20 @@ autoUpdater.on('update-available', async (info: UpdateInfo) => { } catch (e: any) { logger.error(e) } + + const maxLogLength = 800 + let displayLog = updateLog + let truncatedNote = '' + + if (updateLog.length > maxLogLength) { + const truncatePoint = updateLog.lastIndexOf('\n', maxLogLength) + displayLog = updateLog.substring(0, truncatePoint > 0 ? truncatePoint : maxLogLength) + truncatedNote = + lang === II18nLanguage.ZH_CN + ? '\n\n... (更多详情请查看完整更新日志)' + : '\n\n... (See full changelog for more details)' + } + dialog .showMessageBox({ type: 'info', @@ -89,7 +103,8 @@ autoUpdater.on('update-available', async (info: UpdateInfo) => { v: info.version }) + '\n\n' + - updateLog, + displayLog + + truncatedNote, checkboxLabel: T('NO_MORE_NOTICE'), checkboxChecked: false })