mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-03 23:14:13 +00:00 
			
		
		
		
	Create type definition for 'recaptcha-promise' (#4068)
This commit is contained in:
		
							parent
							
								
									ceda3dd72a
								
							
						
					
					
						commit
						ce576dea8f
					
				
					 2 changed files with 17 additions and 2 deletions
				
			
		
							
								
								
									
										16
									
								
								src/@types/recaptcha-promise.d.ts
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								src/@types/recaptcha-promise.d.ts
									
										
									
									
										vendored
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,16 @@
 | 
			
		|||
declare module 'recaptcha-promise' {
 | 
			
		||||
	interface IVerifyOptions {
 | 
			
		||||
		secret_key?: string;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	interface IVerify {
 | 
			
		||||
		(response: string, remoteAddress?: string): Promise<boolean>;
 | 
			
		||||
		init(options: IVerifyOptions): IVerify;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	namespace recaptchaPromise {} // Hack
 | 
			
		||||
 | 
			
		||||
	const verify: IVerify;
 | 
			
		||||
 | 
			
		||||
	export = verify;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -8,14 +8,13 @@ import Meta from '../../../models/meta';
 | 
			
		|||
import RegistrationTicket from '../../../models/registration-tickets';
 | 
			
		||||
import usersChart from '../../../chart/users';
 | 
			
		||||
import fetchMeta from '../../../misc/fetch-meta';
 | 
			
		||||
import * as recaptcha from 'recaptcha-promise';
 | 
			
		||||
 | 
			
		||||
export default async (ctx: Koa.BaseContext) => {
 | 
			
		||||
	const body = ctx.request.body as any;
 | 
			
		||||
 | 
			
		||||
	const instance = await fetchMeta();
 | 
			
		||||
 | 
			
		||||
	const recaptcha = require('recaptcha-promise');
 | 
			
		||||
 | 
			
		||||
	// Verify recaptcha
 | 
			
		||||
	// ただしテスト時はこの機構は障害となるため無効にする
 | 
			
		||||
	if (process.env.NODE_ENV !== 'test' && instance.enableRecaptcha) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue