|
@@ -159,6 +159,7 @@ export class WebdavManager {
|
|
|
account.password = resultSet.getString(resultSet.getColumnIndex('password'));
|
|
account.password = resultSet.getString(resultSet.getColumnIndex('password'));
|
|
|
account.enableHttps = resultSet.getLong(resultSet.getColumnIndex('enableHttps')) === 1;
|
|
account.enableHttps = resultSet.getLong(resultSet.getColumnIndex('enableHttps')) === 1;
|
|
|
account.coverPath = resultSet.getString(resultSet.getColumnIndex('coverPath'));
|
|
account.coverPath = resultSet.getString(resultSet.getColumnIndex('coverPath'));
|
|
|
|
|
+ account.webType = resultSet.getLong(resultSet.getColumnIndex('webType'));
|
|
|
account.isActivate = resultSet.getLong(resultSet.getColumnIndex('isActivate')) === 1;
|
|
account.isActivate = resultSet.getLong(resultSet.getColumnIndex('isActivate')) === 1;
|
|
|
|
|
|
|
|
resultSet.close();
|
|
resultSet.close();
|
|
@@ -375,6 +376,7 @@ export class WebdavManager {
|
|
|
account.password = resultSet.getString(resultSet.getColumnIndex('password'));
|
|
account.password = resultSet.getString(resultSet.getColumnIndex('password'));
|
|
|
account.enableHttps = resultSet.getLong(resultSet.getColumnIndex('enableHttps')) === 1;
|
|
account.enableHttps = resultSet.getLong(resultSet.getColumnIndex('enableHttps')) === 1;
|
|
|
account.coverPath = resultSet.getString(resultSet.getColumnIndex('coverPath'));
|
|
account.coverPath = resultSet.getString(resultSet.getColumnIndex('coverPath'));
|
|
|
|
|
+ account.webType = resultSet.getLong(resultSet.getColumnIndex('webType'));
|
|
|
account.isActivate = resultSet.getLong(resultSet.getColumnIndex('isActivate')) === 1;
|
|
account.isActivate = resultSet.getLong(resultSet.getColumnIndex('isActivate')) === 1;
|
|
|
|
|
|
|
|
resultSet.close();
|
|
resultSet.close();
|
|
@@ -407,7 +409,8 @@ export class WebdavManager {
|
|
|
account TEXT,
|
|
account TEXT,
|
|
|
password TEXT,
|
|
password TEXT,
|
|
|
enableHttps INTEGER DEFAULT 0,
|
|
enableHttps INTEGER DEFAULT 0,
|
|
|
- coverPath TEXT
|
|
|
|
|
|
|
+ coverPath TEXT,
|
|
|
|
|
+ webType INTEGER DEFAULT 0
|
|
|
)`;
|
|
)`;
|
|
|
|
|
|
|
|
return this.dataBaseUtil.executeSql(createTableSql)
|
|
return this.dataBaseUtil.executeSql(createTableSql)
|
|
@@ -436,6 +439,18 @@ export class WebdavManager {
|
|
|
// 如果添加字段失败(可能字段已存在),记录但不阻止应用启动
|
|
// 如果添加字段失败(可能字段已存在),记录但不阻止应用启动
|
|
|
Logger.info(TAG, 'coverPath字段可能已存在或添加失败,继续正常运行');
|
|
Logger.info(TAG, 'coverPath字段可能已存在或添加失败,继续正常运行');
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ // 添加webType字段,用于标识WebDAV账户类型
|
|
|
|
|
+ Logger.info(TAG, '检查数据库表结构,尝试添加webType字段...');
|
|
|
|
|
+ const addWebTypeColumnSql = `ALTER TABLE ${this.webDavTable} ADD COLUMN webType INTEGER DEFAULT 0`;
|
|
|
|
|
+
|
|
|
|
|
+ await this.dataBaseUtil.executeSql(addWebTypeColumnSql);
|
|
|
|
|
+ Logger.info(TAG, 'webType字段添加成功,数据库升级完成');
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ // 如果添加字段失败(可能字段已存在),记录但不阻止应用启动
|
|
|
|
|
+ Logger.info(TAG, 'webType字段可能已存在或添加失败,继续正常运行');
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 从数据库查询所有账户
|
|
// 从数据库查询所有账户
|
|
@@ -469,8 +484,9 @@ export class WebdavManager {
|
|
|
account.account = resultSet.getString(resultSet.getColumnIndex('account'));
|
|
account.account = resultSet.getString(resultSet.getColumnIndex('account'));
|
|
|
account.password = resultSet.getString(resultSet.getColumnIndex('password'));
|
|
account.password = resultSet.getString(resultSet.getColumnIndex('password'));
|
|
|
account.enableHttps = resultSet.getLong(resultSet.getColumnIndex('enableHttps')) === 1;
|
|
account.enableHttps = resultSet.getLong(resultSet.getColumnIndex('enableHttps')) === 1;
|
|
|
- // 设置coverPath为默认值undefined,稍后会尝试更新
|
|
|
|
|
|
|
+ // 设置coverPath和webType为默认值undefined,稍后会尝试更新
|
|
|
account.coverPath = undefined;
|
|
account.coverPath = undefined;
|
|
|
|
|
+ account.webType = 0;
|
|
|
|
|
|
|
|
this.webDavAccounts.push(account);
|
|
this.webDavAccounts.push(account);
|
|
|
}
|
|
}
|
|
@@ -528,7 +544,8 @@ export class WebdavManager {
|
|
|
account: string,
|
|
account: string,
|
|
|
password: string,
|
|
password: string,
|
|
|
enableHttps: boolean,
|
|
enableHttps: boolean,
|
|
|
- coverPath?: string
|
|
|
|
|
|
|
+ coverPath?: string,
|
|
|
|
|
+ webType: number = 0
|
|
|
): Promise<void> {
|
|
): Promise<void> {
|
|
|
try {
|
|
try {
|
|
|
const values: relationalStore.ValuesBucket = {
|
|
const values: relationalStore.ValuesBucket = {
|
|
@@ -545,7 +562,8 @@ export class WebdavManager {
|
|
|
'account': account,
|
|
'account': account,
|
|
|
'password': password,
|
|
'password': password,
|
|
|
'enableHttps': enableHttps ? 1 : 0,
|
|
'enableHttps': enableHttps ? 1 : 0,
|
|
|
- 'coverPath': coverPath || null
|
|
|
|
|
|
|
+ 'coverPath': coverPath || null,
|
|
|
|
|
+ 'webType': webType
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
await this.dataBaseUtil.insertData(this.webDavTable, values);
|
|
await this.dataBaseUtil.insertData(this.webDavTable, values);
|
|
@@ -578,7 +596,8 @@ export class WebdavManager {
|
|
|
'account': account.account,
|
|
'account': account.account,
|
|
|
'password': account.password,
|
|
'password': account.password,
|
|
|
'enableHttps': account.enableHttps ? 1 : 0,
|
|
'enableHttps': account.enableHttps ? 1 : 0,
|
|
|
- 'coverPath': account.coverPath || null
|
|
|
|
|
|
|
+ 'coverPath': account.coverPath || null,
|
|
|
|
|
+ 'webType': account.webType
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const predicates = new relationalStore.RdbPredicates(this.webDavTable);
|
|
const predicates = new relationalStore.RdbPredicates(this.webDavTable);
|