mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-07 08:22:55 +08:00
🐛 Fix(custom): truncate update log for better readability in dialog
This commit is contained in:
@@ -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
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user