fix DeepLX

`??` binds tighter than `? :`, so that expression was parsed as:

```ts
( deeplFreeInstance ?? this.serverSettings.deeplIsPro )
   ? 'https://api.deepl.com/v2/translate'
	 : 'https://api-free.deepl.com/v2/translate'
```

which ended up calling the non-free DeepL instead of the local DeepLX
This commit is contained in:
dakkar 2025-06-01 14:44:49 +01:00
parent c1af8dfb7f
commit b13781632f

View file

@ -140,7 +140,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
if (this.serverSettings.deeplAuthKey) params.append('auth_key', this.serverSettings.deeplAuthKey); if (this.serverSettings.deeplAuthKey) params.append('auth_key', this.serverSettings.deeplAuthKey);
params.append('text', note.text); params.append('text', note.text);
params.append('target_lang', targetLang); params.append('target_lang', targetLang);
const endpoint = deeplFreeInstance ?? this.serverSettings.deeplIsPro ? 'https://api.deepl.com/v2/translate' : 'https://api-free.deepl.com/v2/translate'; const endpoint = deeplFreeInstance ?? ( this.serverSettings.deeplIsPro ? 'https://api.deepl.com/v2/translate' : 'https://api-free.deepl.com/v2/translate' );
const res = await this.httpRequestService.send(endpoint, { const res = await this.httpRequestService.send(endpoint, {
method: 'POST', method: 'POST',