refactor: remove unnecessary logs

This commit is contained in:
kangfenmao 2024-08-25 21:37:13 +08:00
parent 93b32e8e21
commit de4f2599be
3 changed files with 4 additions and 11 deletions

View File

@ -50,7 +50,6 @@ export function registerIpc(mainWindow: BrowserWindow, app: Electron.App) {
// 触发检查更新(此方法用于被渲染线程调用,例如页面点击检查更新按钮来调用此方法) // 触发检查更新(此方法用于被渲染线程调用,例如页面点击检查更新按钮来调用此方法)
ipcMain.handle('check-for-update', async () => { ipcMain.handle('check-for-update', async () => {
autoUpdater.logger?.info('触发检查更新')
return { return {
currentVersion: autoUpdater.currentVersion, currentVersion: autoUpdater.currentVersion,
update: await autoUpdater.checkForUpdates() update: await autoUpdater.checkForUpdates()

View File

@ -17,11 +17,6 @@ export default class AppUpdater {
mainWindow.webContents.send('update-error', error) mainWindow.webContents.send('update-error', error)
}) })
// 检测是否需要更新
autoUpdater.on('checking-for-update', () => {
logger.info('正在检查更新……')
})
autoUpdater.on('update-available', (releaseInfo: UpdateInfo) => { autoUpdater.on('update-available', (releaseInfo: UpdateInfo) => {
autoUpdater.logger?.info('检测到新版本,确认是否下载') autoUpdater.logger?.info('检测到新版本,确认是否下载')
mainWindow.webContents.send('update-available', releaseInfo) mainWindow.webContents.send('update-available', releaseInfo)
@ -59,7 +54,6 @@ export default class AppUpdater {
// 检测到不需要更新时 // 检测到不需要更新时
autoUpdater.on('update-not-available', () => { autoUpdater.on('update-not-available', () => {
logger.info('现在使用的就是最新版本,不用更新')
mainWindow.webContents.send('update-not-available') mainWindow.webContents.send('update-not-available')
}) })

View File

@ -9,7 +9,7 @@ export async function updateUserDataPath() {
const oldPath = currentPath.replace('CherryStudio', 'cherry-studio') const oldPath = currentPath.replace('CherryStudio', 'cherry-studio')
if (fs.existsSync(oldPath)) { if (fs.existsSync(oldPath)) {
Logger.log('更新 userData 路径') Logger.log('Update userData path')
try { try {
if (process.platform === 'win32') { if (process.platform === 'win32') {
@ -20,15 +20,15 @@ export async function updateUserDataPath() {
// 其他系统:直接更新 // 其他系统:直接更新
fs.rmSync(currentPath, { recursive: true, force: true }) fs.rmSync(currentPath, { recursive: true, force: true })
fs.renameSync(oldPath, currentPath) fs.renameSync(oldPath, currentPath)
Logger.log(`目录已重命名: ${currentPath}`) Logger.log(`Directory renamed: ${currentPath}`)
await promptRestart() await promptRestart()
} }
} catch (error: any) { } catch (error: any) {
Logger.error('更新 userData 路径时出错:', error) Logger.error('Error updating userData path:', error)
dialog.showErrorBox('错误', `更新用户数据目录时发生错误: ${error.message}`) dialog.showErrorBox('错误', `更新用户数据目录时发生错误: ${error.message}`)
} }
} else { } else {
Logger.log('userData 路径不需要更新') Logger.log('userData path does not need to be updated')
} }
} }