Skip to content

Commit

Permalink
Merge branch 'develop' into enh-12854
Browse files Browse the repository at this point in the history
  • Loading branch information
kakkokari-gtyih authored Jan 18, 2024
2 parents 1138135 + 67a41c0 commit 148ee24
Show file tree
Hide file tree
Showing 14 changed files with 120 additions and 56 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
- Feat: 音声・映像プレイヤーを追加
- Feat: 絵文字の詳細ダイアログを追加
- Feat: 枠線をつけるMFM`$[border.width=1,style=solid,color=fff,radius=0 ...]`を追加
- デフォルトで枠線からはみ出る部分が隠されるようにしました。初期と同じ挙動にするには`$[border.noclip`が必要です
- Enhance: MFM等のコードブロックに全文コピー用のボタンを追加
- Enhance: ハッシュタグ入力時に、本文の末尾の行に何も書かれていない場合は新たにスペースを追加しないように
- Enhance: チャンネルノートのピン留めをノートのメニューからできるように
- Enhance: 管理者の場合はAPI tokenの発行画面で管理機能に関する権限を付与できるように
Expand All @@ -48,6 +50,7 @@
- Fix: `notes/create`で、`text`が空白文字のみで構成されているか`null`であって、かつ`text`だけであるリクエストに対するレスポンスが400になるように変更
- Fix: `notes/create`で、`text`が空白文字のみで構成されていてかつリノート、ファイルまたは投票を含んでいるリクエストに対するレスポンスの`text``""`から`null`になるように変更
- Fix: ipv4とipv6の両方が利用可能な環境でallowedPrivateNetworksが設定されていた場合プライベートipの検証ができていなかった問題を修正
- Fix: properly handle cc followers

## 2023.12.2

Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/core/activitypub/ApAudienceService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class ApAudienceService {
};
}

