chore: apply suggestions
This commit is contained in:
parent
58c8c00376
commit
ed95e8168c
|
@ -8,11 +8,11 @@ export class idCheck1724044488000 {
|
|||
|
||||
async up(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "user" ADD "idCheckRequired" boolean NOT NULL DEFAULT false`);
|
||||
await queryRunner.query(`ALTER TABLE "user" ADD "idVerified" boolean NOT NULL DEFAULT false`);
|
||||
await queryRunner.query(`ALTER TABLE "user" ADD "idVerified" boolean NOT NULL DEFAULT false`);
|
||||
}
|
||||
|
||||
async down(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "idCheckRequired"`);
|
||||
await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "idVerified"`);
|
||||
await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "idVerified"`);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -478,5 +478,6 @@ function applyEnvOverrides(config: Source) {
|
|||
_apply_top([['outgoingAddress', 'outgoingAddressFamily', 'proxy', 'proxySmtp', 'mediaProxy', 'proxyRemoteFiles', 'videoThumbnailGenerator']]);
|
||||
_apply_top([['maxFileSize', 'maxNoteLength', 'pidFile']]);
|
||||
_apply_top(['import', ['downloadTimeout', 'maxFileSize']]);
|
||||
_apply_top(['stripeAgeCheck', ['enabled', 'key', 'hookKey']]);
|
||||
_apply_top([['signToActivityPubGet', 'checkActivityPubGetSignature']]);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ export class StripeHookServerService {
|
|||
|
||||
private loggerService: LoggerService,
|
||||
) {
|
||||
//this.createServer = this.createServer.bind(this);
|
||||
this.logger = this.loggerService.getLogger('stripe', 'gray');
|
||||
}
|
||||
|
||||
|
@ -43,23 +42,23 @@ export class StripeHookServerService {
|
|||
) {
|
||||
if (!this.config.stripeAgeCheck.enabled) return reply.code(400);
|
||||
|
||||
const stripe = new Stripe(this.config.stripeAgeCheck.key);
|
||||
|
||||
if (request.rawBody == null) {
|
||||
// Bad request
|
||||
reply.code(400);
|
||||
return;
|
||||
}
|
||||
|
||||
const body = request.rawBody;
|
||||
|
||||
const headers = request.headers;
|
||||
|
||||
function error(status: number, error: { id: string }) {
|
||||
reply.code(status);
|
||||
return { error };
|
||||
}
|
||||
|
||||
const stripe = new Stripe(this.config.stripeAgeCheck.key);
|
||||
|
||||
const body = request.rawBody;
|
||||
|
||||
const headers = request.headers;
|
||||
|
||||
let event;
|
||||
|
||||
// Verify the event came from Stripe
|
||||
|
@ -68,9 +67,8 @@ export class StripeHookServerService {
|
|||
event = stripe.webhooks.constructEvent(body, sig, this.config.stripeAgeCheck.hookKey);
|
||||
} catch (err: any) {
|
||||
// On error, log and return the error message
|
||||
console.log(`❌ Error message: ${err.message}`);
|
||||
reply.code(400)
|
||||
return `Webhook Error: ${err.message}`;
|
||||
this.logger.error(`❌ Stripe Error`, err);
|
||||
return reply.code(400).send(`Webhook Error: ${err.message}`);
|
||||
}
|
||||
|
||||
// Successfully constructed event
|
||||
|
@ -104,7 +102,7 @@ export class StripeHookServerService {
|
|||
}
|
||||
}
|
||||
|
||||
reply.code(200)
|
||||
reply.code(200);
|
||||
return { received: true };
|
||||
|
||||
// never get here
|
||||
|
|
|
@ -61,11 +61,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
}
|
||||
});
|
||||
|
||||
const stripe = new Stripe(this.config.stripeAgeCheck.key);
|
||||
|
||||
if (userProfile == null) {
|
||||
throw new ApiError(meta.errors.userIsDeleted);
|
||||
}
|
||||
};
|
||||
|
||||
const stripe = new Stripe(this.config.stripeAgeCheck.key);
|
||||
|
||||
const verificationSession = await stripe.identity.verificationSessions.create({
|
||||
type: 'document',
|
||||
|
|
|
@ -72,7 +72,7 @@ const withRenotes = computed<boolean>({
|
|||
});
|
||||
|
||||
if ($i && $i.idCheckRequired) {
|
||||
const { dispose } = os.popup(defineAsyncComponent(() => import('@/components/SkConfirmIdDialog.vue')), {
|
||||
const { dispose } = os.popup(defineAsyncComponent(() => import('@/components/SkStripeIdDialog.vue')), {
|
||||
}, {
|
||||
closed: () => dispose(),
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue