V 3.3.3
1. 修复MJ设置初始化问题 2. 添加MJ本地代理模式,可以本地部署的代理模式
This commit is contained in:
@@ -53,6 +53,7 @@ export class RemoteMJModel extends Realm.Object<RemoteMJModel> {
|
||||
updateTime: Date
|
||||
version: string
|
||||
blockMessage?: string
|
||||
type?: string
|
||||
static schema: ObjectSchema = {
|
||||
name: 'RemoteMJ',
|
||||
properties: {
|
||||
@@ -73,7 +74,8 @@ export class RemoteMJModel extends Realm.Object<RemoteMJModel> {
|
||||
createTime: 'date',
|
||||
updateTime: 'date',
|
||||
version: 'string',
|
||||
blockMessage: 'string?'
|
||||
blockMessage: 'string?',
|
||||
type: "string?"
|
||||
},
|
||||
// 主键为_id
|
||||
primaryKey: 'id'
|
||||
|
||||
@@ -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
|
||||
}
|
||||
// 判断当前全局是不是又当前这个
|
||||
|
||||
Reference in New Issue
Block a user