upd: add temporary block to certain api endpoints

This will be only temporary till a better solution is available
This commit is contained in:
Marie 2024-09-14 22:32:36 +02:00
parent 2c241f8d3b
commit 28ec785c50
No known key found for this signature in database
GPG key ID: 7ADF6C9CD9A28555
7 changed files with 65 additions and 0 deletions

View file

@ -18,6 +18,7 @@ import { MetaService } from '@/core/MetaService.js';
import { MiLocalUser } from '@/models/User.js';
import { FanoutTimelineEndpointService } from '@/core/FanoutTimelineEndpointService.js';
import { ApiError } from '../../error.js';
import type { Config } from '@/config.js';
export const meta = {
tags: ['notes'],
@ -70,6 +71,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
@Inject(DI.notesRepository)
private notesRepository: NotesRepository,
@Inject(DI.config)
private config: Config,
private noteEntityService: NoteEntityService,
private roleService: RoleService,
private activeUsersChart: ActiveUsersChart,
@ -88,6 +92,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
throw new ApiError(meta.errors.ltlDisabled);
}
if (this.config.stripeAgeCheck.enabled && me && me.idCheckRequired || this.config.stripeAgeCheck.required && me && !me.idVerified || this.config.stripeAgeCheck.required && !me) {
// return no notes until we can figure out a way to simulate notes
return [];
}
if (ps.withReplies && ps.withFiles) throw new ApiError(meta.errors.bothWithRepliesAndWithFiles);
const serverSettings = await this.metaService.fetch();