chore: make stripeAgeCheck not type undefined
This commit is contained in:
parent
b3b5872e3e
commit
b60dd15568
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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' });
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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: {
|
||||
|
|
Loading…
Reference in New Issue