chore: make stripeAgeCheck not type undefined

This commit is contained in:
Marie 2024-08-29 18:41:32 +02:00
parent b3b5872e3e
commit b60dd15568
No known key found for this signature in database
GPG Key ID: 56569BBE47D2C828
6 changed files with 15 additions and 15 deletions

View File

@ -297,11 +297,11 @@ checkActivityPubGetSignature: false
# downloadTimeout: 30
# maxFileSize: 262144000
# enable stripe identity for ID verification
#stripeAgeCheck:
# enabled: true
# key: sk_
# hookKey: whsec_
# Stripe identity for ID verification
stripeAgeCheck:
enabled: false
key: sk_
hookKey: whsec_
# Upload or download file size limits (bytes)
#maxFileSize: 262144000

View File

@ -312,11 +312,11 @@ checkActivityPubGetSignature: false
# downloadTimeout: 30
# maxFileSize: 262144000
# enable stripe identity for ID verification
#stripeAgeCheck:
# enabled: true
# key: sk_
# hookKey: whsec_
# Stripe identity for ID verification
stripeAgeCheck:
enabled: false
key: sk_
hookKey: whsec_
# PID File of master process
#pidFile: /tmp/misskey.pid

View File

@ -108,7 +108,7 @@ type Source = {
maxFileSize: number;
};
stripeAgeCheck?: {
stripeAgeCheck: {
enabled: boolean;
key: string;
hookKey: string;
@ -207,7 +207,7 @@ export type Config = {
enabled: boolean | undefined;
key: string;
hookKey: string;
} | undefined;
};
pidFile: string;
};

View File

@ -112,7 +112,7 @@ export class ServerService implements OnApplicationShutdown {
fastify.register(this.fileServerService.createServer);
fastify.register(this.activityPubServerService.createServer);
// only enable stripe webhook if verification is enabled
if (this.config.stripeAgeCheck?.enabled) fastify.register(this.stripeHookServerService.createServer, { prefix: '/stripe' });
if (this.config.stripeAgeCheck.enabled) fastify.register(this.stripeHookServerService.createServer, { prefix: '/stripe' });
fastify.register(this.nodeinfoServerService.createServer);
fastify.register(this.wellKnownServerService.createServer);
fastify.register(this.oauth2ProviderService.createServer, { prefix: '/oauth' });

View File

@ -41,7 +41,7 @@ export class StripeHookServerService {
request: FastifyRequest,
reply: FastifyReply,
) {
if (!this.config.stripeAgeCheck) return reply.code(400);
if (!this.config.stripeAgeCheck.enabled) return reply.code(400);
const stripe = new Stripe(this.config.stripeAgeCheck.key);

View File

@ -53,7 +53,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
private config: Config,
) {
super(meta, paramDef, async (ps, me) => {
if (!this.config.stripeAgeCheck?.enabled) throw new ApiError(meta.errors.stripeIsDisabled);
if (!this.config.stripeAgeCheck.enabled) throw new ApiError(meta.errors.stripeIsDisabled);
const userProfile = await this.usersRepository.findOne({
where: {