diff --git a/locales/en-US.yml b/locales/en-US.yml index 1838b8363cca..816d3d611afc 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -1317,6 +1317,8 @@ consentAll: "Allow All Items" consentSelected: "Allow Selected Items" emailAddressLogin: "Login with email address" usernameLogin: "Login with username" +autoloadDrafts: "Automatically load drafts when opening the posting form" +drafts: "Drafts" _bubbleGame: howToPlay: "How to play" diff --git a/locales/index.d.ts b/locales/index.d.ts index a846fdf4db82..956bbd25c1b0 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -5330,6 +5330,14 @@ export interface Locale extends ILocale { * ユーザー名でログイン */ "usernameLogin": string; + /** + * 投稿フォームを開いたときに下書きを自動で読み込む + */ + "autoloadDrafts": string; + /** + * 下書き + */ + "drafts": string; "_bubbleGame": { /** * 遊び方 diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index ba80a2f691e5..99db90d7e211 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1326,6 +1326,8 @@ consentAll: "全て許可" consentSelected: "選択した項目のみ許可" emailAddressLogin: "メールアドレスでログイン" usernameLogin: "ユーザー名でログイン" +autoloadDrafts: "投稿フォームを開いたときに下書きを自動で読み込む" +drafts: "下書き" _bubbleGame: howToPlay: "遊び方" diff --git a/locales/ko-KR.yml b/locales/ko-KR.yml index 9ebb813580b4..d16a30044584 100644 --- a/locales/ko-KR.yml +++ b/locales/ko-KR.yml @@ -1314,6 +1314,8 @@ consentAll: "모두 허용" consentSelected: "선택한 항목만 허용" emailAddressLogin: "이메일 주소로 로그인" usernameLogin: "사용자명으로 로그인" +autoloadDrafts: "글 작성 시 자동으로 임시 저장된 글 불러오기" +drafts: "임시 저장" _bubbleGame: howToPlay: "설명" diff --git a/package.json b/package.json index 279377352242..7331e540f5a7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "misskey", - "version": "2024.5.0-host.5e", + "version": "2024.5.0-host.6", "codename": "nasubi", "repository": { "type": "git", diff --git a/packages/backend/src/core/chart/ChartManagementService.ts b/packages/backend/src/core/chart/ChartManagementService.ts index 79681370a17d..f04c561063d1 100644 --- a/packages/backend/src/core/chart/ChartManagementService.ts +++ b/packages/backend/src/core/chart/ChartManagementService.ts @@ -58,9 +58,9 @@ export class ChartManagementService implements OnApplicationShutdown { @bindThis public async start() { // 20分おきにメモリ情報をDBに書き込み - this.saveIntervalId = setInterval(() => { + this.saveIntervalId = setInterval(async () => { for (const chart of this.charts) { - chart.save(); + await chart.save(); } }, 1000 * 60 * 20); } @@ -69,9 +69,9 @@ export class ChartManagementService implements OnApplicationShutdown { public async dispose(): Promise { clearInterval(this.saveIntervalId); if (process.env.NODE_ENV !== 'test') { - await Promise.all( - this.charts.map(chart => chart.save()), - ); + for (const chart of this.charts) { + await chart.save(); + } } } diff --git a/packages/backend/src/queue/processors/CleanChartsProcessorService.ts b/packages/backend/src/queue/processors/CleanChartsProcessorService.ts index 110468801ce2..19f98c0d5115 100644 --- a/packages/backend/src/queue/processors/CleanChartsProcessorService.ts +++ b/packages/backend/src/queue/processors/CleanChartsProcessorService.ts @@ -48,20 +48,18 @@ export class CleanChartsProcessorService { public async process(): Promise { this.logger.info('Clean charts...'); - await Promise.all([ - this.federationChart.clean(), - this.notesChart.clean(), - this.usersChart.clean(), - this.activeUsersChart.clean(), - this.instanceChart.clean(), - this.perUserNotesChart.clean(), - this.perUserPvChart.clean(), - this.driveChart.clean(), - this.perUserReactionsChart.clean(), - this.perUserFollowingChart.clean(), - this.perUserDriveChart.clean(), - this.apRequestChart.clean(), - ]); + await this.federationChart.clean(); + await this.notesChart.clean(); + await this.usersChart.clean(); + await this.activeUsersChart.clean(); + await this.instanceChart.clean(); + await this.perUserNotesChart.clean(); + await this.perUserPvChart.clean(); + await this.driveChart.clean(); + await this.perUserReactionsChart.clean(); + await this.perUserFollowingChart.clean(); + await this.perUserDriveChart.clean(); + await this.apRequestChart.clean(); this.logger.succ('All charts successfully cleaned.'); } diff --git a/packages/backend/src/queue/processors/ResyncChartsProcessorService.ts b/packages/backend/src/queue/processors/ResyncChartsProcessorService.ts index 570cdf9a7504..46e1adf17312 100644 --- a/packages/backend/src/queue/processors/ResyncChartsProcessorService.ts +++ b/packages/backend/src/queue/processors/ResyncChartsProcessorService.ts @@ -31,11 +31,9 @@ export class ResyncChartsProcessorService { // TODO: ユーザーごとのチャートも更新する // TODO: インスタンスごとのチャートも更新する - await Promise.all([ - this.driveChart.resync(), - this.notesChart.resync(), - this.usersChart.resync(), - ]); + await this.driveChart.resync(); + await this.notesChart.resync(); + await this.usersChart.resync(); this.logger.succ('All charts successfully resynced.'); } diff --git a/packages/backend/src/queue/processors/TickChartsProcessorService.ts b/packages/backend/src/queue/processors/TickChartsProcessorService.ts index 93ec34162db4..c09cbccc57bd 100644 --- a/packages/backend/src/queue/processors/TickChartsProcessorService.ts +++ b/packages/backend/src/queue/processors/TickChartsProcessorService.ts @@ -48,20 +48,18 @@ export class TickChartsProcessorService { public async process(): Promise { this.logger.info('Tick charts...'); - await Promise.all([ - this.federationChart.tick(false), - this.notesChart.tick(false), - this.usersChart.tick(false), - this.activeUsersChart.tick(false), - this.instanceChart.tick(false), - this.perUserNotesChart.tick(false), - this.perUserPvChart.tick(false), - this.driveChart.tick(false), - this.perUserReactionsChart.tick(false), - this.perUserFollowingChart.tick(false), - this.perUserDriveChart.tick(false), - this.apRequestChart.tick(false), - ]); + await this.federationChart.tick(false); + await this.notesChart.tick(false); + await this.usersChart.tick(false); + await this.activeUsersChart.tick(false); + await this.instanceChart.tick(false); + await this.perUserNotesChart.tick(false); + await this.perUserPvChart.tick(false); + await this.driveChart.tick(false); + await this.perUserReactionsChart.tick(false); + await this.perUserFollowingChart.tick(false); + await this.perUserDriveChart.tick(false); + await this.apRequestChart.tick(false); this.logger.succ('All charts successfully ticked.'); } diff --git a/packages/backend/src/server/api/endpoints/notes/create.ts b/packages/backend/src/server/api/endpoints/notes/create.ts index 5bff7f718b32..963f3bbfdbe2 100644 --- a/packages/backend/src/server/api/endpoints/notes/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/create.ts @@ -40,7 +40,7 @@ export const meta = { res: { type: 'object', - optional: false, nullable: false, + optional: true, nullable: false, properties: { createdNote: { type: 'object', @@ -207,6 +207,7 @@ export const paramDef = { }, required: ['choices'], }, + noCreatedNote: { type: 'boolean', default: false }, }, // (re)note with text, files and poll are optional if: { @@ -281,7 +282,8 @@ export default class extends Endpoint { // eslint- const note = await this.notesRepository.findOneBy({ id: idempotent }); if (note) { logger.info('The request has already been processed.', { noteId: note.id }); - return { createdNote: await this.noteEntityService.pack(note, me) }; + if (ps.noCreatedNote) return; + else return { createdNote: await this.noteEntityService.pack(note, me) }; } } @@ -453,7 +455,8 @@ export default class extends Endpoint { // eslint- await this.redisForTimelines.set(`note:idempotent:${me.id}:${hash}`, note.id, 'EX', 60); logger.info('Successfully created a note.', { noteId: note.id }); - return { + if (ps.noCreatedNote) return; + else return { createdNote: await this.noteEntityService.pack(note, me), }; } catch (err) { diff --git a/packages/backend/src/server/web/cli.js b/packages/backend/src/server/web/cli.js index 30ee77f4d91d..2cffd60638e3 100644 --- a/packages/backend/src/server/web/cli.js +++ b/packages/backend/src/server/web/cli.js @@ -41,7 +41,8 @@ window.onload = async () => { document.getElementById('submit').addEventListener('click', () => { api('notes/create', { - text: document.getElementById('text').value + text: document.getElementById('text').value, + noCreatedNote: true, }).then(() => { location.reload(); }); diff --git a/packages/frontend/src/components/MkDraftsDialog.vue b/packages/frontend/src/components/MkDraftsDialog.vue new file mode 100644 index 000000000000..755bb2cf12be --- /dev/null +++ b/packages/frontend/src/components/MkDraftsDialog.vue @@ -0,0 +1,183 @@ + + + + + diff --git a/packages/frontend/src/components/MkPostForm.vue b/packages/frontend/src/components/MkPostForm.vue index 00e5f39665d8..94da01eb77ef 100644 --- a/packages/frontend/src/components/MkPostForm.vue +++ b/packages/frontend/src/components/MkPostForm.vue @@ -41,6 +41,9 @@ SPDX-License-Identifier: AGPL-3.0-only +
@@ -57,7 +58,9 @@ import { $i, openAccountMenu as openAccountMenu_ } from '@/account.js'; import { defaultStore } from '@/store.js'; import { i18n } from '@/i18n.js'; import { instance } from '@/instance.js'; +import { miLocalStorage } from "@/local-storage.js"; +const kawaiiMode = miLocalStorage.getItem('kawaii') === 'true'; const menu = toRef(defaultStore.state, 'menu'); const otherMenuItemIndicated = computed(() => { for (const def in navbarItemDef) { @@ -120,6 +123,11 @@ function more() { aspect-ratio: 1; } +.instanceIconAlt { + display: inline-block; + width: 85%; +} + .bottom { position: sticky; bottom: 0; diff --git a/packages/misskey-js/package.json b/packages/misskey-js/package.json index f5ed9f6ad4f8..89a1a5e277a3 100644 --- a/packages/misskey-js/package.json +++ b/packages/misskey-js/package.json @@ -1,7 +1,7 @@ { "type": "module", "name": "misskey-js", - "version": "2024.5.0-host.5e", + "version": "2024.5.0-host.6", "description": "Misskey SDK for JavaScript", "types": "./built/dts/index.d.ts", "exports": { diff --git a/packages/misskey-js/src/autogen/types.ts b/packages/misskey-js/src/autogen/types.ts index fd0acb5047a7..ef45d0b84f8d 100644 --- a/packages/misskey-js/src/autogen/types.ts +++ b/packages/misskey-js/src/autogen/types.ts @@ -23303,6 +23303,8 @@ export type operations = { expiresAt?: number | null; expiredAfter?: number | null; }) | null; + /** @default false */ + noCreatedNote?: boolean; }; }; }; @@ -23315,6 +23317,10 @@ export type operations = { }; }; }; + /** @description OK (without any results) */ + 204: { + content: never; + }; /** @description Client error */ 400: { content: { diff --git a/packages/sw/src/sw.ts b/packages/sw/src/sw.ts index cc79d887133c..e2f6ab86cde3 100644 --- a/packages/sw/src/sw.ts +++ b/packages/sw/src/sw.ts @@ -114,7 +114,7 @@ globalThis.addEventListener('notificationclick', (ev: ServiceWorkerGlobalScopeEv if ('note' in data.body) client = await swos.openPost({ reply: data.body.note }, loginId); break; case 'renote': - if ('note' in data.body) await swos.api('notes/create', loginId, { renoteId: data.body.note.id }); + if ('note' in data.body) await swos.api('notes/create', loginId, { renoteId: data.body.note.id, noCreatedNote: true }); break; case 'accept': switch (data.body.type) {