[chore] Reformat code

This commit is contained in:
Cohee 2023-10-06 15:55:11 +03:00
parent 0b8295926e
commit 2f294b9f2b
1 changed files with 4 additions and 3 deletions

View File

@ -1,8 +1,6 @@
const fetch = require('node-fetch').default; const fetch = require('node-fetch').default;
const https = require('https'); const https = require('https');
const { readSecret, SECRET_KEYS } = require('./secrets'); const { readSecret, SECRET_KEYS } = require('./secrets');
const { generateRequestUrl, normaliseResponse } = require('google-translate-api-browser');
const bingTranslateApi = require('bing-translate-api')
const DEEPLX_URL_DEFAULT = 'http://127.0.0.1:1188/translate'; const DEEPLX_URL_DEFAULT = 'http://127.0.0.1:1188/translate';
const ONERING_URL_DEFAULT = 'http://127.0.0.1:4990/translate'; const ONERING_URL_DEFAULT = 'http://127.0.0.1:4990/translate';
@ -60,6 +58,7 @@ function registerEndpoints(app, jsonParser) {
}); });
app.post('/api/translate/google', jsonParser, async (request, response) => { app.post('/api/translate/google', jsonParser, async (request, response) => {
const { generateRequestUrl, normaliseResponse } = require('google-translate-api-browser');
const text = request.body.text; const text = request.body.text;
const lang = request.body.lang; const lang = request.body.lang;
@ -244,8 +243,10 @@ function registerEndpoints(app, jsonParser) {
}); });
app.post('/api/translate/bing', jsonParser, async (request, response) => { app.post('/api/translate/bing', jsonParser, async (request, response) => {
const bingTranslateApi = require('bing-translate-api');
const text = request.body.text; const text = request.body.text;
let lang = request.body.lang let lang = request.body.lang;
if (request.body.lang === 'zh-CN') { if (request.body.lang === 'zh-CN') {
lang = 'zh-Hans' lang = 'zh-Hans'
} }