This commit is contained in:
mattyatea 2024-05-18 01:14:00 +09:00
parent 3f04b5bf8f
commit 782ff23e9c
4 changed files with 43 additions and 7 deletions

10
locales/index.d.ts vendored
View File

@ -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;
/**
*
*/

View File

@ -55,6 +55,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // 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<typeof meta, typeof paramDef> { // 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],
});

View File

@ -42,8 +42,8 @@ SPDX-License-Identifier: AGPL-3.0-only
<div :class="[$style.submitInner ,{ [$style.gamingDark]: gamingType === 'dark',[$style.gamingLight]: gamingType === 'light' }]">
<template v-if="posted"></template>
<template v-else-if="posting"><MkEllipsis/></template>
<template v-else>{{ submitText }}</template>
<i style="margin-left: 6px;" :class="posted ? 'ti ti-check' : reply ? 'ti ti-arrow-back-up' : renote ? 'ti ti-quote' : schedule ? 'ti ti-clock-hour-4' : 'ti ti-send'"></i>
<template v-else-if="screenWidth >= 355">{{ submitText }}</template>
<i :class="[posted ? 'ti ti-check' : reply ? 'ti ti-arrow-back-up' : renote ? 'ti ti-quote' : schedule ? 'ti ti-clock-hour-4' : 'ti ti-send',$style.mgnlft]"></i>
</div>
</button>
</div>
@ -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;

View File

@ -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,