🐛 Fix(custom): truncate update log for better readability in dialog

This commit is contained in:
Kuingsmile
2025-06-30 17:10:18 +08:00
parent 4ac24c8ef8
commit 9084a30e8d

View File

@@ -79,6 +79,20 @@ autoUpdater.on('update-available', async (info: UpdateInfo) => {
} catch (e: any) { } catch (e: any) {
logger.error(e) 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 dialog
.showMessageBox({ .showMessageBox({
type: 'info', type: 'info',
@@ -89,7 +103,8 @@ autoUpdater.on('update-available', async (info: UpdateInfo) => {
v: info.version v: info.version
}) + }) +
'\n\n' + '\n\n' +
updateLog, displayLog +
truncatedNote,
checkboxLabel: T('NO_MORE_NOTICE'), checkboxLabel: T('NO_MORE_NOTICE'),
checkboxChecked: false checkboxChecked: false
}) })