Merge branch 'feature/emoji-grid' of https://github.com/samunohito/misskey into pr/13473

This commit is contained in:
syuilo 2024-03-20 16:48:09 +09:00
commit 5c1bf0674c
14 changed files with 372 additions and 181 deletions

View File

@ -12,12 +12,19 @@
- Enhance: リアクション受け入れが「いいねのみ」の場合はリアクション絵文字一覧を表示しないように - Enhance: リアクション受け入れが「いいねのみ」の場合はリアクション絵文字一覧を表示しないように
- Enhance: 設定>プラグインのページからプラグインの簡易的なログやエラーを見られるように - Enhance: 設定>プラグインのページからプラグインの簡易的なログやエラーを見られるように
- 実装の都合により、プラグインは1つエラーを起こした時に即時停止するようになりました - 実装の都合により、プラグインは1つエラーを起こした時に即時停止するようになりました
- Enhance: ページのデザインを変更
- Fix: 一部のページ内リンクが正しく動作しない問題を修正 - Fix: 一部のページ内リンクが正しく動作しない問題を修正
- Fix: 周年の実績が閏年を考慮しない問題を修正 - Fix: 周年の実績が閏年を考慮しない問題を修正
- Fix: ローカルURLのプレビューポップアップが左上に表示される - Fix: ローカルURLのプレビューポップアップが左上に表示される
- Fix: WebGL2をサポートしないブラウザで「季節に応じた画面の演出」が有効になっているとき、Misskeyが起動できなくなる問題を修正
(Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/459)
- Fix: ページタイトルでローカルユーザーとリモートユーザーの区別がつかない問題を修正
(Cherry-picked from https://github.com/MisskeyIO/misskey/pull/528)
### Server ### Server
- Enhance: エンドポイント`antennas/update`の必須項目を`antennaId`のみに - Enhance: エンドポイント`antennas/update`の必須項目を`antennaId`のみに
- Fix: フォローリクエストを作成する際に既存のものは削除するように
(Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/440)
## 2024.3.1 ## 2024.3.1

View File

@ -511,6 +511,12 @@ export class UserFollowingService implements OnModuleInit {
if (blocking) throw new Error('blocking'); if (blocking) throw new Error('blocking');
if (blocked) throw new Error('blocked'); if (blocked) throw new Error('blocked');
// Remove old follow requests before creating a new one.
await this.followRequestsRepository.delete({
followeeId: followee.id,
followerId: follower.id,
});
const followRequest = await this.followRequestsRepository.insert({ const followRequest = await this.followRequestsRepository.insert({
id: this.idService.gen(), id: this.idService.gen(),
followerId: follower.id, followerId: follower.id,

View File

@ -2,7 +2,7 @@ extends ./base
block vars block vars
- const user = note.user; - const user = note.user;
- const title = user.name ? `${user.name} (@${user.username})` : `@${user.username}`; - const title = user.name ? `${user.name} (@${user.username}${user.host ? `@${user.host}` : ''})` : `@${user.username}${user.host ? `@${user.host}` : ''}`;
- const url = `${config.url}/notes/${note.id}`; - const url = `${config.url}/notes/${note.id}`;
- const isRenote = note.renote && note.text == null && note.fileIds.length == 0 && note.poll == null; - const isRenote = note.renote && note.text == null && note.fileIds.length == 0 && note.poll == null;
- const images = (note.files || []).filter(file => file.type.startsWith('image/') && !file.isSensitive) - const images = (note.files || []).filter(file => file.type.startsWith('image/') && !file.isSensitive)
@ -28,7 +28,7 @@ block og
// FIXME: add embed player for Twitter // FIXME: add embed player for Twitter
if images.length if images.length
meta(property='twitter:card' content='summary_large_image') meta(property='twitter:card' content='summary_large_image')
each image in images each image in images
meta(property='og:image' content= image.url) meta(property='og:image' content= image.url)
else else
meta(property='twitter:card' content='summary') meta(property='twitter:card' content='summary')

View File

@ -1,7 +1,7 @@
extends ./base extends ./base
block vars block vars
- const title = user.name ? `${user.name} (@${user.username})` : `@${user.username}`; - const title = user.name ? `${user.name} (@${user.username}${user.host ? `@${user.host}` : ''})` : `@${user.username}${user.host ? `@${user.host}` : ''}`;
- const url = `${config.url}/@${(user.host ? `${user.username}@${user.host}` : user.username)}`; - const url = `${config.url}/@${(user.host ? `${user.username}@${user.host}` : user.username)}`;
block title block title

View File

@ -1,4 +1,7 @@
import crypto from "node:crypto"; /*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
/** /**
* AIで生成した無作為なファーストネーム * AIで生成した無作為なファーストネーム

View File

@ -75,27 +75,31 @@ export async function mainBoot() {
mainRouter.push('/search'); mainRouter.push('/search');
}, },
}; };
try {
if (defaultStore.state.enableSeasonalScreenEffect) { if (defaultStore.state.enableSeasonalScreenEffect) {
const month = new Date().getMonth() + 1; const month = new Date().getMonth() + 1;
if (defaultStore.state.hemisphere === 'S') { if (defaultStore.state.hemisphere === 'S') {
// ▼南半球 // ▼南半球
if (month === 7 || month === 8) { if (month === 7 || month === 8) {
const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect; const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
new SnowfallEffect({}).render(); new SnowfallEffect({}).render();
}
} else {
// ▼北半球
if (month === 12 || month === 1) {
const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
new SnowfallEffect({}).render();
} else if (month === 3 || month === 4) {
const SakuraEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
new SakuraEffect({
sakura: true,
}).render();
}
} }
} else { }
// ▼北半球 } catch (error) {
if (month === 12 || month === 1) { // console.error(error);
const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect; console.error('Failed to initialise the seasonal screen effect canvas context:', error);
new SnowfallEffect({}).render();
} else if (month === 3 || month === 4) {
const SakuraEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
new SakuraEffect({
sakura: true,
}).render();
}
}
} }
if ($i) { if ($i) {

View File

@ -4,19 +4,15 @@ SPDX-License-Identifier: AGPL-3.0-only
--> -->
<template> <template>
<div> <div :class="$style.root">
<MediaImage <MkMediaList v-if="image" :mediaList="[image]" :class="$style.mediaList"/>
v-if="image"
:image="image"
:disableImageLink="true"
/>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import MediaImage from '@/components/MkMediaImage.vue'; import MkMediaList from '@/components/MkMediaList.vue';
const props = defineProps<{ const props = defineProps<{
block: Misskey.entities.PageBlock, block: Misskey.entities.PageBlock,
@ -28,5 +24,17 @@ const image = ref<Misskey.entities.DriveFile | null>(null);
onMounted(() => { onMounted(() => {
image.value = props.page.attachedFiles.find(x => x.id === props.block.fileId) ?? null; image.value = props.page.attachedFiles.find(x => x.id === props.block.fileId) ?? null;
}); });
</script> </script>
<style lang="scss" module>
.root {
border: 1px solid var(--divider);
border-radius: var(--radius);
overflow: hidden;
}
.mediaList {
// MkMediaList 4px
margin-top: -4px;
height: calc(100% + 4px);
}
</style>

View File

@ -4,9 +4,9 @@ SPDX-License-Identifier: AGPL-3.0-only
--> -->
<template> <template>
<div style="margin: 1em 0;"> <div :class="$style.root">
<MkNote v-if="note && !block.detailed" :key="note.id + ':normal'" v-model:note="note"/> <MkNote v-if="note && !block.detailed" :key="note.id + ':normal'" :note="note"/>
<MkNoteDetailed v-if="note && block.detailed" :key="note.id + ':detail'" v-model:note="note"/> <MkNoteDetailed v-if="note && block.detailed" :key="note.id + ':detail'" :note="note"/>
</div> </div>
</template> </template>
@ -32,3 +32,10 @@ onMounted(() => {
}); });
}); });
</script> </script>
<style lang="scss" module>
.root {
border: 1px solid var(--divider);
border-radius: var(--radius);
}
</style>

View File

@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
--> -->
<template> <template>
<div class="_gaps"> <div class="_gaps" :class="$style.textRoot">
<Mfm :text="block.text ?? ''" :isNote="false"/> <Mfm :text="block.text ?? ''" :isNote="false"/>
<MkUrlPreview v-for="url in urls" :key="url" :url="url"/> <MkUrlPreview v-for="url in urls" :key="url" :url="url"/>
</div> </div>
@ -25,3 +25,9 @@ const props = defineProps<{
const urls = props.block.text ? extractUrlFromMfm(mfm.parse(props.block.text)) : []; const urls = props.block.text ? extractUrlFromMfm(mfm.parse(props.block.text)) : [];
</script> </script>
<style lang="scss" module>
.textRoot {
font-size: 1.1rem;
}
</style>

View File

@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
--> -->
<template> <template>
<div :class="{ [$style.center]: page.alignCenter, [$style.serif]: page.font === 'serif' }" class="_gaps_s"> <div :class="{ [$style.center]: page.alignCenter, [$style.serif]: page.font === 'serif' }" class="_gaps">
<XBlock v-for="child in page.content" :key="child.id" :page="page" :block="child" :h="2"/> <XBlock v-for="child in page.content" :key="child.id" :page="page" :block="child" :h="2"/>
</div> </div>
</template> </template>

View File

@ -8,7 +8,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<XContainer :draggable="true" @remove="() => $emit('remove')"> <XContainer :draggable="true" @remove="() => $emit('remove')">
<template #header><i class="ti ti-note"></i> {{ i18n.ts._pages.blocks.note }}</template> <template #header><i class="ti ti-note"></i> {{ i18n.ts._pages.blocks.note }}</template>
<section style="padding: 0 16px 0 16px;"> <section style="padding: 16px;" class="_gaps_s">
<MkInput v-model="id"> <MkInput v-model="id">
<template #label>{{ i18n.ts._pages.blocks._note.id }}</template> <template #label>{{ i18n.ts._pages.blocks._note.id }}</template>
<template #caption>{{ i18n.ts._pages.blocks._note.idDescription }}</template> <template #caption>{{ i18n.ts._pages.blocks._note.idDescription }}</template>

View File

@ -6,48 +6,73 @@ SPDX-License-Identifier: AGPL-3.0-only
<template> <template>
<MkStickyContainer> <MkStickyContainer>
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template> <template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
<MkSpacer :contentMax="700"> <MkSpacer :contentMax="800">
<Transition :name="defaultStore.state.animation ? 'fade' : ''" mode="out-in"> <Transition
<div v-if="page" :key="page.id" class="xcukqgmh"> :enterActiveClass="defaultStore.state.animation ? $style.fadeEnterActive : ''"
<div class="main"> :leaveActiveClass="defaultStore.state.animation ? $style.fadeLeaveActive : ''"
<!-- :enterFromClass="defaultStore.state.animation ? $style.fadeEnterFrom : ''"
<div class="header"> :leaveToClass="defaultStore.state.animation ? $style.fadeLeaveTo : ''"
<h1>{{ page.title }}</h1> >
</div> <div v-if="page" :key="page.id" class="_gaps">
--> <div :class="$style.pageMain">
<div class="banner"> <div :class="$style.pageBanner">
<MkMediaImage <div :class="$style.pageBannerBgRoot">
v-if="page.eyeCatchingImageId" <MkImgWithBlurhash
:image="page.eyeCatchingImage" v-if="page.eyeCatchingImageId"
:cover="true" :class="$style.pageBannerBg"
:disableImageLink="true" :hash="page.eyeCatchingImage?.blurhash"
class="thumbnail" :cover="true"
/> :forceBlurhash="true"
/>
<img
v-else-if="instance.backgroundImageUrl || instance.bannerUrl"
:class="[$style.pageBannerBg, $style.pageBannerBgFallback1]"
:src="getStaticImageUrl(instance.backgroundImageUrl ?? instance.bannerUrl!)"
/>
<div v-else :class="[$style.pageBannerBg, $style.pageBannerBgFallback2]"></div>
</div>
<div v-if="page.eyeCatchingImageId" :class="$style.pageBannerImage">
<MkMediaImage
:image="page.eyeCatchingImage!"
:cover="true"
:disableImageLink="true"
:class="$style.thumbnail"
/>
</div>
<div :class="$style.pageBannerTitle" class="_gaps_s">
<h1>{{ page.title || page.name }}</h1>
<div v-if="page.user" :class="$style.pageBannerTitleUser">
<MkAvatar :user="page.user" :class="$style.avatar" indicator link preview/> <MkA :to="`/@${username}`"><MkUserName :user="page.user" :nowrap="false"/></MkA>
</div>
</div>
</div> </div>
<div class="content"> <div :class="$style.pageContent">
<XPage :page="page"/> <XPage :page="page"/>
</div> </div>
<div class="actions"> <div :class="$style.pageActions">
<div class="like"> <div>
<MkButton v-if="page.isLiked" v-tooltip="i18n.ts._pages.unlike" class="button" asLike primary @click="unlike()"><i class="ti ti-heart-off"></i><span v-if="page.likedCount > 0" class="count">{{ page.likedCount }}</span></MkButton> <MkButton v-if="page.isLiked" v-tooltip="i18n.ts._pages.unlike" class="button" asLike primary @click="unlike()"><i class="ti ti-heart-off"></i><span v-if="page.likedCount > 0" class="count">{{ page.likedCount }}</span></MkButton>
<MkButton v-else v-tooltip="i18n.ts._pages.like" class="button" asLike @click="like()"><i class="ti ti-heart"></i><span v-if="page.likedCount > 0" class="count">{{ page.likedCount }}</span></MkButton> <MkButton v-else v-tooltip="i18n.ts._pages.like" class="button" asLike @click="like()"><i class="ti ti-heart"></i><span v-if="page.likedCount > 0" class="count">{{ page.likedCount }}</span></MkButton>
</div> </div>
<div class="other"> <div :class="$style.other">
<button v-tooltip="i18n.ts.shareWithNote" v-click-anime class="_button" @click="shareWithNote"><i class="ti ti-repeat ti-fw"></i></button> <button v-tooltip="i18n.ts.copyLink" class="_button" :class="$style.generalActionButton" @click="copyLink"><i class="ti ti-link ti-fw"></i></button>
<button v-tooltip="i18n.ts.copyLink" v-click-anime class="_button" @click="copyLink"><i class="ti ti-link ti-fw"></i></button> <button v-tooltip="i18n.ts.share" class="_button" :class="$style.generalActionButton" @click="share"><i class="ti ti-share ti-fw"></i></button>
<button v-if="isSupportShare()" v-tooltip="i18n.ts.share" v-click-anime class="_button" @click="share"><i class="ti ti-share ti-fw"></i></button>
</div> </div>
</div> </div>
<div class="user"> <div :class="$style.pageUser">
<MkAvatar :user="page.user" class="avatar" link preview/> <MkAvatar :user="page.user" :class="$style.avatar" link preview/>
<div class="name"> <MkA :to="`/@${username}`">
<MkUserName :user="page.user" style="display: block;"/> <MkUserName :user="page.user" :class="$style.name"/>
<MkAcct :user="page.user"/> <MkAcct :user="page.user" :class="$style.acct"/>
</div> </MkA>
<MkFollowButton v-if="!$i || $i.id != page.user.id" :user="page.user" :inline="true" :transparent="false" :full="true" large class="koudoku"/> <MkFollowButton v-if="!$i || $i.id != page.user.id" :user="page.user!" :inline="true" :transparent="false" :full="true" :class="$style.follow"/>
</div> </div>
<div class="links"> <div :class="$style.pageDate">
<MkA :to="`/@${username}/pages/${pageName}/view-source`" class="link">{{ i18n.ts._pages.viewSource }}</MkA> <div><i class="ti ti-clock"></i> {{ i18n.ts.createdAt }}: <MkTime :time="page.createdAt" mode="detail"/></div>
<div v-if="page.createdAt != page.updatedAt"><i class="ti ti-clock-edit"></i> {{ i18n.ts.updatedAt }}: <MkTime :time="page.updatedAt" mode="detail"/></div>
</div>
<div :class="$style.pageLinks">
<MkA v-if="!$i || $i.id !== page.userId" :to="`/@${username}/pages/${pageName}/view-source`" class="link">{{ i18n.ts._pages.viewSource }}</MkA>
<template v-if="$i && $i.id === page.userId"> <template v-if="$i && $i.id === page.userId">
<MkA :to="`/pages/edit/${page.id}`" class="link">{{ i18n.ts._pages.editThisPage }}</MkA> <MkA :to="`/pages/edit/${page.id}`" class="link">{{ i18n.ts._pages.editThisPage }}</MkA>
<button v-if="$i.pinnedPageId === page.id" class="link _textButton" @click="pin(false)">{{ i18n.ts.unpin }}</button> <button v-if="$i.pinnedPageId === page.id" class="link _textButton" @click="pin(false)">{{ i18n.ts.unpin }}</button>
@ -55,10 +80,6 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
</div> </div>
</div> </div>
<div class="footer">
<div><i class="ti ti-clock"></i> {{ i18n.ts.createdAt }}: <MkTime :time="page.createdAt" mode="detail"/></div>
<div v-if="page.createdAt != page.updatedAt"><i class="ti ti-clock"></i> {{ i18n.ts.updatedAt }}: <MkTime :time="page.updatedAt" mode="detail"/></div>
</div>
<MkAd :prefer="['horizontal', 'horizontal-big']"/> <MkAd :prefer="['horizontal', 'horizontal-big']"/>
<MkContainer :max-height="300" :foldable="true" class="other"> <MkContainer :max-height="300" :foldable="true" class="other">
<template #icon><i class="ti ti-clock"></i></template> <template #icon><i class="ti ti-clock"></i></template>
@ -84,6 +105,7 @@ import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js'; import { misskeyApi } from '@/scripts/misskey-api.js';
import { url } from '@/config.js'; import { url } from '@/config.js';
import MkMediaImage from '@/components/MkMediaImage.vue'; import MkMediaImage from '@/components/MkMediaImage.vue';
import MkImgWithBlurhash from '@/components/MkImgWithBlurhash.vue';
import MkFollowButton from '@/components/MkFollowButton.vue'; import MkFollowButton from '@/components/MkFollowButton.vue';
import MkContainer from '@/components/MkContainer.vue'; import MkContainer from '@/components/MkContainer.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination from '@/components/MkPagination.vue';
@ -94,6 +116,8 @@ import { pageViewInterruptors, defaultStore } from '@/store.js';
import { deepClone } from '@/scripts/clone.js'; import { deepClone } from '@/scripts/clone.js';
import { $i } from '@/account.js'; import { $i } from '@/account.js';
import { isSupportShare } from '@/scripts/navigator.js'; import { isSupportShare } from '@/scripts/navigator.js';
import { instance } from '@/instance.js';
import { getStaticImageUrl } from '@/scripts/media-proxy.js';
import copyToClipboard from '@/scripts/copy-to-clipboard.js'; import copyToClipboard from '@/scripts/copy-to-clipboard.js';
const props = defineProps<{ const props = defineProps<{
@ -133,35 +157,63 @@ function fetchPage() {
}); });
} }
function share() { function share(ev: MouseEvent) {
navigator.share({ if (!page.value) return;
title: page.value.title ?? page.value.name,
text: page.value.summary, os.popupMenu([
url: `${url}/@${page.value.user.username}/pages/${page.value.name}`, {
}); text: i18n.ts.shareWithNote,
icon: 'ti ti-pencil',
action: shareWithNote,
},
...(isSupportShare() ? [{
text: i18n.ts.share,
icon: 'ti ti-share',
action: shareWithNavigator,
}] : []),
], ev.currentTarget ?? ev.target);
} }
function copyLink() { function copyLink() {
if (!page.value) return;
copyToClipboard(`${url}/@${page.value.user.username}/pages/${page.value.name}`); copyToClipboard(`${url}/@${page.value.user.username}/pages/${page.value.name}`);
os.success(); os.success();
} }
function shareWithNote() { function shareWithNote() {
if (!page.value) return;
os.post({ os.post({
initialText: `${page.value.title || page.value.name} ${url}/@${page.value.user.username}/pages/${page.value.name}`, initialText: `${page.value.title || page.value.name}\n${url}/@${page.value.user.username}/pages/${page.value.name}`,
instant: true,
});
}
function shareWithNavigator() {
if (!page.value) return;
navigator.share({
title: page.value.title ?? page.value.name,
text: page.value.summary ?? undefined,
url: `${url}/@${page.value.user.username}/pages/${page.value.name}`,
}); });
} }
function like() { function like() {
if (!page.value) return;
os.apiWithDialog('pages/like', { os.apiWithDialog('pages/like', {
pageId: page.value.id, pageId: page.value.id,
}).then(() => { }).then(() => {
page.value.isLiked = true; page.value!.isLiked = true;
page.value.likedCount++; page.value!.likedCount++;
}); });
} }
async function unlike() { async function unlike() {
if (!page.value) return;
const confirm = await os.confirm({ const confirm = await os.confirm({
type: 'warning', type: 'warning',
text: i18n.ts.unlikeConfirm, text: i18n.ts.unlikeConfirm,
@ -170,12 +222,14 @@ async function unlike() {
os.apiWithDialog('pages/unlike', { os.apiWithDialog('pages/unlike', {
pageId: page.value.id, pageId: page.value.id,
}).then(() => { }).then(() => {
page.value.isLiked = false; page.value!.isLiked = false;
page.value.likedCount--; page.value!.likedCount--;
}); });
} }
function pin(pin) { function pin(pin) {
if (!page.value) return;
os.apiWithDialog('i/update', { os.apiWithDialog('i/update', {
pinnedPageId: pin ? page.value.id : null, pinnedPageId: pin ? page.value.id : null,
}); });
@ -200,109 +254,185 @@ definePageMetadata(() => ({
})); }));
</script> </script>
<style lang="scss" scoped> <style lang="scss" module>
.fade-enter-active, .fadeEnterActive,
.fade-leave-active { .fadeLeaveActive {
transition: opacity 0.125s ease; transition: opacity 0.125s ease;
} }
.fade-enter-from, .fadeEnterFrom,
.fade-leave-to { .fadeLeaveTo {
opacity: 0; opacity: 0;
} }
.xcukqgmh { .generalActionButton {
> .main { height: 2.5rem;
padding: 32px; width: 2.5rem;
text-align: center;
border-radius: 99rem;
> .header { & :global(.ti) {
padding: 16px; line-height: 2.5rem;
> h1 {
margin: 0;
}
}
> .banner {
> .thumbnail {
// TODO:
display: block;
width: 100%;
height: auto;
aspect-ratio: 3/1;
border-radius: var(--radius);
overflow: hidden;
object-fit: cover;
}
}
> .content {
margin-top: 16px;
padding: 16px 0 0 0;
}
> .actions {
display: flex;
align-items: center;
margin-top: 16px;
padding: 16px 0 0 0;
border-top: solid 0.5px var(--divider);
> .other {
margin-left: auto;
> button {
padding: 8px;
margin: 0 8px;
&:hover {
color: var(--fgHighlighted);
}
}
}
}
> .user {
margin-top: 16px;
padding: 16px 0 0 0;
border-top: solid 0.5px var(--divider);
display: flex;
align-items: center;
> .avatar {
width: 52px;
height: 52px;
}
> .name {
margin: 0 0 0 12px;
font-size: 90%;
}
> .koudoku {
margin-left: auto;
}
}
> .links {
margin-top: 16px;
padding: 24px 0 0 0;
border-top: solid 0.5px var(--divider);
> .link {
margin-right: 0.75em;
}
}
} }
> .footer { &:hover,
margin: var(--margin) 0 var(--margin) 0; &:focus-visible {
font-size: 85%; background-color: var(--accentedBg);
opacity: 0.75; color: var(--accent);
text-decoration: none;
} }
} }
</style>
<style module> .pageMain {
border-radius: var(--radius);
padding: 2rem;
background: var(--panel);
box-sizing: border-box;
}
.pageBanner {
width: calc(100% + 4rem);
margin: -2rem -2rem 1.5rem;
border-radius: var(--radius) var(--radius) 0 0;
overflow: hidden;
position: relative;
> .pageBannerBgRoot {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
.pageBannerBg {
width: 100%;
height: 100%;
object-fit: cover;
opacity: .2;
filter: brightness(1.2);
}
.pageBannerBgFallback1 {
filter: blur(20px);
}
.pageBannerBgFallback2 {
background-color: var(--accentedBg);
}
&::after {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 100px;
background: linear-gradient(0deg, var(--panel), transparent);
}
}
> .pageBannerImage {
position: relative;
padding-top: 56.25%;
> .thumbnail {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
}
> .pageBannerTitle {
position: relative;
padding: 1.5rem 2rem;
h1 {
font-size: 2rem;
font-weight: 700;
color: var(--fg);
margin: 0;
}
.pageBannerTitleUser {
--height: 32px;
.avatar {
height: var(--height);
width: var(--height);
}
line-height: var(--height);
}
}
}
.pageContent {
margin-bottom: 1.5rem;
}
.pageActions {
display: flex;
align-items: center;
border-top: 1px solid var(--divider);
padding-top: 1.5rem;
margin-bottom: 1.5rem;
> .other {
margin-left: auto;
display: flex;
gap: var(--marginHalf);
}
}
.pageUser {
display: flex;
align-items: center;
border-top: 1px solid var(--divider);
padding-top: 1.5rem;
margin-bottom: 1.5rem;
.avatar,
.name,
.acct {
display: block;
}
.avatar {
width: 4rem;
height: 4rem;
margin-right: 1rem;
}
.name {
font-size: 110%;
font-weight: 700;
}
.acct {
font-size: 90%;
opacity: 0.7;
}
.follow {
margin-left: auto;
}
}
.pageDate {
margin-bottom: 1.5rem;
}
.pageLinks {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: var(--marginHalf);
}
.relatedPagesRoot { .relatedPagesRoot {
padding: var(--margin); padding: var(--margin);
} }

View File

@ -155,7 +155,9 @@ export class SnowfallEffect {
max: 0.125, max: 0.125,
easing: 0.0005, easing: 0.0005,
}; };
/**
* @throws {Error} - Thrown when it fails to get WebGL context for the canvas
*/
constructor(options: { constructor(options: {
sakura?: boolean; sakura?: boolean;
}) { }) {

View File

@ -8,7 +8,12 @@ import { markRaw } from 'vue';
import { $i } from '@/account.js'; import { $i } from '@/account.js';
import { wsOrigin } from '@/config.js'; import { wsOrigin } from '@/config.js';
// heart beat interval in ms
const HEART_BEAT_INTERVAL = 1000 * 60;
let stream: Misskey.Stream | null = null; let stream: Misskey.Stream | null = null;
let timeoutHeartBeat: ReturnType<typeof setTimeout> | null = null;
let lastHeartbeatCall = 0;
export function useStream(): Misskey.Stream { export function useStream(): Misskey.Stream {
if (stream) return stream; if (stream) return stream;
@ -17,7 +22,18 @@ export function useStream(): Misskey.Stream {
token: $i.token, token: $i.token,
} : null)); } : null));
window.setTimeout(heartbeat, 1000 * 60); if (timeoutHeartBeat) window.clearTimeout(timeoutHeartBeat);
timeoutHeartBeat = window.setTimeout(heartbeat, HEART_BEAT_INTERVAL);
// send heartbeat right now when last send time is over HEART_BEAT_INTERVAL
document.addEventListener('visibilitychange', () => {
if (
!stream
|| document.visibilityState !== 'visible'
|| Date.now() - lastHeartbeatCall < HEART_BEAT_INTERVAL
) return;
heartbeat();
});
return stream; return stream;
} }
@ -26,5 +42,7 @@ function heartbeat(): void {
if (stream != null && document.visibilityState === 'visible') { if (stream != null && document.visibilityState === 'visible') {
stream.heartbeat(); stream.heartbeat();
} }
window.setTimeout(heartbeat, 1000 * 60); lastHeartbeatCall = Date.now();
if (timeoutHeartBeat) window.clearTimeout(timeoutHeartBeat);
timeoutHeartBeat = window.setTimeout(heartbeat, HEART_BEAT_INTERVAL);
} }