Add Deepl endpoint selection

Fixes #3224
This commit is contained in:
Cohee
2024-12-27 13:02:06 +00:00
parent 4fa8e0a89c
commit 29acc2e2db
3 changed files with 35 additions and 7 deletions

View File

@@ -264,7 +264,11 @@ router.post('/deepl', jsonParser, async (request, response) => {
params.append('formality', formality);
}
const result = await fetch('https://api-free.deepl.com/v2/translate', {
const endpoint = request.body.endpoint === 'pro'
? 'https://api.deepl.com/v2/translate'
: 'https://api-free.deepl.com/v2/translate';
const result = await fetch(endpoint, {
method: 'POST',
body: params,
headers: {