Feat: マネージドなサービスで使えるように

オブジェクトストレージの設定を秘匿するように
Config で設定できます。

その他バグ修正
This commit is contained in:
mattyatea 2024-07-17 21:24:04 +09:00
parent c2cf3149ab
commit 9f5b0c3ca1
25 changed files with 599 additions and 386 deletions

View file

@ -21,6 +21,7 @@ import { bindThis } from '@/decorators.js';
import UsersChart from '@/core/chart/charts/users.js';
import { UtilityService } from '@/core/UtilityService.js';
import { MetaService } from '@/core/MetaService.js';
import type { Config } from '@/config.js';
@Injectable()
export class SignupService {
@ -34,6 +35,9 @@ export class SignupService {
@Inject(DI.usedUsernamesRepository)
private usedUsernamesRepository: UsedUsernamesRepository,
@Inject(DI.config)
private config: Config,
private utilityService: UtilityService,
private userEntityService: UserEntityService,
private idService: IdService,
@ -58,7 +62,9 @@ export class SignupService {
if (!this.userEntityService.validateLocalUsername(username)) {
throw new Error('INVALID_USERNAME');
}
if (this.config.maxLocalUsers !== -1 && await this.usersRepository.count({ where: { host: IsNull() } }) >= this.config.maxLocalUsers) {
throw new Error('MAX_LOCAL_USERS');
}
if (password != null && passwordHash == null) {
// Validate password
if (!this.userEntityService.validatePassword(password)) {