This commit is contained in:
MomentQYC 2024-10-07 09:23:39 +08:00
parent e17c3d1ef9
commit 7363bcbf36
3 changed files with 17 additions and 15 deletions

View File

@ -66,6 +66,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
private httpRequestService: HttpRequestService, private httpRequestService: HttpRequestService,
private roleService: RoleService, private roleService: RoleService,
) { ) {
// @ts-ignore
super(meta, paramDef, async (ps, me) => { super(meta, paramDef, async (ps, me) => {
const policies = await this.roleService.getUserPolicies(me.id); const policies = await this.roleService.getUserPolicies(me.id);
if (!policies.canUseTTS) { if (!policies.canUseTTS) {
@ -82,7 +83,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
} }
if (note.text == null) { if (note.text == null) {
return; throw new ApiError(meta.errors.cannotConvertInvisibleNote);
} }
const instance = await this.metaService.fetch(); const instance = await this.metaService.fetch();
@ -160,6 +161,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
const contentType = res.headers.get('Content-Type') || 'application/octet-stream'; const contentType = res.headers.get('Content-Type') || 'application/octet-stream';
if (contentType === 'audio/x-wav') { if (contentType === 'audio/x-wav') {
// @ts-ignore
return res.body; return res.body;
} else { } else {
throw new ApiError(meta.errors.unavailable); throw new ApiError(meta.errors.unavailable);
@ -186,6 +188,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
const contentType = res.headers.get('Content-Type') || 'application/octet-stream'; const contentType = res.headers.get('Content-Type') || 'application/octet-stream';
if (contentType === 'audio/flac') { if (contentType === 'audio/flac') {
// @ts-ignore
return res.body; return res.body;
} else { } else {
throw new ApiError(meta.errors.unavailable); throw new ApiError(meta.errors.unavailable);

View File

@ -132,24 +132,23 @@ const hfnrm = ref<boolean>(false);
const hfSpeedRate = ref<number>(125); const hfSpeedRate = ref<number>(125);
const hfdas = ref<boolean>(false); const hfdas = ref<boolean>(false);
async function init() { async function init() {
const meta = await misskeyApi('admin/meta'); const meta = await misskeyApi('admin/meta');
deeplAuthKey.value = meta.deeplAuthKey; deeplAuthKey.value = meta.deeplAuthKey;
deeplIsPro.value = meta.deeplIsPro; deeplIsPro.value = meta.deeplIsPro;
hfAuthKey.value = meta.hfAuthkey; hfAuthKey.value = meta.hfAuthkey;
hfSpace.value = meta.hfSpace, hfSpace.value = meta.hfSpace;
hfSpaceName.value = meta.hfSpaceName, hfSpaceName.value = meta.hfSpaceName;
hfexampleAudioURL.value = meta.hfexampleAudioURL, hfexampleAudioURL.value = meta.hfexampleAudioURL;
hfexampleText.value = meta.hfexampleText, hfexampleText.value = meta.hfexampleText;
hfexampleLang.value = meta.hfexampleLang, hfexampleLang.value = meta.hfexampleLang;
hfslice.value = meta.hfslice, hfslice.value = meta.hfslice;
hftopK.value = meta.hftopK, hftopK.value = meta.hftopK;
hftopP.value = meta.hftopP, hftopP.value = meta.hftopP;
hfTemperature.value = meta.hfTemperature, hfTemperature.value = meta.hfTemperature;
hfnrm.value = meta.hfnrm, hfnrm.value = meta.hfnrm;
hfSpeedRate.value = meta.hfSpeedRate, hfSpeedRate.value = meta.hfSpeedRate;
hfdas.value = meta.hfdas hfdas.value = meta.hfdas;
} }
function save_deepl() { function save_deepl() {

View File

@ -324,7 +324,7 @@ export function getNoteMenu(props: {
} else { } else {
console.error('Response body is not a ReadableStream'); console.error('Response body is not a ReadableStream');
} }
} catch (e) { } catch (errors) {
console.error('Failed to create Blob or Object URL:', e); console.error('Failed to create Blob or Object URL:', e);
} }