if (toGroups.followers.length > 0) {
if (toGroups.followers.length > 0 || ccGroups.followers.length > 0) {
return {
visibility: 'followers',
mentionedUsers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
throw new ApiError(meta.errors.invalidSeed);
}

// シードが古すぎる(1時間以上前)のも弾く
if (seedDate.getTime() < now.getTime() - 1000 * 60 * 60) {
// シードが古すぎる(5時間以上前)のも弾く
if (seedDate.getTime() < now.getTime() - 1000 * 60 * 60 * 5) {
throw new ApiError(meta.errors.invalidSeed);
}

Expand Down
60 changes: 38 additions & 22 deletions packages/frontend/src/components/MkCode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,64 @@ SPDX-License-Identifier: AGPL-3.0-only
-->

<template>
<Suspense>
<template #fallback>
<MkLoading v-if="!inline ?? true"/>
</template>
<code v-if="inline" :class="$style.codeInlineRoot">{{ code }}</code>
<XCode v-else-if="show && lang" :code="code" :lang="lang"/>
<pre v-else-if="show" :class="$style.codeBlockFallbackRoot"><code :class="$style.codeBlockFallbackCode">{{ code }}</code></pre>
<button v-else :class="$style.codePlaceholderRoot" @click="show = true">
<div :class="$style.codePlaceholderContainer">
<div><i class="ti ti-code"></i> {{ i18n.ts.code }}</div>
<div>{{ i18n.ts.clickToShow }}</div>
</div>
<div :class="$style.codeBlockRoot">
<button :class="$style.codeBlockCopyButton" class="_button" @click="copy">
<i class="ti ti-copy"></i>
</button>
</Suspense>
<Suspense>
<template #fallback>
<MkLoading />
</template>
<XCode v-if="show && lang" :code="code" :lang="lang"/>
<pre v-else-if="show" :class="$style.codeBlockFallbackRoot"><code :class="$style.codeBlockFallbackCode">{{ code }}</code></pre>
<button v-else :class="$style.codePlaceholderRoot" @click="show = true">
<div :class="$style.codePlaceholderContainer">
<div><i class="ti ti-code"></i> {{ i18n.ts.code }}</div>
<div>{{ i18n.ts.clickToShow }}</div>
</div>
</button>
</Suspense>
</div>
</template>

<script lang="ts" setup>
import { defineAsyncComponent, ref } from 'vue';
import * as os from '@/os.js';
import MkLoading from '@/components/global/MkLoading.vue';
import { defaultStore } from '@/store.js';
import { i18n } from '@/i18n.js';
import copyToClipboard from '@/scripts/copy-to-clipboard.js';

defineProps<{
const props = defineProps<{
code: string;
lang?: string;
inline?: boolean;
}>();

const show = ref(!defaultStore.state.dataSaver.code);

const XCode = defineAsyncComponent(() => import('@/components/MkCode.core.vue'));

function copy() {
copyToClipboard(props.code);
os.success();
}
</script>

<style module lang="scss">
.codeInlineRoot {
display: inline-block;
font-family: Consolas, Monaco, Andale Mono, Ubuntu Mono, monospace;
overflow-wrap: anywhere;
.codeBlockRoot {
position: relative;
}

.codeBlockCopyButton {
color: #D4D4D4;
background: #1E1E1E;
padding: .1em;
border-radius: .3em;
position: absolute;
top: 8px;
right: 8px;
opacity: 0.5;

&:hover {
opacity: 0.8;
}
}

.codeBlockFallbackRoot {
Expand Down
26 changes: 26 additions & 0 deletions packages/frontend/src/components/MkCodeInline.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!--
SPDX-FileCopyrightText: syuilo and other misskey contributors
SPDX-License-Identifier: AGPL-3.0-only
-->

<template>
<code :class="$style.root">{{ code }}</code>
</template>

<script lang="ts" setup>
const props = defineProps<{
code: string;
}>();
</script>

<style module lang="scss">
.root {
display: inline-block;
font-family: Consolas, Monaco, Andale Mono, Ubuntu Mono, monospace;
overflow-wrap: anywhere;
color: #D4D4D4;
background: #1E1E1E;
padding: .1em;
border-radius: .3em;
}
</style>
6 changes: 3 additions & 3 deletions packages/frontend/src/components/MkMediaAudio.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const rangePercent = computed({
audioEl.value.currentTime = to * durationMs.value / 1000;
},
});
const volume = ref(.5);
const volume = ref(.25);
const bufferedEnd = ref(0);
const bufferedDataRatio = computed(() => {
if (!audioEl.value) return 0;
Expand All @@ -161,7 +161,7 @@ function togglePlayPause() {

function toggleMute() {
if (volume.value === 0) {
volume.value = .5;
volume.value = .25;
} else {
volume.value = 0;
}
Expand Down Expand Up @@ -207,7 +207,7 @@ function init() {
isActuallyPlaying.value = false;
isPlaying.value = false;
});

durationMs.value = audioEl.value.duration * 1000;
audioEl.value.addEventListener('durationchange', () => {
if (audioEl.value) {
Expand Down
8 changes: 5 additions & 3 deletions packages/frontend/src/components/MkMediaRange.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ SPDX-License-Identifier: AGPL-3.0-only

<!-- Media系専用のinput range -->
<template>
<div :class="$style.controlsSeekbar" :style="sliderBgWhite ? '--sliderBg: rgba(255,255,255,.25);' : '--sliderBg: var(--scrollbarHandle);'">
<progress v-if="buffer !== undefined" :class="$style.buffer" :value="isNaN(buffer) ? 0 : buffer" min="0" max="1">{{ Math.round(buffer * 100) }}% buffered</progress>
<input v-model="model" :class="$style.seek" :style="`--value: ${modelValue * 100}%;`" type="range" min="0" max="1" step="any" @change="emit('dragEnded', modelValue)"/>
<div :style="sliderBgWhite ? '--sliderBg: rgba(255,255,255,.25);' : '--sliderBg: var(--scrollbarHandle);'">
<div :class="$style.controlsSeekbar">
<progress v-if="buffer !== undefined" :class="$style.buffer" :value="isNaN(buffer) ? 0 : buffer" min="0" max="1">{{ Math.round(buffer * 100) }}% buffered</progress>
<input v-model="model" :class="$style.seek" :style="`--value: ${modelValue * 100}%;`" type="range" min="0" max="1" step="any" @change="emit('dragEnded', modelValue)"/>
</div>
</div>
</template>

Expand Down
7 changes: 5 additions & 2 deletions packages/frontend/src/components/MkMediaVideo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ const rangePercent = computed({
videoEl.value.currentTime = to * durationMs.value / 1000;
},
});
const volume = ref(.5);
const volume = ref(.25);
const bufferedEnd = ref(0);
const bufferedDataRatio = computed(() => {
if (!videoEl.value) return 0;
Expand Down Expand Up @@ -236,7 +236,7 @@ function toggleFullscreen() {

function toggleMute() {
if (volume.value === 0) {
volume.value = .5;
volume.value = .25;
} else {
volume.value = 0;
}
Expand Down Expand Up @@ -535,6 +535,9 @@ onDeactivated(() => {

.seekbarRoot {
grid-area: seekbar;
/* ▼シークバー操作をやりやすくするためにクリックイベントが伝播されないエリアを拡張する */
margin: -10px;
padding: 10px;
}

@container (min-width: 500px) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import MkMention from '@/components/MkMention.vue';
import MkEmoji from '@/components/global/MkEmoji.vue';
import MkCustomEmoji from '@/components/global/MkCustomEmoji.vue';
import MkCode from '@/components/MkCode.vue';
import MkCodeInline from '@/components/MkCodeInline.vue';
import MkGoogle from '@/components/MkGoogle.vue';
import MkSparkle from '@/components/MkSparkle.vue';
import MkA from '@/components/global/MkA.vue';
Expand Down Expand Up @@ -266,7 +267,7 @@ export default function(props: MfmProps, context: SetupContext<MfmEvents>) {
) b_style = 'solid';
const width = parseFloat(token.props.args.width ?? '1');
const radius = parseFloat(token.props.args.radius ?? '0');
style = `border: ${width}px ${b_style} ${color}; border-radius: ${radius}px`;
style = `border: ${width}px ${b_style} ${color}; border-radius: ${radius}px;${token.props.args.noclip ? '' : ' overflow: clip;'}`;
break;
}
case 'ruby': {
Expand Down Expand Up @@ -373,10 +374,9 @@ export default function(props: MfmProps, context: SetupContext<MfmEvents>) {
}

case 'inlineCode': {
return [h(MkCode, {
return [h(MkCodeInline, {
key: Math.random(),
code: token.props.code,
inline: true,
})];
}

Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/filters/hms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { i18n } from '@/i18n.js';

export function hms(ms: number, options: {
export function hms(ms: number, options?: {
textFormat?: 'colon' | 'locale';
enableSeconds?: boolean;
enableMs?: boolean;
Expand Down
3 changes: 2 additions & 1 deletion packages/frontend/src/pages/drop-and-fusion.game.vue
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ const SWEETS_MONOS: FrontendMonoDefinition[] = [{
}];

const props = defineProps<{
gameMode: 'normal' | 'square' | 'yen' | 'sweets';
gameMode: 'normal' | 'square' | 'yen' | 'sweets' | 'space';
mute: boolean;
}>();

Expand All @@ -509,6 +509,7 @@ const monoDefinitions = computed(() => {
props.gameMode === 'square' ? SQUARE_MONOS :
props.gameMode === 'yen' ? YEN_MONOS :
props.gameMode === 'sweets' ? SWEETS_MONOS :
props.gameMode === 'space' ? NORAML_MONOS :
[] as never;
});

Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/pages/drop-and-fusion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<option value="square">SQUARE</option>
<option value="yen">YEN</option>
<option value="sweets">SWEETS</option>
<!--<option value="space">SPACE</option>-->
</MkSelect>
<MkButton primary gradate large rounded inline @click="start">{{ i18n.ts.start }}</MkButton>
</div>
Expand Down Expand Up @@ -94,7 +95,7 @@ import MkSelect from '@/components/MkSelect.vue';
import MkSwitch from '@/components/MkSwitch.vue';
import { misskeyApiGet } from '@/scripts/misskey-api.js';

const gameMode = ref<'normal' | 'square' | 'yen' | 'sweets'>('normal');
const gameMode = ref<'normal' | 'square' | 'yen' | 'sweets' | 'space'>('normal');
const gameStarted = ref(false);
const mute = ref(false);
const ranking = ref(null);
Expand All @@ -108,6 +109,7 @@ function getScoreUnit(gameMode: string) {
gameMode === 'square' ? 'pt' :
gameMode === 'yen' ? '円' :
gameMode === 'sweets' ? 'kcal' :
gameMode === 'space' ? 'pt' :
'' as never;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/pages/flash/flash.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template #icon><i class="ti ti-code"></i></template>
<template #label>{{ i18n.ts._play.viewSource }}</template>

<MkCode :code="flash.script" lang="is" :inline="false" class="_monospace"/>
<MkCode :code="flash.script" lang="is" class="_monospace"/>
</MkFolder>
<div :class="$style.footer">
<Mfm :text="`By @${flash.user.username}`"/>
Expand Down
Loading

0 comments on commit 148ee24

Please sign in to comment.