|
@@ -53,6 +53,7 @@ import ReqPermissionUtil from '../common/util/ReqPermissionUtil';
|
|
|
import { getRemoteDriveAccountLabel, getRemoteDriveDisplayLabel, getRemoteDriveProtocolLabel } from '../common/util/RemoteDriveLabel';
|
|
import { getRemoteDriveAccountLabel, getRemoteDriveDisplayLabel, getRemoteDriveProtocolLabel } from '../common/util/RemoteDriveLabel';
|
|
|
import { RemoteDriveType } from '../common/enums/RemoteDriveType';
|
|
import { RemoteDriveType } from '../common/enums/RemoteDriveType';
|
|
|
import { NavidromePage } from '../view/NavidromePage';
|
|
import { NavidromePage } from '../view/NavidromePage';
|
|
|
|
|
+import { ServerLogUtil } from '../common/util/ServerLogUtil';
|
|
|
|
|
|
|
|
// import { FFmpeg, FFProgressMessageParser } from '@sj/ffmpeg';
|
|
// import { FFmpeg, FFProgressMessageParser } from '@sj/ffmpeg';
|
|
|
|
|
|
|
@@ -309,7 +310,7 @@ struct NewIndex {
|
|
|
|
|
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- console.log('getHiCarStatus isHiCarStatus:' + this.isHiCarStatus)
|
|
|
|
|
|
|
+ this.logHiCar('info', `getHiCarStatus isHiCarStatus=${this.isHiCarStatus}`)
|
|
|
if(this.isHiCarStatus||this.isBigScreen()){
|
|
if(this.isHiCarStatus||this.isBigScreen()){
|
|
|
this.getUIContext()?.animateTo({ duration: 555 }, () => {
|
|
this.getUIContext()?.animateTo({ duration: 555 }, () => {
|
|
|
this.isShowDrawer = true
|
|
this.isShowDrawer = true
|
|
@@ -1442,9 +1443,11 @@ struct NewIndex {
|
|
|
// 重新加载网盘账户列表
|
|
// 重新加载网盘账户列表
|
|
|
await this.loadWebDavAccounts()
|
|
await this.loadWebDavAccounts()
|
|
|
LogUtil.info('heanup NewIndex', '网盘账户删除成功:', account.name)
|
|
LogUtil.info('heanup NewIndex', '网盘账户删除成功:', account.name)
|
|
|
|
|
+ this.logAccount('info', `网盘账户删除成功: ${account.name}`)
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
LogUtil.error('heanup NewIndex', `删除网盘账户失败: ${(error as Error).message}`)
|
|
LogUtil.error('heanup NewIndex', `删除网盘账户失败: ${(error as Error).message}`)
|
|
|
ToastUtil.showToast('删除失败')
|
|
ToastUtil.showToast('删除失败')
|
|
|
|
|
+ this.logAccount('error', `删除网盘账户失败: ${(error as Error).message}`)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1452,6 +1455,7 @@ struct NewIndex {
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
LogUtil.error('heanup NewIndex', `删除网盘账户操作失败: ${(error as Error).message}`)
|
|
LogUtil.error('heanup NewIndex', `删除网盘账户操作失败: ${(error as Error).message}`)
|
|
|
ToastUtil.showToast('操作失败')
|
|
ToastUtil.showToast('操作失败')
|
|
|
|
|
+ this.logAccount('error', `删除网盘账户操作失败: ${(error as Error).message}`)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1582,6 +1586,40 @@ struct NewIndex {
|
|
|
/**
|
|
/**
|
|
|
* 初始化WebDAV管理器
|
|
* 初始化WebDAV管理器
|
|
|
*/
|
|
*/
|
|
|
|
|
+ private logAccount(level: 'info' | 'warn' | 'error', message: string) {
|
|
|
|
|
+ const tag = 'AccountCenter';
|
|
|
|
|
+ switch (level) {
|
|
|
|
|
+ case 'info':
|
|
|
|
|
+ void ServerLogUtil.info(tag, message);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 'warn':
|
|
|
|
|
+ void ServerLogUtil.warn(tag, message);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 'error':
|
|
|
|
|
+ void ServerLogUtil.error(tag, message);
|
|
|
|
|
+ break;
|
|
|
|
|
+ default:
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private logHiCar(level: 'info' | 'warn' | 'error', message: string) {
|
|
|
|
|
+ const tag = 'HiCarEntry';
|
|
|
|
|
+ switch (level) {
|
|
|
|
|
+ case 'info':
|
|
|
|
|
+ void ServerLogUtil.info(tag, message);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 'warn':
|
|
|
|
|
+ void ServerLogUtil.warn(tag, message);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 'error':
|
|
|
|
|
+ void ServerLogUtil.error(tag, message);
|
|
|
|
|
+ break;
|
|
|
|
|
+ default:
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
async initWebDavManager() {
|
|
async initWebDavManager() {
|
|
|
try {
|
|
try {
|
|
|
// 设置WebDAV管理器的上下文
|
|
// 设置WebDAV管理器的上下文
|
|
@@ -1593,6 +1631,7 @@ struct NewIndex {
|
|
|
// 订阅WebDAV管理器事件
|
|
// 订阅WebDAV管理器事件
|
|
|
this.webdavManager.subscribe((event: string) => {
|
|
this.webdavManager.subscribe((event: string) => {
|
|
|
LogUtil.info('heanup NewIndex', '收到WebDAV事件:', event)
|
|
LogUtil.info('heanup NewIndex', '收到WebDAV事件:', event)
|
|
|
|
|
+ this.logAccount('info', `收到WebDAV事件: ${event}`)
|
|
|
if (event === 'QueryAccountsSucceed') {
|
|
if (event === 'QueryAccountsSucceed') {
|
|
|
this.webDavAccounts = this.webdavManager.getAllWebDavAccounts().slice()
|
|
this.webDavAccounts = this.webdavManager.getAllWebDavAccounts().slice()
|
|
|
}
|
|
}
|
|
@@ -1602,8 +1641,10 @@ struct NewIndex {
|
|
|
// await this.loadWebDavAccounts()
|
|
// await this.loadWebDavAccounts()
|
|
|
|
|
|
|
|
LogUtil.info('heanup NewIndex', 'WebDAV管理器初始化成功')
|
|
LogUtil.info('heanup NewIndex', 'WebDAV管理器初始化成功')
|
|
|
|
|
+ this.logAccount('info', 'WebDAV管理器初始化成功')
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
LogUtil.error('heanup NewIndex', `初始化WebDAV管理器失败: ${(error as Error).message}`)
|
|
LogUtil.error('heanup NewIndex', `初始化WebDAV管理器失败: ${(error as Error).message}`)
|
|
|
|
|
+ this.logAccount('error', `初始化WebDAV管理器失败: ${(error as Error).message}`)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1613,14 +1654,17 @@ struct NewIndex {
|
|
|
async loadWebDavAccounts() {
|
|
async loadWebDavAccounts() {
|
|
|
try {
|
|
try {
|
|
|
LogUtil.info('heanup NewIndex', '开始加载网盘账户列表')
|
|
LogUtil.info('heanup NewIndex', '开始加载网盘账户列表')
|
|
|
|
|
+ this.logAccount('info', '开始加载网盘账户列表')
|
|
|
await this.webdavManager.queryWebDavAccountsFromDB()
|
|
await this.webdavManager.queryWebDavAccountsFromDB()
|
|
|
// 强制触发UI更新
|
|
// 强制触发UI更新
|
|
|
this.webDavAccounts = this.webdavManager.getAllWebDavAccounts().slice()
|
|
this.webDavAccounts = this.webdavManager.getAllWebDavAccounts().slice()
|
|
|
this.isRefreshing = false
|
|
this.isRefreshing = false
|
|
|
LogUtil.info('heanup NewIndex', `成功加载 ${this.webDavAccounts.length} 个网盘账户`)
|
|
LogUtil.info('heanup NewIndex', `成功加载 ${this.webDavAccounts.length} 个网盘账户`)
|
|
|
|
|
+ this.logAccount('info', `成功加载 ${this.webDavAccounts.length} 个网盘账户`)
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
this.isRefreshing = false
|
|
this.isRefreshing = false
|
|
|
LogUtil.error('heanup NewIndex', `加载网盘账户列表失败: ${(error as Error).message}`)
|
|
LogUtil.error('heanup NewIndex', `加载网盘账户列表失败: ${(error as Error).message}`)
|
|
|
|
|
+ this.logAccount('error', `加载网盘账户列表失败: ${(error as Error).message}`)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1630,6 +1674,7 @@ struct NewIndex {
|
|
|
selectWebDavAccount(account: WebDavAccount) {
|
|
selectWebDavAccount(account: WebDavAccount) {
|
|
|
try {
|
|
try {
|
|
|
LogUtil.info('heanup NewIndex', '选择网盘账户:', account.name)
|
|
LogUtil.info('heanup NewIndex', '选择网盘账户:', account.name)
|
|
|
|
|
+ this.logAccount('info', `选择网盘账户: ${account.name} (id=${account.id ?? 'unknown'})`)
|
|
|
// 如果账户未激活,先激活它
|
|
// 如果账户未激活,先激活它
|
|
|
if (!account.isActivate) {
|
|
if (!account.isActivate) {
|
|
|
// 先将所有账户设为未激活
|
|
// 先将所有账户设为未激活
|
|
@@ -1642,11 +1687,12 @@ struct NewIndex {
|
|
|
// 更新数据库中的激活状态
|
|
// 更新数据库中的激活状态
|
|
|
this.webdavManager.editAccount(account).then(() => {
|
|
this.webdavManager.editAccount(account).then(() => {
|
|
|
LogUtil.info('heanup NewIndex', '网盘账户编辑成功:', account.name)
|
|
LogUtil.info('heanup NewIndex', '网盘账户编辑成功:', account.name)
|
|
|
-
|
|
|
|
|
|
|
+ this.logAccount('info', `网盘账户编辑成功: ${account.name}`)
|
|
|
|
|
|
|
|
}).catch((error: Error) => {
|
|
}).catch((error: Error) => {
|
|
|
LogUtil.error('heanup NewIndex', `编辑网盘账户失败: ${error.message}`)
|
|
LogUtil.error('heanup NewIndex', `编辑网盘账户失败: ${error.message}`)
|
|
|
ToastUtil.showToast('编辑账户失败')
|
|
ToastUtil.showToast('编辑账户失败')
|
|
|
|
|
+ this.logAccount('error', `编辑网盘账户失败: ${error.message}`)
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
this.selectedAccount = account
|
|
this.selectedAccount = account
|
|
@@ -1661,6 +1707,7 @@ struct NewIndex {
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
LogUtil.error('heanup NewIndex', `选择网盘账户失败: ${(error as Error).message}`)
|
|
LogUtil.error('heanup NewIndex', `选择网盘账户失败: ${(error as Error).message}`)
|
|
|
ToastUtil.showToast('选择账户失败')
|
|
ToastUtil.showToast('选择账户失败')
|
|
|
|
|
+ this.logAccount('error', `选择网盘账户失败: ${(error as Error).message}`)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1704,9 +1751,11 @@ struct NewIndex {
|
|
|
// 重新加载网盘账户列表,观察着模式去更新了,所以这里不需要更新,先注释掉
|
|
// 重新加载网盘账户列表,观察着模式去更新了,所以这里不需要更新,先注释掉
|
|
|
// this.loadWebDavAccounts()
|
|
// this.loadWebDavAccounts()
|
|
|
LogUtil.info('heanup NewIndex', '网盘账户修改成功:', account.name)
|
|
LogUtil.info('heanup NewIndex', '网盘账户修改成功:', account.name)
|
|
|
|
|
+ this.logAccount('info', `网盘账户修改成功: ${account.name}`)
|
|
|
}).catch((error: Error) => {
|
|
}).catch((error: Error) => {
|
|
|
LogUtil.error('heanup NewIndex', `修改网盘账户失败: ${error.message}`)
|
|
LogUtil.error('heanup NewIndex', `修改网盘账户失败: ${error.message}`)
|
|
|
ToastUtil.showToast('修改失败')
|
|
ToastUtil.showToast('修改失败')
|
|
|
|
|
+ this.logAccount('error', `修改网盘账户失败: ${error.message}`)
|
|
|
})
|
|
})
|
|
|
} else {
|
|
} else {
|
|
|
// 添加模式:创建新账户
|
|
// 添加模式:创建新账户
|
|
@@ -1734,9 +1783,11 @@ struct NewIndex {
|
|
|
// 重新加载网盘账户列表 观察着模式去更新了,所以这里不需要更新,先注释掉
|
|
// 重新加载网盘账户列表 观察着模式去更新了,所以这里不需要更新,先注释掉
|
|
|
// this.loadWebDavAccounts()
|
|
// this.loadWebDavAccounts()
|
|
|
LogUtil.info('heanup NewIndex', '网盘账户添加成功:', account.name)
|
|
LogUtil.info('heanup NewIndex', '网盘账户添加成功:', account.name)
|
|
|
|
|
+ this.logAccount('info', `网盘账户添加成功: ${account.name}`)
|
|
|
}).catch((error: Error) => {
|
|
}).catch((error: Error) => {
|
|
|
LogUtil.error('heanup NewIndex', `添加网盘账户失败: ${error.message}`)
|
|
LogUtil.error('heanup NewIndex', `添加网盘账户失败: ${error.message}`)
|
|
|
ToastUtil.showToast('添加失败')
|
|
ToastUtil.showToast('添加失败')
|
|
|
|
|
+ this.logAccount('error', `添加网盘账户失败: ${error.message}`)
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|