fix: rotate Wit.ai API keys for English challenges

Closes #130.
This commit is contained in:
dessant 2020-01-29 20:50:05 +02:00
parent 182a0aa5cf
commit e985b7d666
2 changed files with 12 additions and 2 deletions

View File

@ -15,6 +15,7 @@ import {
functionInContext,
getBrowser,
getPlatform,
getRandomInt,
arrayBufferToBase64
} from 'utils/common';
import {
@ -220,7 +221,11 @@ async function prepareAudio(audio) {
async function getWitSpeechApiKey(speechService, language) {
if (speechService === 'witSpeechApiDemo') {
return witApiKeys[language];
if (language === 'english') {
return witApiKeys[language][getRandomInt(1, 4) - 1];
} else {
return witApiKeys[language];
}
} else {
const {witSpeechApiKeys: apiKeys} = await storage.get(
'witSpeechApiKeys',

View File

@ -8,7 +8,12 @@ const witApiKeys = {
catalan: 'YBAZZV6ITGFD3C2QX7CANYQPMGUOI7RK',
chinese: 'KBBALJMRKYDJJDMC4NJ32VWCBKFJFIIU',
dutch: 'T43TEUNW4HDQFNUTIA3EYTTD4A22AS4H',
english: 'NVYD6ZUJMC26US5XS2ZJJ32EDZZ654TD',
english: [
'BQE4QJJNYC6JVTDULHYIZHQOQFWUVDCQ',
'EQAXGAJVZIMI3YMILN2XQZY7IWGUPKGL',
'AA3LFNYPDNXX4MUDQQJNLT74YFRQ3M6F',
'DRTXENV66YE44PRYOJGWPX2BPGZNPYTQ'
],
finnish: '3GOWLMYD7DUY72XTPJW6QTVZSK2QEAPT',
french: 'JLNITTO2D4KMEOGQ6MTSN634ADK62VZ7',
german: 'LPVVXWRBFTVBOOHZAEJC3QRM6E3UMD7I',