1. 修复MJ设置初始化问题
2. 添加MJ本地代理模式,可以本地部署的代理模式
This commit is contained in:
2025-04-02 19:52:57 +08:00
parent 927dd14574
commit c43abd6908
30 changed files with 1341 additions and 686 deletions
@@ -31,6 +31,7 @@ export class MJSettingService extends BaseSoftWareService {
return MJSettingService.instance
}
/**
* 初始化数据
*/
@@ -302,6 +303,9 @@ export class MJSettingService extends BaseSoftWareService {
if (remoteMjQuery?.accountId) {
remoteMjSettings = this.realm.objects('RemoteMJ').filtered('accountId = $0', remoteMjQuery.accountId)
}
if (remoteMjQuery?.type) {
remoteMjSettings = this.realm.objects('RemoteMJ').filtered('type = $0', remoteMjQuery.type)
}
let resRemoteMj = Array.from(remoteMjSettings).map((remoteMj) => {
return {
...remoteMj
@@ -463,7 +467,6 @@ export class MJSettingService extends BaseSoftWareService {
*/
GetMjSetting() {
try {
let res = this.realm.objects('Options').filtered(`key = "${OptionKeyName.MJ_GlobalSetting}"`);
let mjSetting: OptionModel.OptionItem | null = null;
@@ -170,6 +170,14 @@ const migration = (oldRealm: Realm, newRealm: Realm) => {
}
if (oldRealm.schemaVersion < 25) {
}
if (oldRealm.schemaVersion < 26) {
newRealm.write(() => {
const newSoftwares = newRealm.objects('RemoteMJ')
for (let software of newSoftwares) {
software.type = "remote" // 默认都是启用的;
}
})
}
}
export class BaseSoftWareService extends BaseService {
@@ -210,7 +218,7 @@ export class BaseSoftWareService extends BaseService {
OptionsModel
],
path: dbPath,
schemaVersion: 25, // 当前版本号
schemaVersion: 26, // 当前版本号
migration: migration
}
// 判断当前全局是不是又当前这个