From 782ff23e9c1910727494e3854a65695bdd472434 Mon Sep 17 00:00:00 2001 From: mattyatea Date: Sat, 18 May 2024 01:14:00 +0900 Subject: [PATCH] update --- locales/index.d.ts | 10 ++++++-- .../backend/src/server/api/endpoints/i.ts | 11 ++++++++- .../frontend/src/components/MkPostForm.vue | 24 ++++++++++++++++--- packages/frontend/src/store.ts | 5 +++- 4 files changed, 43 insertions(+), 7 deletions(-) diff --git a/locales/index.d.ts b/locales/index.d.ts index 18a3186081..bea61a6d6b 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -88,6 +88,14 @@ export interface Locale extends ILocale { * ルビ */ "ruby": string; + /** + * ノートの下書きの復元を無効化 + */ + "disableNoteDrafting": string; + /** + * 隠れ家 + */ + "kakuregaFeature": string; /** * ピン留めされたチャンネル */ @@ -2604,8 +2612,6 @@ export interface Locale extends ILocale { * 内容を隠す */ "useCw": string; - "disableNoteDrafting":string; - "kakuregaFeature": string; /** * プレイヤーを開く */ diff --git a/packages/backend/src/server/api/endpoints/i.ts b/packages/backend/src/server/api/endpoints/i.ts index 6f36acb0b8..2b7a1d30fe 100644 --- a/packages/backend/src/server/api/endpoints/i.ts +++ b/packages/backend/src/server/api/endpoints/i.ts @@ -55,6 +55,7 @@ export default class extends Endpoint { // eslint- const now = new Date(); const today = `${now.getFullYear()}/${now.getMonth() + 1}/${now.getDate()}`; + let todayGetPoints = 0; // 渡ってきている user はキャッシュされていて古い可能性があるので改めて取得 const userProfile = await this.userProfilesRepository.findOne({ @@ -68,8 +69,16 @@ export default class extends Endpoint { // eslint- throw new ApiError(meta.errors.userIsDeleted); } + function generateSecureRandomNumber(min, max) { + const range = max - min + 1; + const randomBuffer = new Uint32Array(1); + crypto.getRandomValues(randomBuffer); + const randomNumber = randomBuffer[0] / (0xFFFFFFFF + 1); // 0から1未満の浮動小数点数 + return Math.floor(randomNumber * range) + min; + } + if (!userProfile.loggedInDates.includes(today)) { - todayGetPoints = Math.floor(Math.random() * 5) + 1; + todayGetPoints = generateSecureRandomNumber(1, 5); this.userProfilesRepository.update({ userId: user.id }, { loggedInDates: [...userProfile.loggedInDates, today], }); diff --git a/packages/frontend/src/components/MkPostForm.vue b/packages/frontend/src/components/MkPostForm.vue index 64219e2d4b..5b3d0720b8 100644 --- a/packages/frontend/src/components/MkPostForm.vue +++ b/packages/frontend/src/components/MkPostForm.vue @@ -42,8 +42,8 @@ SPDX-License-Identifier: AGPL-3.0-only
- - + +
@@ -1161,7 +1161,12 @@ function openOtherSettingsMenu(ev: MouseEvent) { }); } +const screenWidth = ref(0); onMounted(() => { + screenWidth.value = window.innerWidth; + window.addEventListener('resize', () => { + screenWidth.value = window.innerWidth; + }); if (props.autofocus) { focus(); @@ -1310,7 +1315,20 @@ defineExpose({ border-radius: 999px; pointer-events: none; } - +.submitInner i::after { + content: ""; +} +@media (width < 355px) { + .submitInner { + min-width: 20px !important; + } + .mgnlft{ + margin-left: 0 !important; + } +} +.mgnlft{ + margin-left: 6px; +} .submitInner { padding: 0 12px; line-height: 34px; diff --git a/packages/frontend/src/store.ts b/packages/frontend/src/store.ts index b03c3d0c96..7fb428802c 100644 --- a/packages/frontend/src/store.ts +++ b/packages/frontend/src/store.ts @@ -125,7 +125,10 @@ export const defaultStore = markRaw(new Storage('base', { where: 'account', default: 'yyyy-MM-dd HH-mm-ss [{{number}}]', }, - + disableNoteDrafting: { + where: 'account', + default: false, + }, keepOriginalUploading: { where: 'account', default: false,