add setting to disable proxy account (resolves #766)
This commit is contained in:
parent
b124c39ed2
commit
8dce293dff
9 changed files with 68 additions and 5 deletions
|
|
@ -6,7 +6,7 @@
|
|||
import { Inject, Injectable, OnApplicationShutdown, OnModuleInit } from '@nestjs/common';
|
||||
import * as Redis from 'ioredis';
|
||||
import { ModuleRef } from '@nestjs/core';
|
||||
import type { UserListMembershipsRepository } from '@/models/_.js';
|
||||
import type { MiMeta, UserListMembershipsRepository } from '@/models/_.js';
|
||||
import type { MiUser } from '@/models/User.js';
|
||||
import type { MiUserList } from '@/models/UserList.js';
|
||||
import type { MiUserListMembership } from '@/models/UserListMembership.js';
|
||||
|
|
@ -40,6 +40,9 @@ export class UserListService implements OnApplicationShutdown, OnModuleInit {
|
|||
@Inject(DI.userListMembershipsRepository)
|
||||
private userListMembershipsRepository: UserListMembershipsRepository,
|
||||
|
||||
@Inject(DI.meta)
|
||||
private readonly meta: MiMeta,
|
||||
|
||||
private userEntityService: UserEntityService,
|
||||
private idService: IdService,
|
||||
private globalEventService: GlobalEventService,
|
||||
|
|
@ -110,7 +113,7 @@ export class UserListService implements OnApplicationShutdown, OnModuleInit {
|
|||
this.globalEventService.publishUserListStream(list.id, 'userAdded', await this.userEntityService.pack(target));
|
||||
|
||||
// このインスタンス内にこのリモートユーザーをフォローしているユーザーがいなくても投稿を受け取るためにダミーのユーザーがフォローしたということにする
|
||||
if (this.userEntityService.isRemoteUser(target)) {
|
||||
if (this.userEntityService.isRemoteUser(target) && this.meta.enableProxyAccount) {
|
||||
const proxy = await this.systemAccountService.fetch('proxy');
|
||||
this.queueService.createFollowJob([{ from: { id: proxy.id }, to: { id: target.id } }]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -759,4 +759,9 @@ export class MiMeta {
|
|||
default: 'always',
|
||||
})
|
||||
public allowUnsignedFetch: InstanceUnsignedFetchOption;
|
||||
|
||||
@Column('boolean', {
|
||||
default: false,
|
||||
})
|
||||
public enableProxyAccount: boolean;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -601,6 +601,10 @@ export const meta = {
|
|||
enum: instanceUnsignedFetchOptions,
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
enableProxyAccount: {
|
||||
type: 'boolean',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
|
@ -762,6 +766,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
federationHosts: instance.federationHosts,
|
||||
hasLegacyAuthFetchSetting: config.checkActivityPubGetSignature != null,
|
||||
allowUnsignedFetch: instance.allowUnsignedFetch,
|
||||
enableProxyAccount: instance.enableProxyAccount,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -210,6 +210,10 @@ export const paramDef = {
|
|||
enum: instanceUnsignedFetchOptions,
|
||||
nullable: false,
|
||||
},
|
||||
enableProxyAccount: {
|
||||
type: 'boolean',
|
||||
nullable: false,
|
||||
},
|
||||
},
|
||||
required: [],
|
||||
} as const;
|
||||
|
|
@ -758,6 +762,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
set.allowUnsignedFetch = ps.allowUnsignedFetch;
|
||||
}
|
||||
|
||||
if (ps.enableProxyAccount !== undefined) {
|
||||
set.enableProxyAccount = ps.enableProxyAccount;
|
||||
}
|
||||
|
||||
const before = await this.metaService.fetch(true);
|
||||
|
||||
await this.metaService.update(set);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue