mirror of
https://github.com/kokonect-link/cherrypick
synced 2024-11-23 06:37:07 +09:00
tweak 3241db64
This commit is contained in:
parent
3241db64ab
commit
e54dd80c30
2
COPYING
2
COPYING
@ -1,5 +1,5 @@
|
||||
Unless otherwise stated this repository is
|
||||
Copyright © 2014-2024 syuilo and noridev and other misskey, cherrypick contributors
|
||||
Copyright © 2014-2024 syuilo & noridev and contributors
|
||||
|
||||
And is distributed under The GNU Affero General Public License Version 3, you should have received a copy of the license file as LICENSE.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project and cherrypick-contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project and cherrypick-contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project and cherrypick-contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project and cherrypick-contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -17,8 +17,8 @@ import { UtilityService } from '@/core/UtilityService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import type { GlobalEvents } from '@/core/GlobalEventService.js';
|
||||
import { FanoutTimelineService } from '@/core/FanoutTimelineService.js';
|
||||
import type { OnApplicationShutdown } from '@nestjs/common';
|
||||
import { deserializeAntenna } from './deserializeAntenna.js';
|
||||
import type { OnApplicationShutdown } from '@nestjs/common';
|
||||
|
||||
@Injectable()
|
||||
export class AntennaService implements OnApplicationShutdown {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: cherrypick-contributors
|
||||
* SPDX-FileCopyrightText: noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -120,12 +120,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
const previousMonth = expirationDate.getUTCMonth();
|
||||
(ps.expiresAt === '1hour' ? function () { expirationDate!.setTime(expirationDate!.getTime() + ms('1 hour')); } :
|
||||
ps.expiresAt === '12hours' ? function () { expirationDate!.setTime(expirationDate!.getTime() + ms('12 hours')); } :
|
||||
ps.expiresAt === '1day' ? function () { expirationDate!.setTime(expirationDate!.getTime() + ms('1 day')); } :
|
||||
ps.expiresAt === '1week' ? function () { expirationDate!.setTime(expirationDate!.getTime() + ms('1 week')); } :
|
||||
ps.expiresAt === '1month' ? function () { expirationDate!.setUTCMonth((expirationDate!.getUTCMonth() + 1 + 1) % 12 - 1); expirationDate!.setUTCFullYear(expirationDate!.getUTCFullYear() + (Math.floor((previousMonth + 1 + 1) / 12))); } :
|
||||
ps.expiresAt === '3months' ? function () {expirationDate!.setUTCMonth((expirationDate!.getUTCMonth() + 3 + 1) % 12 - 1); expirationDate!.setUTCFullYear(expirationDate!.getUTCFullYear() + (Math.floor((previousMonth + 3 + 1) / 12))); } :
|
||||
ps.expiresAt === '6months' ? function () { expirationDate!.setUTCMonth((expirationDate!.getUTCMonth() + 6 + 1) % 12 - 1); expirationDate!.setUTCFullYear(expirationDate!.getUTCFullYear() + (Math.floor((previousMonth + 6 + 1) / 12))); } :
|
||||
ps.expiresAt === '1year' ? function () { expirationDate!.setUTCFullYear(expirationDate!.getUTCFullYear() + 1); } : function () { expirationDate = null; })();
|
||||
ps.expiresAt === '1day' ? function () { expirationDate!.setTime(expirationDate!.getTime() + ms('1 day')); } :
|
||||
ps.expiresAt === '1week' ? function () { expirationDate!.setTime(expirationDate!.getTime() + ms('1 week')); } :
|
||||
ps.expiresAt === '1month' ? function () { expirationDate!.setUTCMonth((expirationDate!.getUTCMonth() + 1 + 1) % 12 - 1); expirationDate!.setUTCFullYear(expirationDate!.getUTCFullYear() + (Math.floor((previousMonth + 1 + 1) / 12))); } :
|
||||
ps.expiresAt === '3months' ? function () {expirationDate!.setUTCMonth((expirationDate!.getUTCMonth() + 3 + 1) % 12 - 1); expirationDate!.setUTCFullYear(expirationDate!.getUTCFullYear() + (Math.floor((previousMonth + 3 + 1) / 12))); } :
|
||||
ps.expiresAt === '6months' ? function () { expirationDate!.setUTCMonth((expirationDate!.getUTCMonth() + 6 + 1) % 12 - 1); expirationDate!.setUTCFullYear(expirationDate!.getUTCFullYear() + (Math.floor((previousMonth + 6 + 1) / 12))); } :
|
||||
ps.expiresAt === '1year' ? function () { expirationDate!.setUTCFullYear(expirationDate!.getUTCFullYear() + 1); } : function () { expirationDate = null; })();
|
||||
|
||||
return await this.abuseReportResolverRepository.insert({
|
||||
id: this.idService.gen(),
|
||||
|
@ -103,12 +103,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
const previousMonth = expirationDate.getUTCMonth();
|
||||
(ps.expiresAt === '1hour' ? function () { expirationDate!.setTime(expirationDate!.getTime() + ms('1 hour')); } :
|
||||
ps.expiresAt === '12hours' ? function () { expirationDate!.setTime(expirationDate!.getTime() + ms('12 hours')); } :
|
||||
ps.expiresAt === '1day' ? function () { expirationDate!.setTime(expirationDate!.getTime() + ms('1 day')); } :
|
||||
ps.expiresAt === '1week' ? function () { expirationDate!.setTime(expirationDate!.getTime() + ms('1 week')); } :
|
||||
ps.expiresAt === '1month' ? function () { expirationDate!.setUTCMonth((expirationDate!.getUTCMonth() + 1 + 1) % 12 - 1); expirationDate!.setUTCFullYear(expirationDate!.getUTCFullYear() + (Math.floor((previousMonth + 1 + 1) / 12))); } :
|
||||
ps.expiresAt === '3months' ? function () {expirationDate!.setUTCMonth((expirationDate!.getUTCMonth() + 3 + 1) % 12 - 1); expirationDate!.setUTCFullYear(expirationDate!.getUTCFullYear() + (Math.floor((previousMonth + 3 + 1) / 12))); } :
|
||||
ps.expiresAt === '6months' ? function () { expirationDate!.setUTCMonth((expirationDate!.getUTCMonth() + 6 + 1) % 12 - 1); expirationDate!.setUTCFullYear(expirationDate!.getUTCFullYear() + (Math.floor((previousMonth + 6 + 1) / 12))); } :
|
||||
ps.expiresAt === '1year' ? function () { expirationDate!.setUTCFullYear(expirationDate!.getUTCFullYear() + 1); } : function () { expirationDate = null; })();
|
||||
ps.expiresAt === '1day' ? function () { expirationDate!.setTime(expirationDate!.getTime() + ms('1 day')); } :
|
||||
ps.expiresAt === '1week' ? function () { expirationDate!.setTime(expirationDate!.getTime() + ms('1 week')); } :
|
||||
ps.expiresAt === '1month' ? function () { expirationDate!.setUTCMonth((expirationDate!.getUTCMonth() + 1 + 1) % 12 - 1); expirationDate!.setUTCFullYear(expirationDate!.getUTCFullYear() + (Math.floor((previousMonth + 1 + 1) / 12))); } :
|
||||
ps.expiresAt === '3months' ? function () {expirationDate!.setUTCMonth((expirationDate!.getUTCMonth() + 3 + 1) % 12 - 1); expirationDate!.setUTCFullYear(expirationDate!.getUTCFullYear() + (Math.floor((previousMonth + 3 + 1) / 12))); } :
|
||||
ps.expiresAt === '6months' ? function () { expirationDate!.setUTCMonth((expirationDate!.getUTCMonth() + 6 + 1) % 12 - 1); expirationDate!.setUTCFullYear(expirationDate!.getUTCFullYear() + (Math.floor((previousMonth + 6 + 1) / 12))); } :
|
||||
ps.expiresAt === '1year' ? function () { expirationDate!.setUTCFullYear(expirationDate!.getUTCFullYear() + 1); } : function () { expirationDate = null; })();
|
||||
|
||||
properties.expiresAt = ps.expiresAt;
|
||||
properties.expirationDate = expirationDate;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
@ -173,4 +173,3 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -106,7 +106,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
) {
|
||||
super({
|
||||
...meta,
|
||||
requireRolePolicy: "canEditNote", // 修正された部分
|
||||
requireRolePolicy: 'canEditNote', // 修正された部分
|
||||
}, paramDef, async (ps, me) => {
|
||||
const note = await this.getterService.getNote(ps.noteId).catch(err => {
|
||||
if (err.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
@ -72,31 +72,31 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
if (!policies.canUseTranslator) {
|
||||
throw new ApiError(meta.errors.unavailable);
|
||||
}
|
||||
|
||||
|
||||
const target = await this.getterService.getUserProfiles(ps.userId).catch(err => {
|
||||
if (err.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchDescription);
|
||||
throw err;
|
||||
});
|
||||
|
||||
|
||||
if (target.description == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const instance = await this.metaService.fetch();
|
||||
|
||||
|
||||
const translatorServices = [
|
||||
'deepl',
|
||||
'google_no_api',
|
||||
'ctav3',
|
||||
];
|
||||
|
||||
|
||||
if (instance.translatorType == null || !translatorServices.includes(instance.translatorType)) {
|
||||
return Promise.resolve(204); // Promise.resolveで204をラップする
|
||||
}
|
||||
|
||||
|
||||
let targetLang = ps.targetLang;
|
||||
if (targetLang.includes('-')) targetLang = targetLang.split('-')[0];
|
||||
|
||||
|
||||
let translationResult;
|
||||
if (instance.translatorType === 'deepl') {
|
||||
if (instance.deeplAuthKey == null) {
|
||||
@ -106,9 +106,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
} else if (instance.translatorType === 'google_no_api') {
|
||||
let targetLang = ps.targetLang;
|
||||
if (targetLang.includes('-')) targetLang = targetLang.split('-')[0];
|
||||
|
||||
|
||||
const { text, raw } = await translate(target.description, { to: targetLang });
|
||||
|
||||
|
||||
return {
|
||||
sourceLang: raw.src,
|
||||
text: text,
|
||||
@ -124,13 +124,13 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
} else {
|
||||
throw new Error('Unsupported translator type');
|
||||
}
|
||||
|
||||
|
||||
return Promise.resolve({
|
||||
sourceLang: translationResult.sourceLang || '',
|
||||
text: translationResult.text || '',
|
||||
translator: translationResult.translator || [],
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private async translateDeepL(text: string, targetLang: string, authKey: string, isPro: boolean, provider: string) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
@ -113,7 +113,7 @@ class MessagingChannel extends Channel {
|
||||
if (now.getTime() - date.getTime() > 5000) delete this.typers[userId];
|
||||
}
|
||||
|
||||
const users = await this.userEntityService.packMany(Object.keys(this.typers), null, { schema: "UserLite" });
|
||||
const users = await this.userEntityService.packMany(Object.keys(this.typers), null, { schema: 'UserLite' });
|
||||
|
||||
this.send({
|
||||
type: 'typers',
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
-->
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and noridev and other misskey, cherrypick contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -45,7 +45,7 @@ import { globalEvents } from '@/events.js';
|
||||
import { injectReactiveMetadata } from '@/scripts/page-metadata.js';
|
||||
import { deviceKind } from '@/scripts/device-kind.js';
|
||||
import { defaultStore } from '@/store.js';
|
||||
import { mainRouter } from "@/router/main.js";
|
||||
import { mainRouter } from '@/router/main.js';
|
||||
|
||||
const MOBILE_THRESHOLD = 500;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
-->
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user