Skip to content

Commit

Permalink
fix: remove demo speech service
Browse files Browse the repository at this point in the history
The service is unreliable.
  • Loading branch information
dessant committed Apr 7, 2019
1 parent 4a823f9 commit f7b9554
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 31 deletions.
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ about: Suggest an idea for this project
---

<!--
Full automation is outside of scope for this project due to its potential for misuse.
Full automation is not within the scope of this project due to its potential for misuse.
The solver must always be manually started from the extension button.
The extension helps solve reCAPTCHA challenges, other challenge types are not
considered at this time.
The extension helps solve reCAPTCHA audio challenges, other services
and challenge types are not within the scope of this project.
-->

**Is your feature request related to a problem? Please describe.**
Expand Down
5 changes: 0 additions & 5 deletions src/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@
"description": "Title of the option."
},

"optionValue_speechService_googleSpeechApiDemo": {
"message": "Google Cloud Speech API (demo)",
"description": "Value of the option."
},

"optionValue_speechService_googleSpeechApi": {
"message": "Google Cloud Speech API",
"description": "Value of the option."
Expand Down
1 change: 0 additions & 1 deletion src/options/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ export default {

selectOptions: getOptionLabels({
speechService: [
'googleSpeechApiDemo',
'witSpeechApiDemo',
'googleSpeechApi',
'witSpeechApi',
Expand Down
33 changes: 13 additions & 20 deletions src/solve/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -465,27 +465,20 @@ async function solve(simulateUserInput, clickEvent) {
}
solution = await getWitSpeechApiResult(apiKey, audioContent);
}
} else if (
['googleSpeechApiDemo', 'googleSpeechApi'].includes(speechService)
) {
let apiUrl;
if (speechService === 'googleSpeechApiDemo') {
apiUrl =
'https://cxl-services.appspot.com/proxy?url=https://speech.googleapis.com/v1p1beta1/speech:recognize';
} else {
const {googleSpeechApiKey: apiKey} = await storage.get(
'googleSpeechApiKey',
'sync'
);
if (!apiKey) {
browser.runtime.sendMessage({
id: 'notification',
messageId: 'error_missingApiKey'
});
return;
}
apiUrl = `https://speech.googleapis.com/v1p1beta1/speech:recognize?key=${apiKey}`;
} else if (speechService === 'googleSpeechApi') {
const {googleSpeechApiKey: apiKey} = await storage.get(
'googleSpeechApiKey',
'sync'
);
if (!apiKey) {
browser.runtime.sendMessage({
id: 'notification',
messageId: 'error_missingApiKey'
});
return;
}
const apiUrl = `https://speech.googleapis.com/v1p1beta1/speech:recognize?key=${apiKey}`;

const language = captchaGoogleSpeechApiLangCodes[lang] || 'en-US';

const data = {
Expand Down
28 changes: 28 additions & 0 deletions src/storage/versions/local/DlgF14Chrh.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import browser from 'webextension-polyfill';

const message = 'Revision description';

const revision = 'DlgF14Chrh';
const downRevision = 'X3djS8vZC';

const storage = browser.storage.local;

async function upgrade() {
const changes = {};
const {speechService} = await storage.get('speechService');
if (speechService === 'googleSpeechApiDemo') {
changes.speechService = 'witSpeechApiDemo';
}

changes.storageVersion = revision;
return storage.set(changes);
}

async function downgrade() {
const changes = {};

changes.storageVersion = downRevision;
return storage.set(changes);
}

export {message, revision, upgrade, downgrade};
3 changes: 2 additions & 1 deletion src/storage/versions/local/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"nOedd0Txqd",
"ZtLMLoh1ag",
"t335iRDhZ8",
"X3djS8vZC"
"X3djS8vZC",
"DlgF14Chrh"
]
}
28 changes: 28 additions & 0 deletions src/storage/versions/sync/DlgF14Chrh.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import browser from 'webextension-polyfill';

const message = 'Revision description';

const revision = 'DlgF14Chrh';
const downRevision = 'X3djS8vZC';

const storage = browser.storage.sync;

async function upgrade() {
const changes = {};
const {speechService} = await storage.get('speechService');
if (speechService === 'googleSpeechApiDemo') {
changes.speechService = 'witSpeechApiDemo';
}

changes.storageVersion = revision;
return storage.set(changes);
}

async function downgrade() {
const changes = {};

changes.storageVersion = downRevision;
return storage.set(changes);
}

export {message, revision, upgrade, downgrade};
3 changes: 2 additions & 1 deletion src/storage/versions/sync/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"nOedd0Txqd",
"ZtLMLoh1ag",
"t335iRDhZ8",
"X3djS8vZC"
"X3djS8vZC",
"DlgF14Chrh"
]
}

0 comments on commit f7b9554

Please sign in to comment.