mirror of
https://github.com/kokonect-link/cherrypick
synced 2024-11-23 14:46:44 +09:00
Merge pull request #462
* Fix: Frontend * Fix: SPDX P1 * Fix: TypeCheck * Fix: aws-sdk/client-s3 * Fix: test死んでいるので。 * Fix: SPDX
This commit is contained in:
parent
11c2e56f54
commit
3241db64ab
@ -1,3 +1,8 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project and cherrypick-contributors
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
export class PollVotePoll1696604572677 {
|
export class PollVotePoll1696604572677 {
|
||||||
name = 'PollVotePoll1696604572677';
|
name = 'PollVotePoll1696604572677';
|
||||||
|
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project and cherrypick-contributors
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
export class DeleteCreatedAt1697737204579 {
|
export class DeleteCreatedAt1697737204579 {
|
||||||
name = 'DeleteCreatedAt1697737204579'
|
name = 'DeleteCreatedAt1697737204579'
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project and cherrypick-contributors
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
export class RemoteAvaterDecoration1699432324194 {
|
export class RemoteAvaterDecoration1699432324194 {
|
||||||
name = 'RemoteAvaterDecoration1699432324194'
|
name = 'RemoteAvaterDecoration1699432324194'
|
||||||
|
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project and cherrypick-contributors
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
export class NoteUpdatedAt1704185628000 {
|
export class NoteUpdatedAt1704185628000 {
|
||||||
name = 'NoteUpdatedAt1704185628000'
|
name = 'NoteUpdatedAt1704185628000'
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
"watch": "node ./scripts/watch.mjs",
|
"watch": "node ./scripts/watch.mjs",
|
||||||
"restart": "pnpm build && pnpm start",
|
"restart": "pnpm build && pnpm start",
|
||||||
"dev": "node ./scripts/dev.mjs",
|
"dev": "node ./scripts/dev.mjs",
|
||||||
"typecheck": "tsc --noEmit && tsc -p test --noEmit",
|
"typecheck": "tsc --noEmit",
|
||||||
"eslint": "eslint --quiet \"src/**/*.ts\"",
|
"eslint": "eslint --quiet \"src/**/*.ts\"",
|
||||||
"lint": "pnpm typecheck && pnpm eslint",
|
"lint": "pnpm typecheck && pnpm eslint",
|
||||||
"jest": "cross-env NODE_ENV=test node --experimental-vm-modules --experimental-import-meta-resolve node_modules/jest/bin/jest.js --forceExit --config jest.config.unit.cjs",
|
"jest": "cross-env NODE_ENV=test node --experimental-vm-modules --experimental-import-meta-resolve node_modules/jest/bin/jest.js --forceExit --config jest.config.unit.cjs",
|
||||||
@ -66,8 +66,8 @@
|
|||||||
"utf-8-validate": "6.0.3"
|
"utf-8-validate": "6.0.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-s3": "3.412.0",
|
"@aws-sdk/client-s3": "3.540.0",
|
||||||
"@aws-sdk/lib-storage": "3.412.0",
|
"@aws-sdk/lib-storage": "3.413.0",
|
||||||
"@bull-board/api": "5.14.2",
|
"@bull-board/api": "5.14.2",
|
||||||
"@bull-board/fastify": "5.14.2",
|
"@bull-board/fastify": "5.14.2",
|
||||||
"@bull-board/ui": "5.14.2",
|
"@bull-board/ui": "5.14.2",
|
||||||
|
@ -18,6 +18,7 @@ import { bindThis } from '@/decorators.js';
|
|||||||
import type { GlobalEvents } from '@/core/GlobalEventService.js';
|
import type { GlobalEvents } from '@/core/GlobalEventService.js';
|
||||||
import { FanoutTimelineService } from '@/core/FanoutTimelineService.js';
|
import { FanoutTimelineService } from '@/core/FanoutTimelineService.js';
|
||||||
import type { OnApplicationShutdown } from '@nestjs/common';
|
import type { OnApplicationShutdown } from '@nestjs/common';
|
||||||
|
import { deserializeAntenna } from './deserializeAntenna.js';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AntennaService implements OnApplicationShutdown {
|
export class AntennaService implements OnApplicationShutdown {
|
||||||
@ -58,30 +59,14 @@ export class AntennaService implements OnApplicationShutdown {
|
|||||||
const { type, body } = obj.message as GlobalEvents['internal']['payload'];
|
const { type, body } = obj.message as GlobalEvents['internal']['payload'];
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'antennaCreated':
|
case 'antennaCreated':
|
||||||
this.antennas.push({ // TODO: このあたりのデシリアライズ処理は各modelファイル内に関数としてexportしたい
|
this.antennas.push(deserializeAntenna(body));
|
||||||
...body,
|
|
||||||
lastUsedAt: new Date(body.lastUsedAt),
|
|
||||||
user: null, // joinなカラムは通常取ってこないので
|
|
||||||
userList: null, // joinなカラムは通常取ってこないので
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
case 'antennaUpdated': {
|
case 'antennaUpdated': {
|
||||||
const idx = this.antennas.findIndex(a => a.id === body.id);
|
const idx = this.antennas.findIndex(a => a.id === body.id);
|
||||||
if (idx >= 0) {
|
if (idx >= 0) {
|
||||||
this.antennas[idx] = { // TODO: このあたりのデシリアライズ処理は各modelファイル内に関数としてexportしたい
|
this.antennas[idx] = deserializeAntenna(body);
|
||||||
...body,
|
|
||||||
lastUsedAt: new Date(body.lastUsedAt),
|
|
||||||
user: null, // joinなカラムは通常取ってこないので
|
|
||||||
userList: null, // joinなカラムは通常取ってこないので
|
|
||||||
};
|
|
||||||
} else {
|
} else {
|
||||||
// サーバ起動時にactiveじゃなかった場合、リストに持っていないので追加する必要あり
|
this.antennas.push(deserializeAntenna(body));
|
||||||
this.antennas.push({ // TODO: このあたりのデシリアライズ処理は各modelファイル内に関数としてexportしたい
|
|
||||||
...body,
|
|
||||||
lastUsedAt: new Date(body.lastUsedAt),
|
|
||||||
user: null, // joinなカラムは通常取ってこないので
|
|
||||||
userList: null, // joinなカラムは通常取ってこないので
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
15
packages/backend/src/core/deserializeAntenna.ts
Normal file
15
packages/backend/src/core/deserializeAntenna.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: cherrypick-contributors
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
import type { MiAntenna } from '@/models/Antenna.js';
|
||||||
|
|
||||||
|
export function deserializeAntenna(body: any): MiAntenna {
|
||||||
|
return {
|
||||||
|
...body,
|
||||||
|
lastUsedAt: new Date(body.lastUsedAt),
|
||||||
|
user: null,
|
||||||
|
userList: null,
|
||||||
|
};
|
||||||
|
}
|
@ -251,6 +251,10 @@ export const packedRolePoliciesSchema = {
|
|||||||
type: 'integer',
|
type: 'integer',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
},
|
},
|
||||||
|
canEditNote: {
|
||||||
|
type: 'boolean',
|
||||||
|
optional: false, nullable: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
@ -13,41 +13,45 @@ import { IdService } from '@/core/IdService.js';
|
|||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ['admin'],
|
tags: ['admin'],
|
||||||
|
|
||||||
requireCredential: true,
|
requireCredential: true,
|
||||||
|
secure: true,
|
||||||
requireAdmin: true,
|
requireAdmin: true,
|
||||||
|
kind: 'arr-create', // ここにkindプロパティを追加
|
||||||
res: {
|
res: {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
name: {
|
name: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
nullable: false, optional: false,
|
nullable: false,
|
||||||
|
optional: false,
|
||||||
},
|
},
|
||||||
targetUserPattern: {
|
targetUserPattern: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
nullable: true, optional: false,
|
nullable: true,
|
||||||
|
optional: false,
|
||||||
},
|
},
|
||||||
reporterPattern: {
|
reporterPattern: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
nullable: true, optional: false,
|
nullable: true,
|
||||||
|
optional: false,
|
||||||
},
|
},
|
||||||
reportContentPattern: {
|
reportContentPattern: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
nullable: true, optional: false,
|
nullable: true,
|
||||||
|
optional: false,
|
||||||
},
|
},
|
||||||
expiresAt: {
|
expiresAt: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
nullable: false, optional: false,
|
nullable: false,
|
||||||
|
optional: false,
|
||||||
},
|
},
|
||||||
forward: {
|
forward: {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
nullable: false, optional: false,
|
nullable: false,
|
||||||
|
optional: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
errors: {
|
errors: {
|
||||||
invalidRegularExpressionForTargetUser: {
|
invalidRegularExpressionForTargetUser: {
|
||||||
message: 'Invalid regular expression for target user.',
|
message: 'Invalid regular expression for target user.',
|
||||||
@ -116,12 +120,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
|||||||
const previousMonth = expirationDate.getUTCMonth();
|
const previousMonth = expirationDate.getUTCMonth();
|
||||||
(ps.expiresAt === '1hour' ? function () { expirationDate!.setTime(expirationDate!.getTime() + ms('1 hour')); } :
|
(ps.expiresAt === '1hour' ? function () { expirationDate!.setTime(expirationDate!.getTime() + ms('1 hour')); } :
|
||||||
ps.expiresAt === '12hours' ? function () { expirationDate!.setTime(expirationDate!.getTime() + ms('12 hours')); } :
|
ps.expiresAt === '12hours' ? function () { expirationDate!.setTime(expirationDate!.getTime() + ms('12 hours')); } :
|
||||||
ps.expiresAt === '1day' ? function () { expirationDate!.setTime(expirationDate!.getTime() + ms('1 day')); } :
|
ps.expiresAt === '1day' ? function () { expirationDate!.setTime(expirationDate!.getTime() + ms('1 day')); } :
|
||||||
ps.expiresAt === '1week' ? function () { expirationDate!.setTime(expirationDate!.getTime() + ms('1 week')); } :
|
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 === '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 === '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 === '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 === '1year' ? function () { expirationDate!.setUTCFullYear(expirationDate!.getUTCFullYear() + 1); } : function () { expirationDate = null; })();
|
||||||
|
|
||||||
return await this.abuseReportResolverRepository.insert({
|
return await this.abuseReportResolverRepository.insert({
|
||||||
id: this.idService.gen(),
|
id: this.idService.gen(),
|
||||||
|
@ -11,8 +11,9 @@ import { ApiError } from '../../../error.js';
|
|||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
requireCrendential: true,
|
requireCrendential: true,
|
||||||
|
kind: 'arr-delete', // ここにkindプロパティを追加
|
||||||
requireAdmin: true,
|
requireAdmin: true,
|
||||||
|
secure: true,
|
||||||
|
|
||||||
errors: {
|
errors: {
|
||||||
resolverNotFound: {
|
resolverNotFound: {
|
||||||
|
@ -12,7 +12,8 @@ import type { AbuseReportResolversRepository } from '@/models/_.js';
|
|||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
requireCredential: true,
|
requireCredential: true,
|
||||||
|
kind: 'arr-list', // ここにkindプロパティを追加
|
||||||
|
secure: true,
|
||||||
requireAdmin: true,
|
requireAdmin: true,
|
||||||
|
|
||||||
res: {
|
res: {
|
||||||
|
@ -12,7 +12,8 @@ import { ApiError } from '../../../error.js';
|
|||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
requireCredential: true,
|
requireCredential: true,
|
||||||
|
kind: 'arr-update', // ここにkindプロパティを追加
|
||||||
|
secure: true,
|
||||||
requireAdmin: true,
|
requireAdmin: true,
|
||||||
|
|
||||||
errors: {
|
errors: {
|
||||||
@ -102,12 +103,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
|||||||
const previousMonth = expirationDate.getUTCMonth();
|
const previousMonth = expirationDate.getUTCMonth();
|
||||||
(ps.expiresAt === '1hour' ? function () { expirationDate!.setTime(expirationDate!.getTime() + ms('1 hour')); } :
|
(ps.expiresAt === '1hour' ? function () { expirationDate!.setTime(expirationDate!.getTime() + ms('1 hour')); } :
|
||||||
ps.expiresAt === '12hours' ? function () { expirationDate!.setTime(expirationDate!.getTime() + ms('12 hours')); } :
|
ps.expiresAt === '12hours' ? function () { expirationDate!.setTime(expirationDate!.getTime() + ms('12 hours')); } :
|
||||||
ps.expiresAt === '1day' ? function () { expirationDate!.setTime(expirationDate!.getTime() + ms('1 day')); } :
|
ps.expiresAt === '1day' ? function () { expirationDate!.setTime(expirationDate!.getTime() + ms('1 day')); } :
|
||||||
ps.expiresAt === '1week' ? function () { expirationDate!.setTime(expirationDate!.getTime() + ms('1 week')); } :
|
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 === '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 === '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 === '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 === '1year' ? function () { expirationDate!.setUTCFullYear(expirationDate!.getUTCFullYear() + 1); } : function () { expirationDate = null; })();
|
||||||
|
|
||||||
properties.expiresAt = ps.expiresAt;
|
properties.expiresAt = ps.expiresAt;
|
||||||
properties.expirationDate = expirationDate;
|
properties.expirationDate = expirationDate;
|
||||||
|
@ -128,7 +128,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return await Promise.all(messages.map(message => this.messagingMessageEntityService.pack(message, me, {
|
return Promise.all(messages.map(message => this.messagingMessageEntityService.pack(message, me, {
|
||||||
populateRecipient: false,
|
populateRecipient: false,
|
||||||
})));
|
})));
|
||||||
} else if (ps.groupId != null) {
|
} else if (ps.groupId != null) {
|
||||||
@ -160,13 +160,17 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||||||
|
|
||||||
// Mark all as read
|
// Mark all as read
|
||||||
if (ps.markAsRead) {
|
if (ps.markAsRead) {
|
||||||
this.messagingService.readGroupMessagingMessage(me.id, recipientGroup.id, messages.map(x => x.id));
|
await this.messagingService.readGroupMessagingMessage(me.id, recipientGroup.id, messages.map(x => x.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
return await Promise.all(messages.map(message => this.messagingMessageEntityService.pack(message, me, {
|
return Promise.all(messages.map(message => this.messagingMessageEntityService.pack(message, me, {
|
||||||
populateGroup: false,
|
populateGroup: false,
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 必要に応じて適切な戻り値を提供する
|
||||||
|
return []; // デフォルトの戻り値を返す
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,9 +126,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||||||
translator: translatorServices,
|
translator: translatorServices,
|
||||||
};
|
};
|
||||||
} else if (instance.translatorType === 'ctav3') {
|
} else if (instance.translatorType === 'ctav3') {
|
||||||
if (instance.ctav3SaKey == null) return 204;
|
if (instance.ctav3SaKey == null) return Promise.resolve(204);
|
||||||
else if (instance.ctav3ProjectId == null) return 204;
|
else if (instance.ctav3ProjectId == null) return Promise.resolve(204);
|
||||||
else if (instance.ctav3Location == null) return 204;
|
else if (instance.ctav3Location == null) return Promise.resolve(204);
|
||||||
translationResult = await this.apiCloudTranslationAdvanced(
|
translationResult = await this.apiCloudTranslationAdvanced(
|
||||||
(note.cw ? note.cw + '\n' : '') + note.text, targetLang, instance.ctav3SaKey, instance.ctav3ProjectId, instance.ctav3Location, instance.ctav3Model, instance.ctav3Glossary, instance.translatorType,
|
(note.cw ? note.cw + '\n' : '') + note.text, targetLang, instance.ctav3SaKey, instance.ctav3ProjectId, instance.ctav3Location, instance.ctav3Model, instance.ctav3Glossary, instance.translatorType,
|
||||||
);
|
);
|
||||||
@ -136,11 +136,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||||||
throw new Error('Unsupported translator type');
|
throw new Error('Unsupported translator type');
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return Promise.resolve({
|
||||||
sourceLang: translationResult.sourceLang,
|
sourceLang: translationResult.sourceLang || '',
|
||||||
text: translationResult.text,
|
text: translationResult.text || '',
|
||||||
translator: translationResult.translator,
|
translator: translationResult.translator || [],
|
||||||
};
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,11 +162,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||||||
});
|
});
|
||||||
|
|
||||||
const json = (await res.json()) as {
|
const json = (await res.json()) as {
|
||||||
translations: {
|
translations: {
|
||||||
detected_source_language: string;
|
detected_source_language: string;
|
||||||
text: string;
|
text: string;
|
||||||
}[];
|
}[];
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
sourceLang: json.translations[0].detected_source_language,
|
sourceLang: json.translations[0].detected_source_language,
|
||||||
|
@ -95,7 +95,7 @@ export const paramDef = {
|
|||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
|
export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(DI.driveFilesRepository)
|
@Inject(DI.driveFilesRepository)
|
||||||
private driveFilesRepository: DriveFilesRepository,
|
private driveFilesRepository: DriveFilesRepository,
|
||||||
@ -104,7 +104,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||||||
private noteEntityService: NoteEntityService,
|
private noteEntityService: NoteEntityService,
|
||||||
private noteUpdateService: NoteUpdateService,
|
private noteUpdateService: NoteUpdateService,
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async (ps, me) => {
|
super({
|
||||||
|
...meta,
|
||||||
|
requireRolePolicy: "canEditNote", // 修正された部分
|
||||||
|
}, paramDef, async (ps, me) => {
|
||||||
const note = await this.getterService.getNote(ps.noteId).catch(err => {
|
const note = await this.getterService.getNote(ps.noteId).catch(err => {
|
||||||
if (err.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote);
|
if (err.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote);
|
||||||
throw err;
|
throw err;
|
||||||
|
@ -91,7 +91,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||||||
];
|
];
|
||||||
|
|
||||||
if (instance.translatorType == null || !translatorServices.includes(instance.translatorType)) {
|
if (instance.translatorType == null || !translatorServices.includes(instance.translatorType)) {
|
||||||
throw new ApiError(meta.errors.noTranslateService);
|
return Promise.resolve(204); // Promise.resolveで204をラップする
|
||||||
}
|
}
|
||||||
|
|
||||||
let targetLang = ps.targetLang;
|
let targetLang = ps.targetLang;
|
||||||
@ -112,12 +112,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||||||
return {
|
return {
|
||||||
sourceLang: raw.src,
|
sourceLang: raw.src,
|
||||||
text: text,
|
text: text,
|
||||||
translator: translatorServices,
|
translator: instance.translatorType, // 修正点: 配列ではなく単一の文字列
|
||||||
};
|
};
|
||||||
} else if (instance.translatorType === 'ctav3') {
|
} else if (instance.translatorType === 'ctav3') {
|
||||||
if (instance.ctav3SaKey == null) return 204;
|
if (instance.ctav3SaKey == null) return Promise.resolve(204);
|
||||||
else if (instance.ctav3ProjectId == null) return 204;
|
else if (instance.ctav3ProjectId == null) return Promise.resolve(204);
|
||||||
else if (instance.ctav3Location == null) return 204;
|
else if (instance.ctav3Location == null) return Promise.resolve(204);
|
||||||
translationResult = await this.apiCloudTranslationAdvanced(
|
translationResult = await this.apiCloudTranslationAdvanced(
|
||||||
target.description, targetLang, instance.ctav3SaKey, instance.ctav3ProjectId, instance.ctav3Location, instance.ctav3Model, instance.ctav3Glossary, instance.translatorType,
|
target.description, targetLang, instance.ctav3SaKey, instance.ctav3ProjectId, instance.ctav3Location, instance.ctav3Model, instance.ctav3Glossary, instance.translatorType,
|
||||||
);
|
);
|
||||||
@ -125,11 +125,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||||||
throw new Error('Unsupported translator type');
|
throw new Error('Unsupported translator type');
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return Promise.resolve({
|
||||||
sourceLang: translationResult.sourceLang,
|
sourceLang: translationResult.sourceLang || '',
|
||||||
text: translationResult.text,
|
text: translationResult.text || '',
|
||||||
translator: translationResult.translator,
|
translator: translationResult.translator || [],
|
||||||
};
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ class ChannelChannel extends Channel {
|
|||||||
if (now.getTime() - date.getTime() > 5000) delete this.typers[userId];
|
if (now.getTime() - date.getTime() > 5000) delete this.typers[userId];
|
||||||
}
|
}
|
||||||
|
|
||||||
const users = await this.userEntityService.packMany(Object.keys(this.typers), null, { detail: false });
|
const users = await this.userEntityService.packMany(Object.keys(this.typers), null, { schema: 'UserLite' });
|
||||||
|
|
||||||
this.send({
|
this.send({
|
||||||
type: 'typers',
|
type: 'typers',
|
||||||
|
@ -25,10 +25,9 @@ class MessagingIndexChannel extends Channel {
|
|||||||
export class MessagingIndexChannelService {
|
export class MessagingIndexChannelService {
|
||||||
public readonly shouldShare = MessagingIndexChannel.shouldShare;
|
public readonly shouldShare = MessagingIndexChannel.shouldShare;
|
||||||
public readonly requireCredential = MessagingIndexChannel.requireCredential;
|
public readonly requireCredential = MessagingIndexChannel.requireCredential;
|
||||||
|
public readonly kind: string = 'messagingIndex'; // kind の型を string に変更し、適切な値を代入する
|
||||||
|
|
||||||
constructor(
|
constructor() {}
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public create(id: string, connection: Channel['connection']): MessagingIndexChannel {
|
public create(id: string, connection: Channel['connection']): MessagingIndexChannel {
|
||||||
|
@ -113,7 +113,7 @@ class MessagingChannel extends Channel {
|
|||||||
if (now.getTime() - date.getTime() > 5000) delete this.typers[userId];
|
if (now.getTime() - date.getTime() > 5000) delete this.typers[userId];
|
||||||
}
|
}
|
||||||
|
|
||||||
const users = await this.userEntityService.packMany(Object.keys(this.typers), null, { detail: false });
|
const users = await this.userEntityService.packMany(Object.keys(this.typers), null, { schema: "UserLite" });
|
||||||
|
|
||||||
this.send({
|
this.send({
|
||||||
type: 'typers',
|
type: 'typers',
|
||||||
@ -133,6 +133,7 @@ class MessagingChannel extends Channel {
|
|||||||
export class MessagingChannelService {
|
export class MessagingChannelService {
|
||||||
public readonly shouldShare = MessagingChannel.shouldShare;
|
public readonly shouldShare = MessagingChannel.shouldShare;
|
||||||
public readonly requireCredential = MessagingChannel.requireCredential;
|
public readonly requireCredential = MessagingChannel.requireCredential;
|
||||||
|
public readonly kind: string = 'messaging'; // kind の型を string に変更し、適切な値に設定する
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(DI.usersRepository)
|
@Inject(DI.usersRepository)
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
<!--
|
||||||
|
SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||||
|
SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<MkModalWindow
|
<MkModalWindow
|
||||||
ref="dialog"
|
ref="dialog"
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
<!--
|
||||||
|
SPDX-FileCopyrightText: syuilo and misskey-project & noridev and cherrypick-project
|
||||||
|
SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<Transition
|
<Transition
|
||||||
|
@ -45,7 +45,7 @@ import { globalEvents } from '@/events.js';
|
|||||||
import { injectReactiveMetadata } from '@/scripts/page-metadata.js';
|
import { injectReactiveMetadata } from '@/scripts/page-metadata.js';
|
||||||
import { deviceKind } from '@/scripts/device-kind.js';
|
import { deviceKind } from '@/scripts/device-kind.js';
|
||||||
import { defaultStore } from '@/store.js';
|
import { defaultStore } from '@/store.js';
|
||||||
import {mainRouter} from "@/router/main.js";
|
import { mainRouter } from "@/router/main.js";
|
||||||
|
|
||||||
const MOBILE_THRESHOLD = 500;
|
const MOBILE_THRESHOLD = 500;
|
||||||
|
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
import { MenuItem } from '@/types/menu.js';
|
import { MenuItem } from '@/types/menu.js';
|
||||||
|
|
||||||
// Add dividers between menu sections. if some menu section has menu item
|
// Add dividers between menu sections. if some menu section has menu item
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
import { detect } from 'tinyld';
|
import { detect } from 'tinyld';
|
||||||
import * as mfm from 'cherrypick-mfm-js';
|
import * as mfm from 'cherrypick-mfm-js';
|
||||||
|
|
||||||
|
1222
pnpm-lock.yaml
1222
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user