From c6e3ec07d1e2a66eb8f0660ebd699a103f690345 Mon Sep 17 00:00:00 2001 From: Marie Date: Fri, 26 Jan 2024 21:29:38 +0100 Subject: [PATCH 1/5] add: DeepLX-JS support Closes #324 --- .../backend/migration/1706232992000-deeplx.js | 18 +++++++ packages/backend/src/models/Meta.ts | 11 +++++ .../src/server/api/endpoints/admin/meta.ts | 10 ++++ .../server/api/endpoints/admin/update-meta.ts | 14 ++++++ .../backend/src/server/api/endpoints/meta.ts | 2 +- .../server/api/endpoints/notes/translate.ts | 49 ++++++++++++++----- .../src/pages/admin/external-services.vue | 13 +++++ 7 files changed, 103 insertions(+), 14 deletions(-) create mode 100644 packages/backend/migration/1706232992000-deeplx.js diff --git a/packages/backend/migration/1706232992000-deeplx.js b/packages/backend/migration/1706232992000-deeplx.js new file mode 100644 index 0000000000..5c763dbf8b --- /dev/null +++ b/packages/backend/migration/1706232992000-deeplx.js @@ -0,0 +1,18 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +export class Deeplx1706232992000 { + name = 'Deeplx1706232992000'; + + async up(queryRunner) { + await queryRunner.query(`ALTER TABLE "meta" ADD "deeplFreeMode" boolean NOT NULL DEFAULT false`); + await queryRunner.query(`ALTER TABLE "meta" ADD "deeplFreeInstance" character varying(1024)`); + } + + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "deeplFreeMode"`); + await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "deeplFreeInstance"`); + } +} diff --git a/packages/backend/src/models/Meta.ts b/packages/backend/src/models/Meta.ts index 6d5c4b3746..9629012c74 100644 --- a/packages/backend/src/models/Meta.ts +++ b/packages/backend/src/models/Meta.ts @@ -353,6 +353,17 @@ export class MiMeta { }) public deeplIsPro: boolean; + @Column('boolean', { + default: false, + }) + public deeplFreeMode: boolean; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public deeplFreeInstance: string | null; + @Column('varchar', { length: 1024, nullable: true, diff --git a/packages/backend/src/server/api/endpoints/admin/meta.ts b/packages/backend/src/server/api/endpoints/admin/meta.ts index 9fe997f889..c6edd6c9a1 100644 --- a/packages/backend/src/server/api/endpoints/admin/meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/meta.ts @@ -395,6 +395,14 @@ export const meta = { type: 'boolean', optional: false, nullable: false, }, + deeplFreeMode: { + type: 'boolean', + optional: false, nullable: false, + }, + deeplFreeInstance: { + type: 'string', + optional: false, nullable: true, + }, defaultDarkTheme: { type: 'string', optional: false, nullable: true, @@ -576,6 +584,8 @@ export default class extends Endpoint { // eslint- objectStorageS3ForcePathStyle: instance.objectStorageS3ForcePathStyle, deeplAuthKey: instance.deeplAuthKey, deeplIsPro: instance.deeplIsPro, + deeplFreeMode: instance.deeplFreeMode, + deeplFreeInstance: instance.deeplFreeInstance, enableIpLogging: instance.enableIpLogging, enableActiveEmailValidation: instance.enableActiveEmailValidation, enableVerifymailApi: instance.enableVerifymailApi, diff --git a/packages/backend/src/server/api/endpoints/admin/update-meta.ts b/packages/backend/src/server/api/endpoints/admin/update-meta.ts index 786a628d60..8c0d2f8876 100644 --- a/packages/backend/src/server/api/endpoints/admin/update-meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/update-meta.ts @@ -91,6 +91,8 @@ export const paramDef = { summalyProxy: { type: 'string', nullable: true }, deeplAuthKey: { type: 'string', nullable: true }, deeplIsPro: { type: 'boolean' }, + deeplFreeMode: { type: 'boolean' }, + deeplFreeInstance: { type: 'string', nullable: true }, enableEmail: { type: 'boolean' }, email: { type: 'string', nullable: true }, smtpSecure: { type: 'boolean' }, @@ -479,6 +481,18 @@ export default class extends Endpoint { // eslint- set.deeplIsPro = ps.deeplIsPro; } + if (ps.deeplFreeMode !== undefined) { + set.deeplFreeMode = ps.deeplFreeMode; + } + + if (ps.deeplFreeInstance !== undefined) { + if (ps.deeplFreeInstance === '') { + set.deeplFreeInstance = null; + } else { + set.deeplFreeInstance = ps.deeplFreeInstance; + } + } + if (ps.enableIpLogging !== undefined) { set.enableIpLogging = ps.enableIpLogging; } diff --git a/packages/backend/src/server/api/endpoints/meta.ts b/packages/backend/src/server/api/endpoints/meta.ts index af779aa850..8367536ad9 100644 --- a/packages/backend/src/server/api/endpoints/meta.ts +++ b/packages/backend/src/server/api/endpoints/meta.ts @@ -411,7 +411,7 @@ export default class extends Endpoint { // eslint- enableEmail: instance.enableEmail, enableServiceWorker: instance.enableServiceWorker, - translatorAvailable: instance.deeplAuthKey != null, + translatorAvailable: instance.deeplAuthKey != null || instance.deeplFreeMode && instance.deeplFreeInstance, serverRules: instance.serverRules, diff --git a/packages/backend/src/server/api/endpoints/notes/translate.ts b/packages/backend/src/server/api/endpoints/notes/translate.ts index 698c37b616..2afa515f9d 100644 --- a/packages/backend/src/server/api/endpoints/notes/translate.ts +++ b/packages/backend/src/server/api/endpoints/notes/translate.ts @@ -81,19 +81,23 @@ export default class extends Endpoint { // eslint- const instance = await this.metaService.fetch(); - if (instance.deeplAuthKey == null) { + if (instance.deeplAuthKey == null && !instance.deeplFreeMode) { return 204; // TODO: 良い感じのエラー返す } + if (instance.deeplFreeMode && !instance.deeplFreeInstance) { + return 204; + } + let targetLang = ps.targetLang; if (targetLang.includes('-')) targetLang = targetLang.split('-')[0]; const params = new URLSearchParams(); - params.append('auth_key', instance.deeplAuthKey); + if (instance.deeplAuthKey) params.append('auth_key', instance.deeplAuthKey); params.append('text', note.text); params.append('target_lang', targetLang); - const endpoint = instance.deeplIsPro ? 'https://api.deepl.com/v2/translate' : 'https://api-free.deepl.com/v2/translate'; + const endpoint = instance.deeplFreeMode && instance.deeplFreeInstance ? `https://${instance.deeplFreeInstance}` : instance.deeplIsPro ? 'https://api.deepl.com/v2/translate' : 'https://api-free.deepl.com/v2/translate'; const res = await this.httpRequestService.send(endpoint, { method: 'POST', @@ -103,18 +107,37 @@ export default class extends Endpoint { // eslint- }, body: params.toString(), }); + if (instance.deeplAuthKey) { + const json = (await res.json()) as { + translations: { + detected_source_language: string; + text: string; + }[]; + }; - const json = (await res.json()) as { - translations: { - detected_source_language: string; - text: string; - }[]; - }; + return { + sourceLang: json.translations[0].detected_source_language, + text: json.translations[0].text, + }; + } else { + const json = (await res.json()) as { + code: number, + message: string, + data: string, + source_lang: string, + target_lang: string, + alternatives: string[], + }; - return { - sourceLang: json.translations[0].detected_source_language, - text: json.translations[0].text, - }; + const languageNames = new Intl.DisplayNames(['en'], { + type: 'language', + }); + + return { + sourceLang: languageNames.of(json.source_lang), + text: json.data, + }; + } }); } } diff --git a/packages/frontend/src/pages/admin/external-services.vue b/packages/frontend/src/pages/admin/external-services.vue index 1a67a668de..9994b4641f 100644 --- a/packages/frontend/src/pages/admin/external-services.vue +++ b/packages/frontend/src/pages/admin/external-services.vue @@ -19,6 +19,13 @@ SPDX-License-Identifier: AGPL-3.0-only + + + + + + + @@ -49,17 +56,23 @@ import { definePageMetadata } from '@/scripts/page-metadata.js'; const deeplAuthKey = ref(''); const deeplIsPro = ref(false); +const deeplFreeMode = ref(false); +const deeplFreeInstance = ref(''); async function init() { const meta = await misskeyApi('admin/meta'); deeplAuthKey.value = meta.deeplAuthKey; deeplIsPro.value = meta.deeplIsPro; + deeplFreeMode.value = meta.deeplFreeMode; + deeplFreeInstance.value = meta.deeplFreeInstance; } function save() { os.apiWithDialog('admin/update-meta', { deeplAuthKey: deeplAuthKey.value, deeplIsPro: deeplIsPro.value, + deeplFreeMode: deeplFreeMode.value, + deeplFreeInstance: deeplFreeInstance.value, }).then(() => { fetchInstance(); }); From 074c47fdf8d6db8749f4e18c396321327e728951 Mon Sep 17 00:00:00 2001 From: Marie Date: Fri, 26 Jan 2024 21:31:14 +0100 Subject: [PATCH 2/5] upd: misskey-js api definitions --- packages/misskey-js/etc/misskey-js.api.md | 74 +++++++++++++++- .../misskey-js/src/autogen/apiClientJSDoc.ts | 86 ++++++++++++++++++- packages/misskey-js/src/autogen/endpoint.ts | 4 +- packages/misskey-js/src/autogen/entities.ts | 4 +- packages/misskey-js/src/autogen/models.ts | 4 +- packages/misskey-js/src/autogen/types.ts | 42 ++++++++- 6 files changed, 199 insertions(+), 15 deletions(-) diff --git a/packages/misskey-js/etc/misskey-js.api.md b/packages/misskey-js/etc/misskey-js.api.md index 26f100e452..57436d8e5b 100644 --- a/packages/misskey-js/etc/misskey-js.api.md +++ b/packages/misskey-js/etc/misskey-js.api.md @@ -85,6 +85,9 @@ type AdminAnnouncementsListResponse = operations['admin/announcements/list']['re // @public (undocumented) type AdminAnnouncementsUpdateRequest = operations['admin/announcements/update']['requestBody']['content']['application/json']; +// @public (undocumented) +type AdminApproveUserRequest = operations['admin/approve-user']['requestBody']['content']['application/json']; + // @public (undocumented) type AdminAvatarDecorationsCreateRequest = operations['admin/avatar-decorations/create']['requestBody']['content']['application/json']; @@ -208,6 +211,9 @@ type AdminInviteListResponse = operations['admin/invite/list']['responses']['200 // @public (undocumented) type AdminMetaResponse = operations['admin/meta']['responses']['200']['content']['application/json']; +// @public (undocumented) +type AdminNsfwUserRequest = operations['admin/nsfw-user']['requestBody']['content']['application/json']; + // @public (undocumented) type AdminPromoCreateRequest = operations['admin/promo/create']['requestBody']['content']['application/json']; @@ -304,15 +310,24 @@ type AdminShowUsersRequest = operations['admin/show-users']['requestBody']['cont // @public (undocumented) type AdminShowUsersResponse = operations['admin/show-users']['responses']['200']['content']['application/json']; +// @public (undocumented) +type AdminSilenceUserRequest = operations['admin/silence-user']['requestBody']['content']['application/json']; + // @public (undocumented) type AdminSuspendUserRequest = operations['admin/suspend-user']['requestBody']['content']['application/json']; +// @public (undocumented) +type AdminUnnsfwUserRequest = operations['admin/unnsfw-user']['requestBody']['content']['application/json']; + // @public (undocumented) type AdminUnsetUserAvatarRequest = operations['admin/unset-user-avatar']['requestBody']['content']['application/json']; // @public (undocumented) type AdminUnsetUserBannerRequest = operations['admin/unset-user-banner']['requestBody']['content']['application/json']; +// @public (undocumented) +type AdminUnsilenceUserRequest = operations['admin/unsilence-user']['requestBody']['content']['application/json']; + // @public (undocumented) type AdminUnsuspendUserRequest = operations['admin/unsuspend-user']['requestBody']['content']['application/json']; @@ -594,6 +609,13 @@ export type Channels = { }; receives: null; }; + bubbleTimeline: { + params: null; + events: { + note: (payload: Note) => void; + }; + receives: null; + }; userList: { params: { listId: string; @@ -1165,7 +1187,12 @@ declare namespace entities { AdminShowUserResponse, AdminShowUsersRequest, AdminShowUsersResponse, + AdminNsfwUserRequest, + AdminUnnsfwUserRequest, + AdminSilenceUserRequest, + AdminUnsilenceUserRequest, AdminSuspendUserRequest, + AdminApproveUserRequest, AdminUnsuspendUserRequest, AdminUpdateMetaRequest, AdminDeleteAccountRequest, @@ -1393,6 +1420,7 @@ declare namespace entities { IGalleryPostsResponse, IImportBlockingRequest, IImportFollowingRequest, + IImportNotesRequest, IImportMutingRequest, IImportUserListsRequest, IImportAntennasRequest, @@ -1410,6 +1438,7 @@ declare namespace entities { IRegenerateTokenRequest, IRegistryGetAllRequest, IRegistryGetAllResponse, + IRegistryGetUnsecureRequest, IRegistryGetDetailRequest, IRegistryGetDetailResponse, IRegistryGetRequest, @@ -1477,6 +1506,8 @@ declare namespace entities { NotesFeaturedResponse, NotesGlobalTimelineRequest, NotesGlobalTimelineResponse, + NotesBubbleTimelineRequest, + NotesBubbleTimelineResponse, NotesHybridTimelineRequest, NotesHybridTimelineResponse, NotesLocalTimelineRequest, @@ -1490,6 +1521,7 @@ declare namespace entities { NotesReactionsResponse, NotesReactionsCreateRequest, NotesReactionsDeleteRequest, + NotesLikeRequest, NotesRenotesRequest, NotesRenotesResponse, NotesRepliesRequest, @@ -1511,6 +1543,10 @@ declare namespace entities { NotesUnrenoteRequest, NotesUserListTimelineRequest, NotesUserListTimelineResponse, + NotesEditRequest, + NotesEditResponse, + NotesVersionsRequest, + NotesVersionsResponse, NotificationsCreateRequest, PagePushRequest, PagesCreateRequest, @@ -1619,6 +1655,7 @@ declare namespace entities { FetchExternalResourcesRequest, FetchExternalResourcesResponse, RetentionResponse, + SponsorsRequest, BubbleGameRegisterRequest, BubbleGameRegisterResponse, BubbleGameRankingRequest, @@ -2016,6 +2053,9 @@ type IImportFollowingRequest = operations['i/import-following']['requestBody'][' // @public (undocumented) type IImportMutingRequest = operations['i/import-muting']['requestBody']['content']['application/json']; +// @public (undocumented) +type IImportNotesRequest = operations['i/import-notes']['requestBody']['content']['application/json']; + // @public (undocumented) type IImportUserListsRequest = operations['i/import-user-lists']['requestBody']['content']['application/json']; @@ -2097,6 +2137,9 @@ type IRegistryGetRequest = operations['i/registry/get']['requestBody']['content' // @public (undocumented) type IRegistryGetResponse = operations['i/registry/get']['responses']['200']['content']['application/json']; +// @public (undocumented) +type IRegistryGetUnsecureRequest = operations['i/registry/get-unsecure']['requestBody']['content']['application/json']; + // @public (undocumented) type IRegistryKeysRequest = operations['i/registry/keys']['requestBody']['content']['application/json']; @@ -2196,6 +2239,9 @@ type ModerationLog = { } & ({ type: 'updateServerSettings'; info: ModerationLogPayloads['updateServerSettings']; +} | { + type: 'approve'; + info: ModerationLogPayloads['approve']; } | { type: 'suspend'; info: ModerationLogPayloads['suspend']; @@ -2307,7 +2353,7 @@ type ModerationLog = { }); // @public (undocumented) -export const moderationLogTypes: readonly ["updateServerSettings", "suspend", "unsuspend", "updateUserNote", "addCustomEmoji", "updateCustomEmoji", "deleteCustomEmoji", "assignRole", "unassignRole", "createRole", "updateRole", "deleteRole", "clearQueue", "promoteQueue", "deleteDriveFile", "deleteNote", "createGlobalAnnouncement", "createUserAnnouncement", "updateGlobalAnnouncement", "updateUserAnnouncement", "deleteGlobalAnnouncement", "deleteUserAnnouncement", "resetPassword", "suspendRemoteInstance", "unsuspendRemoteInstance", "markSensitiveDriveFile", "unmarkSensitiveDriveFile", "resolveAbuseReport", "createInvitation", "createAd", "updateAd", "deleteAd", "createAvatarDecoration", "updateAvatarDecoration", "deleteAvatarDecoration", "unsetUserAvatar", "unsetUserBanner"]; +export const moderationLogTypes: readonly ["updateServerSettings", "suspend", "approve", "unsuspend", "updateUserNote", "addCustomEmoji", "updateCustomEmoji", "deleteCustomEmoji", "assignRole", "unassignRole", "createRole", "updateRole", "deleteRole", "clearQueue", "promoteQueue", "deleteDriveFile", "deleteNote", "createGlobalAnnouncement", "createUserAnnouncement", "updateGlobalAnnouncement", "updateUserAnnouncement", "deleteGlobalAnnouncement", "deleteUserAnnouncement", "resetPassword", "suspendRemoteInstance", "unsuspendRemoteInstance", "markSensitiveDriveFile", "unmarkSensitiveDriveFile", "resolveAbuseReport", "createInvitation", "createAd", "updateAd", "deleteAd", "createAvatarDecoration", "updateAvatarDecoration", "deleteAvatarDecoration", "unsetUserAvatar", "unsetUserBanner"]; // @public (undocumented) type MuteCreateRequest = operations['mute/create']['requestBody']['content']['application/json']; @@ -2342,6 +2388,12 @@ type NoteFavorite = components['schemas']['NoteFavorite']; // @public (undocumented) type NoteReaction = components['schemas']['NoteReaction']; +// @public (undocumented) +type NotesBubbleTimelineRequest = operations['notes/bubble-timeline']['requestBody']['content']['application/json']; + +// @public (undocumented) +type NotesBubbleTimelineResponse = operations['notes/bubble-timeline']['responses']['200']['content']['application/json']; + // @public (undocumented) type NotesChildrenRequest = operations['notes/children']['requestBody']['content']['application/json']; @@ -2369,6 +2421,12 @@ type NotesCreateResponse = operations['notes/create']['responses']['200']['conte // @public (undocumented) type NotesDeleteRequest = operations['notes/delete']['requestBody']['content']['application/json']; +// @public (undocumented) +type NotesEditRequest = operations['notes/edit']['requestBody']['content']['application/json']; + +// @public (undocumented) +type NotesEditResponse = operations['notes/edit']['responses']['200']['content']['application/json']; + // @public (undocumented) type NotesFavoritesCreateRequest = operations['notes/favorites/create']['requestBody']['content']['application/json']; @@ -2393,6 +2451,9 @@ type NotesHybridTimelineRequest = operations['notes/hybrid-timeline']['requestBo // @public (undocumented) type NotesHybridTimelineResponse = operations['notes/hybrid-timeline']['responses']['200']['content']['application/json']; +// @public (undocumented) +type NotesLikeRequest = operations['notes/like']['requestBody']['content']['application/json']; + // @public (undocumented) type NotesLocalTimelineRequest = operations['notes/local-timeline']['requestBody']['content']['application/json']; @@ -2495,6 +2556,12 @@ type NotesUserListTimelineRequest = operations['notes/user-list-timeline']['requ // @public (undocumented) type NotesUserListTimelineResponse = operations['notes/user-list-timeline']['responses']['200']['content']['application/json']; +// @public (undocumented) +type NotesVersionsRequest = operations['notes/versions']['requestBody']['content']['application/json']; + +// @public (undocumented) +type NotesVersionsResponse = operations['notes/versions']['responses']['200']['content']['application/json']; + // @public (undocumented) export const noteVisibilities: readonly ["public", "home", "followers", "specified"]; @@ -2553,7 +2620,7 @@ type PagesUpdateRequest = operations['pages/update']['requestBody']['content'][' function parse(acct: string): Acct; // @public (undocumented) -export const permissions: readonly ["read:account", "write:account", "read:blocks", "write:blocks", "read:drive", "write:drive", "read:favorites", "write:favorites", "read:following", "write:following", "read:messaging", "write:messaging", "read:mutes", "write:mutes", "write:notes", "read:notifications", "write:notifications", "read:reactions", "write:reactions", "write:votes", "read:pages", "write:pages", "write:page-likes", "read:page-likes", "read:user-groups", "write:user-groups", "read:channels", "write:channels", "read:gallery", "write:gallery", "read:gallery-likes", "write:gallery-likes", "read:flash", "write:flash", "read:flash-likes", "write:flash-likes", "read:admin:abuse-user-reports", "write:admin:delete-account", "write:admin:delete-all-files-of-a-user", "read:admin:index-stats", "read:admin:table-stats", "read:admin:user-ips", "read:admin:meta", "write:admin:reset-password", "write:admin:resolve-abuse-user-report", "write:admin:send-email", "read:admin:server-info", "read:admin:show-moderation-log", "read:admin:show-user", "read:admin:show-users", "write:admin:suspend-user", "write:admin:unset-user-avatar", "write:admin:unset-user-banner", "write:admin:unsuspend-user", "write:admin:meta", "write:admin:user-note", "write:admin:roles", "read:admin:roles", "write:admin:relays", "read:admin:relays", "write:admin:invite-codes", "read:admin:invite-codes", "write:admin:announcements", "read:admin:announcements", "write:admin:avatar-decorations", "read:admin:avatar-decorations", "write:admin:federation", "write:admin:account", "read:admin:account", "write:admin:emoji", "read:admin:emoji", "write:admin:queue", "read:admin:queue", "write:admin:promo", "write:admin:drive", "read:admin:drive", "write:admin:ad", "read:admin:ad", "write:invite-codes", "read:invite-codes", "write:clip-favorite", "read:clip-favorite", "read:federation", "write:report-abuse"]; +export const permissions: readonly ["read:account", "write:account", "read:blocks", "write:blocks", "read:drive", "write:drive", "read:favorites", "write:favorites", "read:following", "write:following", "read:messaging", "write:messaging", "read:mutes", "write:mutes", "write:notes", "read:notifications", "write:notifications", "read:reactions", "write:reactions", "write:votes", "read:pages", "write:pages", "write:page-likes", "read:page-likes", "read:user-groups", "write:user-groups", "read:channels", "write:channels", "read:gallery", "write:gallery", "read:gallery-likes", "write:gallery-likes", "read:flash", "write:flash", "read:flash-likes", "write:flash-likes", "read:admin:abuse-user-reports", "write:admin:delete-account", "write:admin:delete-all-files-of-a-user", "read:admin:index-stats", "read:admin:table-stats", "read:admin:user-ips", "read:admin:meta", "write:admin:reset-password", "write:admin:resolve-abuse-user-report", "write:admin:send-email", "read:admin:server-info", "read:admin:show-moderation-log", "read:admin:show-user", "read:admin:show-users", "write:admin:suspend-user", "write:admin:approve-user", "write:admin:nsfw-user", "write:admin:unnsfw-user", "write:admin:silence-user", "write:admin:unsilence-user", "write:admin:unset-user-avatar", "write:admin:unset-user-banner", "write:admin:unsuspend-user", "write:admin:meta", "write:admin:user-note", "write:admin:roles", "read:admin:roles", "write:admin:relays", "read:admin:relays", "write:admin:invite-codes", "read:admin:invite-codes", "write:admin:announcements", "read:admin:announcements", "write:admin:avatar-decorations", "read:admin:avatar-decorations", "write:admin:federation", "write:admin:account", "read:admin:account", "write:admin:emoji", "read:admin:emoji", "write:admin:queue", "read:admin:queue", "write:admin:promo", "write:admin:drive", "read:admin:drive", "write:admin:ad", "read:admin:ad", "write:invite-codes", "read:invite-codes", "write:clip-favorite", "read:clip-favorite", "read:federation", "write:report-abuse"]; // @public (undocumented) type PingResponse = operations['ping']['responses']['200']['content']['application/json']; @@ -2746,6 +2813,9 @@ type SignupResponse = MeDetailed & { token: string; }; +// @public (undocumented) +type SponsorsRequest = operations['sponsors']['requestBody']['content']['application/json']; + // @public (undocumented) type StatsResponse = operations['stats']['responses']['200']['content']['application/json']; diff --git a/packages/misskey-js/src/autogen/apiClientJSDoc.ts b/packages/misskey-js/src/autogen/apiClientJSDoc.ts index 76c2c83b84..23f5cec2e5 100644 --- a/packages/misskey-js/src/autogen/apiClientJSDoc.ts +++ b/packages/misskey-js/src/autogen/apiClientJSDoc.ts @@ -1,6 +1,6 @@ /* - * version: 2024.2.0-beta.6 - * generatedAt: 2024-01-24T07:32:10.455Z + * version: 2024.2.0-beta2 + * generatedAt: 2024-01-26T20:30:18.423Z */ import type { SwitchCaseResponseType } from '../api.js'; @@ -691,6 +691,50 @@ declare module '../api.js' { credential?: string | null, ): Promise>; + /** + * No description provided. + * + * **Credential required**: *Yes* / **Permission**: *write:admin:nsfw-user* + */ + request( + endpoint: E, + params: P, + credential?: string | null, + ): Promise>; + + /** + * No description provided. + * + * **Credential required**: *Yes* / **Permission**: *write:admin:unnsfw-user* + */ + request( + endpoint: E, + params: P, + credential?: string | null, + ): Promise>; + + /** + * No description provided. + * + * **Credential required**: *Yes* / **Permission**: *write:admin:silence-user* + */ + request( + endpoint: E, + params: P, + credential?: string | null, + ): Promise>; + + /** + * No description provided. + * + * **Credential required**: *Yes* / **Permission**: *write:admin:unsilence-user* + */ + request( + endpoint: E, + params: P, + credential?: string | null, + ): Promise>; + /** * No description provided. * @@ -702,6 +746,17 @@ declare module '../api.js' { credential?: string | null, ): Promise>; + /** + * No description provided. + * + * **Credential required**: *Yes* / **Permission**: *write:admin:approve-user* + */ + request( + endpoint: E, + params: P, + credential?: string | null, + ): Promise>; + /** * No description provided. * @@ -2514,6 +2569,17 @@ declare module '../api.js' { credential?: string | null, ): Promise>; + /** + * No description provided. + * + * **Credential required**: *Yes* / **Permission**: *read:account* + */ + request( + endpoint: E, + params: P, + credential?: string | null, + ): Promise>; + /** * No description provided. * @@ -2993,6 +3059,17 @@ declare module '../api.js' { credential?: string | null, ): Promise>; + /** + * No description provided. + * + * **Credential required**: *No* + */ + request( + endpoint: E, + params: P, + credential?: string | null, + ): Promise>; + /** * No description provided. * @@ -4053,8 +4130,9 @@ declare module '../api.js' { params: P, credential?: string | null, ): Promise>; - - /** No description provided. + + /** + * No description provided. * * **Credential required**: *Yes* / **Permission**: *write:account* */ diff --git a/packages/misskey-js/src/autogen/endpoint.ts b/packages/misskey-js/src/autogen/endpoint.ts index 295b753401..79449a32c6 100644 --- a/packages/misskey-js/src/autogen/endpoint.ts +++ b/packages/misskey-js/src/autogen/endpoint.ts @@ -1,6 +1,6 @@ /* - * version: 2024.2.0-beta.6 - * generatedAt: 2024-01-24T07:32:10.453Z + * version: 2024.2.0-beta2 + * generatedAt: 2024-01-26T20:30:18.421Z */ import type { diff --git a/packages/misskey-js/src/autogen/entities.ts b/packages/misskey-js/src/autogen/entities.ts index ffe6fe79f8..c976ff9560 100644 --- a/packages/misskey-js/src/autogen/entities.ts +++ b/packages/misskey-js/src/autogen/entities.ts @@ -1,6 +1,6 @@ /* - * version: 2024.2.0-beta.6 - * generatedAt: 2024-01-24T07:32:10.452Z + * version: 2024.2.0-beta2 + * generatedAt: 2024-01-26T20:30:18.419Z */ import { operations } from './types.js'; diff --git a/packages/misskey-js/src/autogen/models.ts b/packages/misskey-js/src/autogen/models.ts index b7dcbfd951..3c400fb342 100644 --- a/packages/misskey-js/src/autogen/models.ts +++ b/packages/misskey-js/src/autogen/models.ts @@ -1,6 +1,6 @@ /* - * version: 2024.2.0-beta.6 - * generatedAt: 2024-01-24T07:32:10.450Z + * version: 2024.2.0-beta2 + * generatedAt: 2024-01-26T20:30:18.418Z */ import { components } from './types.js'; diff --git a/packages/misskey-js/src/autogen/types.ts b/packages/misskey-js/src/autogen/types.ts index ebdef3dc74..b812d0033b 100644 --- a/packages/misskey-js/src/autogen/types.ts +++ b/packages/misskey-js/src/autogen/types.ts @@ -2,8 +2,8 @@ /* eslint @typescript-eslint/no-explicit-any: 0 */ /* - * version: 2024.2.0-beta.6 - * generatedAt: 2024-01-24T07:32:10.370Z + * version: 2024.2.0-beta2 + * generatedAt: 2024-01-26T20:30:18.319Z */ /** @@ -4784,6 +4784,8 @@ export type operations = { backgroundImageUrl: string | null; deeplAuthKey: string | null; deeplIsPro: boolean; + deeplFreeMode: boolean; + deeplFreeInstance: string | null; defaultDarkTheme: string | null; defaultLightTheme: string | null; description: string | null; @@ -8795,6 +8797,8 @@ export type operations = { summalyProxy?: string | null; deeplAuthKey?: string | null; deeplIsPro?: boolean; + deeplFreeMode?: boolean; + deeplFreeInstance?: string | null; enableEmail?: boolean; email?: string | null; smtpSecure?: boolean; @@ -14101,6 +14105,7 @@ export type operations = { subscribing?: boolean | null; publishing?: boolean | null; nsfw?: boolean | null; + bubble?: boolean | null; /** @default 30 */ limit?: number; /** @default 0 */ @@ -26440,9 +26445,40 @@ export type operations = { 204: { content: never; }; + /** @description Client error */ + 400: { + content: { + 'application/json': components['schemas']['Error']; + }; + }; + /** @description Authentication error */ + 401: { + content: { + 'application/json': components['schemas']['Error']; + }; + }; + /** @description Forbidden error */ + 403: { + content: { + 'application/json': components['schemas']['Error']; + }; + }; + /** @description I'm Ai */ + 418: { + content: { + 'application/json': components['schemas']['Error']; + }; + }; + /** @description Internal server error */ + 500: { + content: { + 'application/json': components['schemas']['Error']; + }; + }; }; }; - /** bubble-game/register + /** + * bubble-game/register * @description No description provided. * * **Credential required**: *Yes* / **Permission**: *write:account* From 83f1c596b026266c7c43a92b8b634efcd8897e47 Mon Sep 17 00:00:00 2001 From: Marie Date: Fri, 26 Jan 2024 21:35:55 +0100 Subject: [PATCH 3/5] upd: add caption to deeplx url input --- packages/frontend/src/pages/admin/external-services.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/frontend/src/pages/admin/external-services.vue b/packages/frontend/src/pages/admin/external-services.vue index 9994b4641f..b1bf6c226c 100644 --- a/packages/frontend/src/pages/admin/external-services.vue +++ b/packages/frontend/src/pages/admin/external-services.vue @@ -25,6 +25,7 @@ SPDX-License-Identifier: AGPL-3.0-only + From 469c3f3f1a47a4aa866cd4c70a6bac5b63cdd88d Mon Sep 17 00:00:00 2001 From: Marie Date: Sat, 3 Feb 2024 12:38:45 +0000 Subject: [PATCH 4/5] upd: remove `https` --- packages/backend/src/server/api/endpoints/notes/translate.ts | 2 +- packages/frontend/src/pages/admin/external-services.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/notes/translate.ts b/packages/backend/src/server/api/endpoints/notes/translate.ts index 2afa515f9d..1397e0d6fe 100644 --- a/packages/backend/src/server/api/endpoints/notes/translate.ts +++ b/packages/backend/src/server/api/endpoints/notes/translate.ts @@ -97,7 +97,7 @@ export default class extends Endpoint { // eslint- params.append('text', note.text); params.append('target_lang', targetLang); - const endpoint = instance.deeplFreeMode && instance.deeplFreeInstance ? `https://${instance.deeplFreeInstance}` : instance.deeplIsPro ? 'https://api.deepl.com/v2/translate' : 'https://api-free.deepl.com/v2/translate'; + const endpoint = instance.deeplFreeMode && instance.deeplFreeInstance ? instance.deeplFreeInstance : instance.deeplIsPro ? 'https://api.deepl.com/v2/translate' : 'https://api-free.deepl.com/v2/translate'; const res = await this.httpRequestService.send(endpoint, { method: 'POST', diff --git a/packages/frontend/src/pages/admin/external-services.vue b/packages/frontend/src/pages/admin/external-services.vue index b1bf6c226c..bfdf3f0939 100644 --- a/packages/frontend/src/pages/admin/external-services.vue +++ b/packages/frontend/src/pages/admin/external-services.vue @@ -23,7 +23,7 @@ SPDX-License-Identifier: AGPL-3.0-only - + From 65a1bc219997ff3ecb3fe0f400b255c3bb385af1 Mon Sep 17 00:00:00 2001 From: Marie Date: Sat, 3 Feb 2024 18:49:41 +0100 Subject: [PATCH 5/5] upd: add i18n --- locales/en-US.yml | 2 ++ locales/index.d.ts | 8 ++++++++ locales/ja-JP.yml | 2 ++ packages/frontend/src/pages/admin/external-services.vue | 4 ++-- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/locales/en-US.yml b/locales/en-US.yml index 6c1cfc9940..62d092bd85 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -553,6 +553,8 @@ objectStorageUseProxy: "Connect over Proxy" objectStorageUseProxyDesc: "Turn this off if you are not going to use a Proxy for API connections" objectStorageSetPublicRead: "Set \"public-read\" on upload" s3ForcePathStyleDesc: "If s3ForcePathStyle is enabled, the bucket name has to included in the path of the URL as opposed to the hostname of the URL. You may need to enable this setting when using services such as a self-hosted Minio instance." +deeplFreeMode: "Use DeepLX-JS (No Auth Key)" +deeplFreeModeDescription: "Need Help? Check our documentation to know how to setup DeepLX-JS." serverLogs: "Server logs" deleteAll: "Delete all" showFixedPostForm: "Display the posting form at the top of the timeline" diff --git a/locales/index.d.ts b/locales/index.d.ts index 138c87b765..747e5a4ffe 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -2240,6 +2240,14 @@ export interface Locale extends ILocale { * s3ForcePathStyleを有効にすると、バケット名をURLのホスト名ではなくパスの一部として指定することを強制します。セルフホストされたMinioなどの使用時に有効にする必要がある場合があります。 */ "s3ForcePathStyleDesc": string; + /** + * DeepLX-JS を使用する (認証キーなし) + */ + "deeplFreeMode": string; + /** + * ヘルプが必要ですか? DeepLX-JSのセットアップ方法については、ドキュメントを参照してください。 + */ + "deeplFreeModeDescription": string; /** * サーバーログ */ diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index a154acca68..ab8d1d564f 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -556,6 +556,8 @@ objectStorageUseProxy: "Proxyを利用する" objectStorageUseProxyDesc: "API接続にproxyを利用しない場合はオフにしてください" objectStorageSetPublicRead: "アップロード時に'public-read'を設定する" s3ForcePathStyleDesc: "s3ForcePathStyleを有効にすると、バケット名をURLのホスト名ではなくパスの一部として指定することを強制します。セルフホストされたMinioなどの使用時に有効にする必要がある場合があります。" +deeplFreeMode: "DeepLX-JS を使用する (認証キーなし)" +deeplFreeModeDescription: "ヘルプが必要ですか? DeepLX-JSのセットアップ方法については、ドキュメントを参照してください。" serverLogs: "サーバーログ" deleteAll: "全て削除" showFixedPostForm: "タイムライン上部に投稿フォームを表示する" diff --git a/packages/frontend/src/pages/admin/external-services.vue b/packages/frontend/src/pages/admin/external-services.vue index bfdf3f0939..27d732f560 100644 --- a/packages/frontend/src/pages/admin/external-services.vue +++ b/packages/frontend/src/pages/admin/external-services.vue @@ -20,12 +20,12 @@ SPDX-License-Identifier: AGPL-3.0-only - + - +