forked from FoundKeyGang/FoundKey
parent
9d3448c880
commit
d64e25e449
7 changed files with 40 additions and 1 deletions
|
@ -13,6 +13,8 @@
|
||||||
- クライアントのデザインの調整
|
- クライアントのデザインの調整
|
||||||
|
|
||||||
### Bugfixes
|
### Bugfixes
|
||||||
|
- 翻訳でDeepLのProアカウントに対応していない問題を修正
|
||||||
|
- インスタンス設定でDeepLのAuth Keyが空で表示される問題を修正
|
||||||
- セキュリティの向上
|
- セキュリティの向上
|
||||||
|
|
||||||
## 12.89.0 (2021/08/21)
|
## 12.89.0 (2021/08/21)
|
||||||
|
|
14
migration/1629778475000-deepl-integration2.ts
Normal file
14
migration/1629778475000-deepl-integration2.ts
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
import {MigrationInterface, QueryRunner} from "typeorm";
|
||||||
|
|
||||||
|
export class deeplIntegration21629778475000 implements MigrationInterface {
|
||||||
|
name = 'deeplIntegration21629778475000'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE "meta" ADD "deeplIsPro" boolean NOT NULL DEFAULT false`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "deeplIsPro"`);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -12,6 +12,9 @@
|
||||||
<template #prefix><i class="fas fa-key"></i></template>
|
<template #prefix><i class="fas fa-key"></i></template>
|
||||||
DeepL Auth Key
|
DeepL Auth Key
|
||||||
</FormInput>
|
</FormInput>
|
||||||
|
<FormSwitch v-model:value="deeplIsPro">
|
||||||
|
Pro account
|
||||||
|
</FormSwitch>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<FormButton @click="save" primary><i class="fas fa-save"></i> {{ $ts.save }}</FormButton>
|
<FormButton @click="save" primary><i class="fas fa-save"></i> {{ $ts.save }}</FormButton>
|
||||||
</FormSuspense>
|
</FormSuspense>
|
||||||
|
@ -50,6 +53,7 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
summalyProxy: '',
|
summalyProxy: '',
|
||||||
deeplAuthKey: '',
|
deeplAuthKey: '',
|
||||||
|
deeplIsPro: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -62,11 +66,13 @@ export default defineComponent({
|
||||||
const meta = await os.api('meta', { detail: true });
|
const meta = await os.api('meta', { detail: true });
|
||||||
this.summalyProxy = meta.summalyProxy;
|
this.summalyProxy = meta.summalyProxy;
|
||||||
this.deeplAuthKey = meta.deeplAuthKey;
|
this.deeplAuthKey = meta.deeplAuthKey;
|
||||||
|
this.deeplIsPro = meta.deeplIsPro;
|
||||||
},
|
},
|
||||||
save() {
|
save() {
|
||||||
os.apiWithDialog('admin/update-meta', {
|
os.apiWithDialog('admin/update-meta', {
|
||||||
summalyProxy: this.summalyProxy,
|
summalyProxy: this.summalyProxy,
|
||||||
deeplAuthKey: this.deeplAuthKey,
|
deeplAuthKey: this.deeplAuthKey,
|
||||||
|
deeplIsPro: this.deeplIsPro,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
fetchInstance();
|
fetchInstance();
|
||||||
});
|
});
|
||||||
|
|
|
@ -319,6 +319,11 @@ export class Meta {
|
||||||
})
|
})
|
||||||
public deeplAuthKey: string | null;
|
public deeplAuthKey: string | null;
|
||||||
|
|
||||||
|
@Column('boolean', {
|
||||||
|
default: false,
|
||||||
|
})
|
||||||
|
public deeplIsPro: boolean;
|
||||||
|
|
||||||
@Column('varchar', {
|
@Column('varchar', {
|
||||||
length: 512,
|
length: 512,
|
||||||
nullable: true
|
nullable: true
|
||||||
|
|
|
@ -149,6 +149,10 @@ export const meta = {
|
||||||
validator: $.optional.nullable.str,
|
validator: $.optional.nullable.str,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
deeplIsPro: {
|
||||||
|
validator: $.optional.bool,
|
||||||
|
},
|
||||||
|
|
||||||
enableTwitterIntegration: {
|
enableTwitterIntegration: {
|
||||||
validator: $.optional.bool,
|
validator: $.optional.bool,
|
||||||
},
|
},
|
||||||
|
@ -574,6 +578,10 @@ export default define(meta, async (ps, me) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ps.deeplIsPro !== undefined) {
|
||||||
|
set.deeplIsPro = ps.deeplIsPro;
|
||||||
|
}
|
||||||
|
|
||||||
await getConnection().transaction(async transactionalEntityManager => {
|
await getConnection().transaction(async transactionalEntityManager => {
|
||||||
const meta = await transactionalEntityManager.findOne(Meta, {
|
const meta = await transactionalEntityManager.findOne(Meta, {
|
||||||
order: {
|
order: {
|
||||||
|
|
|
@ -583,6 +583,8 @@ export default define(meta, async (ps, me) => {
|
||||||
response.objectStorageUseProxy = instance.objectStorageUseProxy;
|
response.objectStorageUseProxy = instance.objectStorageUseProxy;
|
||||||
response.objectStorageSetPublicRead = instance.objectStorageSetPublicRead;
|
response.objectStorageSetPublicRead = instance.objectStorageSetPublicRead;
|
||||||
response.objectStorageS3ForcePathStyle = instance.objectStorageS3ForcePathStyle;
|
response.objectStorageS3ForcePathStyle = instance.objectStorageS3ForcePathStyle;
|
||||||
|
response.deeplAuthKey = instance.deeplAuthKey;
|
||||||
|
response.deeplIsPro = instance.deeplIsPro;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,9 @@ export default define(meta, async (ps, user) => {
|
||||||
params.append('text', note.text);
|
params.append('text', note.text);
|
||||||
params.append('target_lang', targetLang);
|
params.append('target_lang', targetLang);
|
||||||
|
|
||||||
const res = await fetch('https://api-free.deepl.com/v2/translate', {
|
const endpoint = instance.deeplIsPro ? 'https://api.deepl.com/v2/translate' : 'https://api-free.deepl.com/v2/translate';
|
||||||
|
|
||||||
|
const res = await fetch(endpoint, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
|
|
Loading…
Reference in a new issue