Compare commits
No commits in common. "fdfd3163b1918994926f694537db3ae5b7cf758b" and "a34829c63d9b5d640d0d6de8bdca2c64c88dae3e" have entirely different histories.
fdfd3163b1
...
a34829c63d
|
@ -535,7 +535,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ck"
|
name = "ck"
|
||||||
version = "0.3.0-alpha"
|
version = "0.2.1-alpha"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"sea-orm",
|
"sea-orm",
|
||||||
"serde",
|
"serde",
|
||||||
|
@ -835,7 +835,7 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ext_calckey_model_migration"
|
name = "ext_calckey_model_migration"
|
||||||
version = "0.3.0-alpha"
|
version = "0.2.1-alpha"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"sea-orm-migration",
|
"sea-orm-migration",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
@ -1446,7 +1446,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "magnetar"
|
name = "magnetar"
|
||||||
version = "0.3.0-alpha"
|
version = "0.2.1-alpha"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"axum",
|
"axum",
|
||||||
"cached",
|
"cached",
|
||||||
|
@ -1482,12 +1482,11 @@ dependencies = [
|
||||||
"tracing",
|
"tracing",
|
||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
"unicode-segmentation",
|
"unicode-segmentation",
|
||||||
"url",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "magnetar_calckey_fe"
|
name = "magnetar_calckey_fe"
|
||||||
version = "0.3.0-alpha"
|
version = "0.2.1-alpha"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"axum",
|
"axum",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
@ -1511,7 +1510,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "magnetar_calckey_model"
|
name = "magnetar_calckey_model"
|
||||||
version = "0.3.0-alpha"
|
version = "0.2.1-alpha"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"ck",
|
"ck",
|
||||||
|
@ -1536,21 +1535,19 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "magnetar_common"
|
name = "magnetar_common"
|
||||||
version = "0.3.0-alpha"
|
version = "0.2.1-alpha"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"idna",
|
|
||||||
"magnetar_core",
|
"magnetar_core",
|
||||||
"magnetar_sdk",
|
"magnetar_sdk",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"serde",
|
"serde",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"toml 0.8.1",
|
"toml 0.8.1",
|
||||||
"url",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "magnetar_core"
|
name = "magnetar_core"
|
||||||
version = "0.3.0-alpha"
|
version = "0.2.1-alpha"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
@ -1558,7 +1555,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "magnetar_mmm_parser"
|
name = "magnetar_mmm_parser"
|
||||||
version = "0.3.0-alpha"
|
version = "0.2.1-alpha"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"compact_str",
|
"compact_str",
|
||||||
"either",
|
"either",
|
||||||
|
@ -1574,7 +1571,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "magnetar_nodeinfo"
|
name = "magnetar_nodeinfo"
|
||||||
version = "0.3.0-alpha"
|
version = "0.2.1-alpha"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
@ -1582,7 +1579,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "magnetar_sdk"
|
name = "magnetar_sdk"
|
||||||
version = "0.3.0-alpha"
|
version = "0.2.1-alpha"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"http",
|
"http",
|
||||||
|
@ -1596,7 +1593,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "magnetar_sdk_macros"
|
name = "magnetar_sdk_macros"
|
||||||
version = "0.3.0-alpha"
|
version = "0.2.1-alpha"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.28",
|
"syn 2.0.28",
|
||||||
|
@ -1604,7 +1601,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "magnetar_webfinger"
|
name = "magnetar_webfinger"
|
||||||
version = "0.3.0-alpha"
|
version = "0.2.1-alpha"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"magnetar_core",
|
"magnetar_core",
|
||||||
"serde",
|
"serde",
|
||||||
|
@ -3673,9 +3670,9 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "url"
|
name = "url"
|
||||||
version = "2.4.1"
|
version = "2.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5"
|
checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"form_urlencoded",
|
"form_urlencoded",
|
||||||
"idna",
|
"idna",
|
||||||
|
|
|
@ -19,7 +19,7 @@ members = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.3.0-alpha"
|
version = "0.2.1-alpha"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
|
@ -88,7 +88,6 @@ hyper = { workspace = true, features = ["full"] }
|
||||||
tokio = { workspace = true, features = ["full"] }
|
tokio = { workspace = true, features = ["full"] }
|
||||||
tower = { workspace = true }
|
tower = { workspace = true }
|
||||||
tower-http = { workspace = true, features = ["cors", "trace", "fs"] }
|
tower-http = { workspace = true, features = ["cors", "trace", "fs"] }
|
||||||
url = { workspace = true }
|
|
||||||
|
|
||||||
idna = { workspace = true }
|
idna = { workspace = true }
|
||||||
|
|
||||||
|
|
|
@ -47,19 +47,6 @@
|
||||||
# Environment variable: MAG_C_BIND_ADDR
|
# Environment variable: MAG_C_BIND_ADDR
|
||||||
# networking.bind_addr = "::"
|
# networking.bind_addr = "::"
|
||||||
|
|
||||||
# [Optional]
|
|
||||||
# The URL of a media proxy
|
|
||||||
# Default: null
|
|
||||||
# Environment variable: MAG_C_MEDIA_PROXY
|
|
||||||
# networking.media_proxy = ""
|
|
||||||
|
|
||||||
# [Optional]
|
|
||||||
# Whether to proxy remote files through this instance
|
|
||||||
# Default: false
|
|
||||||
# Environment variable: MAG_C_PROXY_REMOTE_FILES
|
|
||||||
# networking.proxy_remote_files = false
|
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------[ CALCKEY FRONTEND ]----------------------------
|
# -----------------------------[ CALCKEY FRONTEND ]----------------------------
|
||||||
|
|
||||||
# [Optional]
|
# [Optional]
|
||||||
|
|
|
@ -61,7 +61,6 @@ impl CalckeyModel {
|
||||||
.sqlx_logging_level(LevelFilter::Debug)
|
.sqlx_logging_level(LevelFilter::Debug)
|
||||||
.to_owned();
|
.to_owned();
|
||||||
|
|
||||||
info!("Attempting database connection...");
|
|
||||||
Ok(CalckeyModel(sea_orm::Database::connect(opt).await?))
|
Ok(CalckeyModel(sea_orm::Database::connect(opt).await?))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,18 +224,6 @@ impl CalckeyModel {
|
||||||
.await?)
|
.await?)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_instance(
|
|
||||||
&self,
|
|
||||||
host: &str,
|
|
||||||
) -> Result<Option<instance::Model>, CalckeyDbError> {
|
|
||||||
let instance = instance::Entity::find()
|
|
||||||
.filter(instance::Column::Host.eq(host))
|
|
||||||
.one(&self.0)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
Ok(instance)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn get_instance_meta(&self) -> Result<meta::Model, CalckeyDbError> {
|
pub async fn get_instance_meta(&self) -> Result<meta::Model, CalckeyDbError> {
|
||||||
let txn = self.0.begin().await?;
|
let txn = self.0.begin().await?;
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ use sea_orm::{
|
||||||
QueryFilter, QueryResult, QuerySelect, QueryTrait, RelationTrait, Select,
|
QueryFilter, QueryResult, QuerySelect, QueryTrait, RelationTrait, Select,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
use tracing::info;
|
||||||
|
|
||||||
use ck::{drive_file, note, note_reaction, user};
|
use ck::{drive_file, note, note_reaction, user};
|
||||||
use magnetar_sdk::types::RangeFilter;
|
use magnetar_sdk::types::RangeFilter;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@swc/cli": "^0.1.62",
|
"@swc/cli": "^0.1.62",
|
||||||
"@swc/core": "^1.3.62",
|
"@swc/core": "^1.3.62",
|
||||||
"@types/node": "20.8.10",
|
"@types/node": "20.3.1",
|
||||||
"ts-node": "10.4.0",
|
"ts-node": "10.4.0",
|
||||||
"tsd": "^0.28.1",
|
"tsd": "^0.28.1",
|
||||||
"typescript": "5.1.3"
|
"typescript": "5.1.3"
|
||||||
|
|
|
@ -15,8 +15,6 @@ export type UserLite = {
|
||||||
avatarUrl: string;
|
avatarUrl: string;
|
||||||
avatarBlurhash: string;
|
avatarBlurhash: string;
|
||||||
alsoKnownAs: string[];
|
alsoKnownAs: string[];
|
||||||
isCat?: boolean;
|
|
||||||
isBot?: boolean;
|
|
||||||
movedToUri: any;
|
movedToUri: any;
|
||||||
emojis: {
|
emojis: {
|
||||||
name: string;
|
name: string;
|
||||||
|
|
|
@ -1,937 +0,0 @@
|
||||||
<template>
|
|
||||||
<div
|
|
||||||
:aria-label="accessibleLabel"
|
|
||||||
v-if="!muted.muted"
|
|
||||||
v-show="!isDeleted"
|
|
||||||
ref="el"
|
|
||||||
v-hotkey="keymap"
|
|
||||||
v-size="{ max: [500, 350] }"
|
|
||||||
class="tkcbzcuz note-container"
|
|
||||||
:tabindex="!isDeleted ? '-1' : null"
|
|
||||||
:class="{ renote: isRenote }"
|
|
||||||
:id="appearNote.id"
|
|
||||||
>
|
|
||||||
<MkNoteSub
|
|
||||||
v-if="appearNote.parent_note && !detailedView && !collapsedReply"
|
|
||||||
:note="appearNote.parent_note"
|
|
||||||
class="reply-to"
|
|
||||||
/>
|
|
||||||
<div
|
|
||||||
v-if="!detailedView"
|
|
||||||
class="note-context"
|
|
||||||
@click="noteClick"
|
|
||||||
:class="{
|
|
||||||
collapsedReply: collapsedReply && appearNote.parent_note,
|
|
||||||
}"
|
|
||||||
>
|
|
||||||
<div class="line"></div>
|
|
||||||
<div v-if="appearNote._prId_" class="info">
|
|
||||||
<i class="ph-megaphone-simple-bold ph-lg"></i>
|
|
||||||
{{ i18n.ts.promotion
|
|
||||||
}}<button class="_textButton hide" @click.stop="readPromo()">
|
|
||||||
{{ i18n.ts.hideThisNote }}
|
|
||||||
<i class="ph-x ph-bold ph-lg"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div v-if="appearNote._featuredId_" class="info">
|
|
||||||
<i class="ph-lightning ph-bold ph-lg"></i>
|
|
||||||
{{ i18n.ts.featured }}
|
|
||||||
</div>
|
|
||||||
<div v-if="pinned" class="info">
|
|
||||||
<i class="ph-push-pin ph-bold ph-lg"></i
|
|
||||||
>{{ i18n.ts.pinnedNote }}
|
|
||||||
</div>
|
|
||||||
<div v-if="isRenote" class="renote">
|
|
||||||
<i class="ph-repeat ph-bold ph-lg"></i>
|
|
||||||
<I18n :src="i18n.ts.renotedBy" tag="span">
|
|
||||||
<template #user>
|
|
||||||
<MkA
|
|
||||||
v-user-preview="note.user.id"
|
|
||||||
class="name"
|
|
||||||
:to="userPage(note.user)"
|
|
||||||
@click.stop
|
|
||||||
>
|
|
||||||
<MkUserName :user="note.user" />
|
|
||||||
</MkA>
|
|
||||||
</template>
|
|
||||||
</I18n>
|
|
||||||
<div class="info">
|
|
||||||
<button
|
|
||||||
ref="renoteTime"
|
|
||||||
class="_button time"
|
|
||||||
@click.stop="showRenoteMenu()"
|
|
||||||
>
|
|
||||||
<i
|
|
||||||
v-if="isMyRenote"
|
|
||||||
class="ph-dots-three-outline ph-bold ph-lg dropdownIcon"
|
|
||||||
></i>
|
|
||||||
<MkTime :time="note.created_at" />
|
|
||||||
</button>
|
|
||||||
<MkVisibility :note="note" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-if="collapsedReply && appearNote.parent_note" class="info">
|
|
||||||
<MkAvatar class="avatar" :user="appearNote.parent_note.user" />
|
|
||||||
<MkUserName
|
|
||||||
class="username"
|
|
||||||
:user="appearNote.parent_note.user"
|
|
||||||
></MkUserName>
|
|
||||||
<Mfm
|
|
||||||
class="summary"
|
|
||||||
:text="getNoteSummary(appearNote.parent_note)"
|
|
||||||
:plain="true"
|
|
||||||
:nowrap="true"
|
|
||||||
:custom-emojis="note.emojis"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<article
|
|
||||||
class="article"
|
|
||||||
@contextmenu.stop="onContextmenu"
|
|
||||||
@click="noteClick"
|
|
||||||
:style="{
|
|
||||||
cursor: expandOnNoteClick && !detailedView ? 'pointer' : '',
|
|
||||||
}"
|
|
||||||
>
|
|
||||||
<div class="main">
|
|
||||||
<div class="header-container">
|
|
||||||
<MkAvatar class="avatar" :user="appearNote.user" />
|
|
||||||
<XNoteHeader class="header" :note="appearNote" />
|
|
||||||
</div>
|
|
||||||
<div class="body">
|
|
||||||
<MkSubNoteContent
|
|
||||||
class="text"
|
|
||||||
:note="appearNote"
|
|
||||||
:detailed="true"
|
|
||||||
:detailedView="detailedView"
|
|
||||||
:parentId="appearNote.id"
|
|
||||||
@push="(e) => router.push(notePage(e))"
|
|
||||||
@focusfooter="footerEl.focus()"
|
|
||||||
@expanded="(e) => setPostExpanded(e)"
|
|
||||||
></MkSubNoteContent>
|
|
||||||
<div v-if="translating || translation" class="translation">
|
|
||||||
<MkLoading v-if="translating" mini />
|
|
||||||
<div v-else class="translated">
|
|
||||||
<b
|
|
||||||
>{{
|
|
||||||
i18n.t("translatedFrom", {
|
|
||||||
x: translation.sourceLang,
|
|
||||||
})
|
|
||||||
}}:
|
|
||||||
</b>
|
|
||||||
<Mfm
|
|
||||||
:text="translation.text"
|
|
||||||
:author="appearNote.user"
|
|
||||||
:i="$i"
|
|
||||||
:custom-emojis="appearNote.emojis"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-if="detailedView" class="info">
|
|
||||||
<MkA class="created-at" :to="notePage(appearNote)">
|
|
||||||
<MkTime :time="appearNote.created_at" mode="absolute" />
|
|
||||||
</MkA>
|
|
||||||
</div>
|
|
||||||
<footer ref="footerEl" class="footer" @click.stop tabindex="-1">
|
|
||||||
<XReactionsViewer
|
|
||||||
v-if="enableEmojiReactions"
|
|
||||||
ref="reactionsViewer"
|
|
||||||
:note="appearNote"
|
|
||||||
/>
|
|
||||||
<button
|
|
||||||
v-tooltip.noDelay.bottom="i18n.ts.reply"
|
|
||||||
class="button _button"
|
|
||||||
@click="reply()"
|
|
||||||
>
|
|
||||||
<i class="ph-arrow-u-up-left ph-bold ph-lg"></i>
|
|
||||||
<template
|
|
||||||
v-if="appearNote.reply_count > 0 && !detailedView"
|
|
||||||
>
|
|
||||||
<p class="count">{{ appearNote.reply_count }}</p>
|
|
||||||
</template>
|
|
||||||
</button>
|
|
||||||
<XRenoteButton
|
|
||||||
ref="renoteButton"
|
|
||||||
class="button"
|
|
||||||
:note="appearNote"
|
|
||||||
:count="appearNote.renote_count"
|
|
||||||
:detailedView="detailedView"
|
|
||||||
/>
|
|
||||||
<XStarButtonNoEmoji
|
|
||||||
v-if="!enableEmojiReactions"
|
|
||||||
class="button"
|
|
||||||
:note="appearNote"
|
|
||||||
:count="magReactionCount(appearNote)"
|
|
||||||
:reacted="magHasReacted(appearNote)"
|
|
||||||
/>
|
|
||||||
<XStarButton
|
|
||||||
v-if="
|
|
||||||
enableEmojiReactions && !magHasReacted(appearNote)
|
|
||||||
"
|
|
||||||
ref="starButton"
|
|
||||||
class="button"
|
|
||||||
:note="appearNote"
|
|
||||||
/>
|
|
||||||
<button
|
|
||||||
v-if="
|
|
||||||
enableEmojiReactions && !magHasReacted(appearNote)
|
|
||||||
"
|
|
||||||
ref="reactButton"
|
|
||||||
v-tooltip.noDelay.bottom="i18n.ts.reaction"
|
|
||||||
class="button _button"
|
|
||||||
@click="react()"
|
|
||||||
>
|
|
||||||
<i class="ph-smiley ph-bold ph-lg"></i>
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
v-if="enableEmojiReactions && magHasReacted(appearNote)"
|
|
||||||
ref="reactButton"
|
|
||||||
class="button _button reacted"
|
|
||||||
@click="undoReact(appearNote)"
|
|
||||||
v-tooltip.noDelay.bottom="i18n.ts.removeReaction"
|
|
||||||
>
|
|
||||||
<i class="ph-minus ph-bold ph-lg"></i>
|
|
||||||
</button>
|
|
||||||
<XQuoteButton class="button" :note="appearNote" />
|
|
||||||
<button
|
|
||||||
ref="menuButton"
|
|
||||||
v-tooltip.noDelay.bottom="i18n.ts.more"
|
|
||||||
class="button _button"
|
|
||||||
@click="menu()"
|
|
||||||
>
|
|
||||||
<i class="ph-dots-three-outline ph-bold ph-lg"></i>
|
|
||||||
</button>
|
|
||||||
</footer>
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
</div>
|
|
||||||
<button v-else class="muted _button" @click="muted.muted = false">
|
|
||||||
<I18n :src="softMuteReasonI18nSrc(muted.what)" tag="small">
|
|
||||||
<template #name>
|
|
||||||
<MkA
|
|
||||||
v-user-preview="note.user.id"
|
|
||||||
class="name"
|
|
||||||
:to="userPage(note.user)"
|
|
||||||
>
|
|
||||||
<MkUserName :user="note.user" />
|
|
||||||
</MkA>
|
|
||||||
</template>
|
|
||||||
<template #reason>
|
|
||||||
<b class="_blur_text">{{ muted.matched.join(", ") }}</b>
|
|
||||||
</template>
|
|
||||||
</I18n>
|
|
||||||
</button>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import type { Ref } from "vue";
|
|
||||||
import { computed, inject, onMounted, ref, toRaw } from "vue";
|
|
||||||
import * as mfm from "mfm-js";
|
|
||||||
import type * as misskey from "calckey-js";
|
|
||||||
import MkNoteSub from "@/components/MkNoteSub.vue";
|
|
||||||
import MkSubNoteContent from "./MkSubNoteContent.vue";
|
|
||||||
import XNoteHeader from "@/components/MkNoteHeader.vue";
|
|
||||||
import XRenoteButton from "@/components/MkRenoteButton.vue";
|
|
||||||
import XReactionsViewer from "@/components/MkReactionsViewer.vue";
|
|
||||||
import XStarButton from "@/components/MkStarButton.vue";
|
|
||||||
import XStarButtonNoEmoji from "@/components/MkStarButtonNoEmoji.vue";
|
|
||||||
import XQuoteButton from "@/components/MkQuoteButton.vue";
|
|
||||||
import MkVisibility from "@/components/MkVisibility.vue";
|
|
||||||
import copyToClipboard from "@/scripts/copy-to-clipboard";
|
|
||||||
import { url } from "@/config";
|
|
||||||
import { pleaseLogin } from "@/scripts/please-login";
|
|
||||||
import { focusNext, focusPrev } from "@/scripts/focus";
|
|
||||||
import { getWordSoftMute } from "@/scripts/check-word-mute";
|
|
||||||
import { useRouter } from "@/router";
|
|
||||||
import { userPage } from "@/filters/user";
|
|
||||||
import * as os from "@/os";
|
|
||||||
import { defaultStore, noteViewInterruptors } from "@/store";
|
|
||||||
import { reactionPicker } from "@/scripts/reaction-picker";
|
|
||||||
import { $i } from "@/account";
|
|
||||||
import { i18n } from "@/i18n";
|
|
||||||
import { getNoteMenu } from "@/scripts/get-note-menu";
|
|
||||||
import { useNoteCapture } from "@/scripts/use-note-capture";
|
|
||||||
import { notePage } from "@/filters/note";
|
|
||||||
import { getNoteSummary } from "@/scripts/get-note-summary";
|
|
||||||
import { packed } from "magnetar-common";
|
|
||||||
import {
|
|
||||||
magEffectiveNote,
|
|
||||||
magHasReacted,
|
|
||||||
magIsRenote,
|
|
||||||
magReactionCount,
|
|
||||||
} from "@/scripts-mag/mag-util";
|
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
note: packed.PackNoteMaybeFull;
|
|
||||||
pinned?: boolean;
|
|
||||||
detailedView?: boolean;
|
|
||||||
collapsedReply?: boolean;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
let note = $ref<packed.PackNoteMaybeFull>(structuredClone(toRaw(props.note)));
|
|
||||||
|
|
||||||
const softMuteReasonI18nSrc = (what?: string) => {
|
|
||||||
if (what === "note") return i18n.ts.userSaysSomethingReason;
|
|
||||||
if (what === "reply") return i18n.ts.userSaysSomethingReasonReply;
|
|
||||||
if (what === "renote") return i18n.ts.userSaysSomethingReasonRenote;
|
|
||||||
if (what === "quote") return i18n.ts.userSaysSomethingReasonQuote;
|
|
||||||
|
|
||||||
// I don't think here is reachable, but just in case
|
|
||||||
return i18n.ts.userSaysSomething;
|
|
||||||
};
|
|
||||||
|
|
||||||
// plugin
|
|
||||||
if (noteViewInterruptors.length > 0) {
|
|
||||||
onMounted(async () => {
|
|
||||||
let result = structuredClone(toRaw(note));
|
|
||||||
for (const interruptor of noteViewInterruptors) {
|
|
||||||
result = await interruptor.handler(result);
|
|
||||||
}
|
|
||||||
note = result;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const isRenote = magIsRenote(note);
|
|
||||||
|
|
||||||
const el = ref<HTMLElement>();
|
|
||||||
const footerEl = ref<HTMLElement>();
|
|
||||||
const menuButton = ref<HTMLElement>();
|
|
||||||
const starButton = ref<InstanceType<typeof XStarButton>>();
|
|
||||||
const renoteButton = ref<InstanceType<typeof XRenoteButton>>();
|
|
||||||
const renoteTime = ref<HTMLElement>();
|
|
||||||
const reactButton = ref<HTMLElement>();
|
|
||||||
let appearNote = $computed(
|
|
||||||
() => magEffectiveNote(note) as packed.PackNoteMaybeFull
|
|
||||||
);
|
|
||||||
const isMyRenote = $i && $i.id === note.user.id;
|
|
||||||
const showContent = ref(false);
|
|
||||||
const isDeleted = ref(false);
|
|
||||||
const muted = ref(getWordSoftMute(note, $i, defaultStore.state.mutedWords));
|
|
||||||
const translation = ref(null);
|
|
||||||
const translating = ref(false);
|
|
||||||
const enableEmojiReactions = defaultStore.state.enableEmojiReactions;
|
|
||||||
const expandOnNoteClick = defaultStore.state.expandOnNoteClick;
|
|
||||||
|
|
||||||
const keymap = {
|
|
||||||
r: () => reply(true),
|
|
||||||
"e|a|plus": () => react(true),
|
|
||||||
q: () => renoteButton.value.renote(true),
|
|
||||||
"up|k": focusBefore,
|
|
||||||
"down|j": focusAfter,
|
|
||||||
esc: blur,
|
|
||||||
"m|o": () => menu(true),
|
|
||||||
s: () => showContent.value !== showContent.value,
|
|
||||||
};
|
|
||||||
|
|
||||||
useNoteCapture({
|
|
||||||
rootEl: el,
|
|
||||||
note: $$(appearNote),
|
|
||||||
isDeletedRef: isDeleted,
|
|
||||||
});
|
|
||||||
|
|
||||||
function reply(viaKeyboard = false): void {
|
|
||||||
pleaseLogin();
|
|
||||||
os.post(
|
|
||||||
{
|
|
||||||
reply: appearNote,
|
|
||||||
animation: !viaKeyboard,
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
focus();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function react(viaKeyboard = false): void {
|
|
||||||
pleaseLogin();
|
|
||||||
blur();
|
|
||||||
reactionPicker.show(
|
|
||||||
reactButton.value,
|
|
||||||
(reaction) => {
|
|
||||||
os.api("notes/reactions/create", {
|
|
||||||
noteId: appearNote.id,
|
|
||||||
reaction: reaction,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
focus();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function undoReact(note): void {
|
|
||||||
const oldReaction = note.myReaction;
|
|
||||||
if (!oldReaction) return;
|
|
||||||
os.api("notes/reactions/delete", {
|
|
||||||
noteId: note.id,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const currentClipPage = inject<Ref<misskey.entities.Clip> | null>(
|
|
||||||
"currentClipPage",
|
|
||||||
null
|
|
||||||
);
|
|
||||||
|
|
||||||
function onContextmenu(ev: MouseEvent): void {
|
|
||||||
const isLink = (el: HTMLElement) => {
|
|
||||||
if (el.tagName === "A") return true;
|
|
||||||
// The Audio element's context menu is the browser default, such as for selecting playback speed.
|
|
||||||
if (el.tagName === "AUDIO") return true;
|
|
||||||
if (el.parentElement) {
|
|
||||||
return isLink(el.parentElement);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
if (isLink(ev.target)) return;
|
|
||||||
if (window.getSelection()?.toString() !== "") return;
|
|
||||||
|
|
||||||
if (defaultStore.state.useReactionPickerForContextMenu) {
|
|
||||||
ev.preventDefault();
|
|
||||||
react();
|
|
||||||
} else {
|
|
||||||
os.contextMenu(
|
|
||||||
[
|
|
||||||
{
|
|
||||||
type: "label",
|
|
||||||
text: notePage(appearNote),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
icon: "ph-browser ph-bold ph-lg",
|
|
||||||
text: i18n.ts.openInWindow,
|
|
||||||
action: () => {
|
|
||||||
os.pageWindow(notePage(appearNote));
|
|
||||||
},
|
|
||||||
},
|
|
||||||
notePage(appearNote) != location.pathname
|
|
||||||
? {
|
|
||||||
icon: "ph-arrows-out-simple ph-bold ph-lg",
|
|
||||||
text: i18n.ts.showInPage,
|
|
||||||
action: () => {
|
|
||||||
router.push(notePage(appearNote), "forcePage");
|
|
||||||
},
|
|
||||||
}
|
|
||||||
: undefined,
|
|
||||||
null,
|
|
||||||
{
|
|
||||||
type: "a",
|
|
||||||
icon: "ph-arrow-square-out ph-bold ph-lg",
|
|
||||||
text: i18n.ts.openInNewTab,
|
|
||||||
href: notePage(appearNote),
|
|
||||||
target: "_blank",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
icon: "ph-link-simple ph-bold ph-lg",
|
|
||||||
text: i18n.ts.copyLink,
|
|
||||||
action: () => {
|
|
||||||
copyToClipboard(`${url}${notePage(appearNote)}`);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
appearNote.user.host != null
|
|
||||||
? {
|
|
||||||
type: "a",
|
|
||||||
icon: "ph-arrow-square-up-right ph-bold ph-lg",
|
|
||||||
text: i18n.ts.showOnRemote,
|
|
||||||
href: appearNote.url ?? appearNote.uri ?? "",
|
|
||||||
target: "_blank",
|
|
||||||
}
|
|
||||||
: undefined,
|
|
||||||
],
|
|
||||||
ev
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function menu(viaKeyboard = false): void {
|
|
||||||
os.popupMenu(
|
|
||||||
getNoteMenu({
|
|
||||||
note: note,
|
|
||||||
translating,
|
|
||||||
translation,
|
|
||||||
menuButton,
|
|
||||||
isDeleted,
|
|
||||||
currentClipPage,
|
|
||||||
}),
|
|
||||||
menuButton.value,
|
|
||||||
{
|
|
||||||
viaKeyboard,
|
|
||||||
}
|
|
||||||
).then(focus);
|
|
||||||
}
|
|
||||||
|
|
||||||
function showRenoteMenu(viaKeyboard = false): void {
|
|
||||||
if (!isMyRenote) return;
|
|
||||||
os.popupMenu(
|
|
||||||
[
|
|
||||||
{
|
|
||||||
text: i18n.ts.unrenote,
|
|
||||||
icon: "ph-trash ph-bold ph-lg",
|
|
||||||
danger: true,
|
|
||||||
action: () => {
|
|
||||||
os.api("notes/delete", {
|
|
||||||
noteId: note.id,
|
|
||||||
});
|
|
||||||
isDeleted.value = true;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
renoteTime.value,
|
|
||||||
{
|
|
||||||
viaKeyboard: viaKeyboard,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function focus() {
|
|
||||||
el.value?.focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
function blur() {
|
|
||||||
el.value?.blur();
|
|
||||||
}
|
|
||||||
|
|
||||||
function focusBefore() {
|
|
||||||
focusPrev(el.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
function focusAfter() {
|
|
||||||
focusNext(el.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
function scrollIntoView() {
|
|
||||||
el.value?.scrollIntoView();
|
|
||||||
}
|
|
||||||
|
|
||||||
function noteClick(e) {
|
|
||||||
if (
|
|
||||||
document.getSelection()?.type === "Range" ||
|
|
||||||
props.detailedView ||
|
|
||||||
!expandOnNoteClick
|
|
||||||
) {
|
|
||||||
e.stopPropagation();
|
|
||||||
} else {
|
|
||||||
router.push(notePage(appearNote));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function readPromo() {
|
|
||||||
os.api("promo/read", {
|
|
||||||
noteId: appearNote.id,
|
|
||||||
});
|
|
||||||
isDeleted.value = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
let postIsExpanded = ref(false);
|
|
||||||
|
|
||||||
function setPostExpanded(val: boolean) {
|
|
||||||
postIsExpanded.value = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
const accessibleLabel = computed(() => {
|
|
||||||
let label = `${appearNote.user.username}; `;
|
|
||||||
if (appearNote.renoted_note) {
|
|
||||||
label += `${i18n.t("renoted")} ${
|
|
||||||
appearNote.renoted_note.user.username
|
|
||||||
}; `;
|
|
||||||
if (appearNote.renoted_note.cw) {
|
|
||||||
label += `${i18n.t("cw")}: ${appearNote.renoted_note.cw}; `;
|
|
||||||
if (postIsExpanded.value) {
|
|
||||||
label += `${appearNote.renoted_note.text}; `;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
label += `${appearNote.renoted_note.text}; `;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (appearNote.cw) {
|
|
||||||
label += `${i18n.t("cw")}: ${appearNote.cw}; `;
|
|
||||||
if (postIsExpanded.value) {
|
|
||||||
label += `${appearNote.text}; `;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
label += `${appearNote.text}; `;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const date = new Date(appearNote.created_at);
|
|
||||||
label += `${date.toLocaleTimeString()}`;
|
|
||||||
return label;
|
|
||||||
});
|
|
||||||
|
|
||||||
defineExpose({
|
|
||||||
focus,
|
|
||||||
blur,
|
|
||||||
scrollIntoView,
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.tkcbzcuz {
|
|
||||||
position: relative;
|
|
||||||
transition: box-shadow 0.1s ease;
|
|
||||||
font-size: 1.05em;
|
|
||||||
overflow: clip;
|
|
||||||
contain: content;
|
|
||||||
-webkit-tap-highlight-color: transparent;
|
|
||||||
|
|
||||||
// これらの指定はパフォーマンス向上には有効だが、ノートの高さは一定でないため、
|
|
||||||
// 下の方までスクロールすると上のノートの高さがここで決め打ちされたものに変化し、表示しているノートの位置が変わってしまう
|
|
||||||
// ノートがマウントされたときに自身の高さを取得し contain-intrinsic-size を設定しなおせばほぼ解決できそうだが、
|
|
||||||
// 今度はその処理自体がパフォーマンス低下の原因にならないか懸念される。また、被リアクションでも高さは変化するため、やはり多少のズレは生じる
|
|
||||||
// 一度レンダリングされた要素はブラウザがよしなにサイズを覚えておいてくれるような実装になるまで待った方が良さそう(なるのか?)
|
|
||||||
//content-visibility: auto;
|
|
||||||
//contain-intrinsic-size: 0 128px;
|
|
||||||
|
|
||||||
&:focus-visible {
|
|
||||||
outline: none;
|
|
||||||
|
|
||||||
&:after {
|
|
||||||
content: "";
|
|
||||||
pointer-events: none;
|
|
||||||
display: block;
|
|
||||||
position: absolute;
|
|
||||||
z-index: 10;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
margin: auto;
|
|
||||||
width: calc(100% - 8px);
|
|
||||||
height: calc(100% - 8px);
|
|
||||||
border: solid 1px var(--focus);
|
|
||||||
border-radius: var(--radius);
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
& > .article > .main {
|
|
||||||
&:hover,
|
|
||||||
&:focus-within {
|
|
||||||
:deep(.footer .button) {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
> .reply-to {
|
|
||||||
& + .note-context {
|
|
||||||
.line::before {
|
|
||||||
content: "";
|
|
||||||
display: block;
|
|
||||||
margin-bottom: -4px;
|
|
||||||
margin-top: 16px;
|
|
||||||
border-left: 2px solid currentColor;
|
|
||||||
margin-left: calc((var(--avatarSize) / 2) - 1px);
|
|
||||||
opacity: 0.25;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.note-context {
|
|
||||||
position: relative;
|
|
||||||
padding: 0 32px 0 32px;
|
|
||||||
display: flex;
|
|
||||||
z-index: 1;
|
|
||||||
&:first-child {
|
|
||||||
margin-top: 20px;
|
|
||||||
}
|
|
||||||
> :not(.line) {
|
|
||||||
width: 0;
|
|
||||||
flex-grow: 1;
|
|
||||||
position: relative;
|
|
||||||
line-height: 28px;
|
|
||||||
}
|
|
||||||
> .line {
|
|
||||||
position: relative;
|
|
||||||
z-index: 2;
|
|
||||||
width: var(--avatarSize);
|
|
||||||
display: flex;
|
|
||||||
margin-right: 14px;
|
|
||||||
margin-top: 0;
|
|
||||||
flex-grow: 0;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
> div > i {
|
|
||||||
margin-left: -0.5px;
|
|
||||||
}
|
|
||||||
> .info {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
font-size: 90%;
|
|
||||||
white-space: pre;
|
|
||||||
color: #f6c177;
|
|
||||||
|
|
||||||
> i {
|
|
||||||
margin-right: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
> .hide {
|
|
||||||
margin-left: auto;
|
|
||||||
color: inherit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
> .renote {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
white-space: pre;
|
|
||||||
color: var(--renote);
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
> i {
|
|
||||||
margin-right: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
> span {
|
|
||||||
overflow: hidden;
|
|
||||||
flex-shrink: 1;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
|
|
||||||
> .name {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
> .info {
|
|
||||||
margin-left: auto;
|
|
||||||
font-size: 0.9em;
|
|
||||||
display: flex;
|
|
||||||
|
|
||||||
> .time {
|
|
||||||
flex-shrink: 0;
|
|
||||||
color: inherit;
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
> .dropdownIcon {
|
|
||||||
margin-right: 4px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.collapsedReply {
|
|
||||||
.line {
|
|
||||||
opacity: 0.25;
|
|
||||||
&::after {
|
|
||||||
content: "";
|
|
||||||
position: absolute;
|
|
||||||
border-left: 2px solid currentColor;
|
|
||||||
border-top: 2px solid currentColor;
|
|
||||||
margin-left: calc(var(--avatarSize) / 2 - 1px);
|
|
||||||
width: calc(var(--avatarSize) / 2 + 14px);
|
|
||||||
border-top-left-radius: calc(var(--avatarSize) / 4);
|
|
||||||
top: calc(50% - 1px);
|
|
||||||
height: calc(50% + 5px);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.info {
|
|
||||||
color: var(--fgTransparentWeak);
|
|
||||||
transition: color 0.2s;
|
|
||||||
}
|
|
||||||
.avatar {
|
|
||||||
width: 1.2em;
|
|
||||||
height: 1.2em;
|
|
||||||
border-radius: 2em;
|
|
||||||
overflow: hidden;
|
|
||||||
margin-right: 0.4em;
|
|
||||||
background: var(--panelHighlight);
|
|
||||||
}
|
|
||||||
.username {
|
|
||||||
font-weight: 700;
|
|
||||||
flex-shrink: 0;
|
|
||||||
max-width: 30%;
|
|
||||||
&::after {
|
|
||||||
content: ": ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&:hover,
|
|
||||||
&:focus-within {
|
|
||||||
.info {
|
|
||||||
color: var(--fg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
> .article {
|
|
||||||
position: relative;
|
|
||||||
overflow: clip;
|
|
||||||
padding: 20px 32px 10px;
|
|
||||||
margin-top: -16px;
|
|
||||||
|
|
||||||
&:first-child,
|
|
||||||
&:nth-child(2) {
|
|
||||||
margin-top: -100px;
|
|
||||||
padding-top: 104px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (pointer: coarse) {
|
|
||||||
cursor: default;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-container {
|
|
||||||
display: flex;
|
|
||||||
position: relative;
|
|
||||||
z-index: 2;
|
|
||||||
> .avatar {
|
|
||||||
flex-shrink: 0;
|
|
||||||
display: block;
|
|
||||||
margin: 0 14px 0 0;
|
|
||||||
width: var(--avatarSize);
|
|
||||||
height: var(--avatarSize);
|
|
||||||
position: relative;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
}
|
|
||||||
> .header {
|
|
||||||
width: 0;
|
|
||||||
flex-grow: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
> .main {
|
|
||||||
flex: 1;
|
|
||||||
min-width: 0;
|
|
||||||
|
|
||||||
> .body {
|
|
||||||
margin-top: 0.7em;
|
|
||||||
> .translation {
|
|
||||||
border: solid 0.5px var(--divider);
|
|
||||||
border-radius: var(--radius);
|
|
||||||
padding: 12px;
|
|
||||||
margin-top: 8px;
|
|
||||||
}
|
|
||||||
> .renote {
|
|
||||||
padding-top: 8px;
|
|
||||||
> * {
|
|
||||||
padding: 16px;
|
|
||||||
border: solid 1px var(--renote);
|
|
||||||
border-radius: 8px;
|
|
||||||
transition: background 0.2s;
|
|
||||||
&:hover,
|
|
||||||
&:focus-within {
|
|
||||||
background-color: var(--panelHighlight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
> .info {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: 0.7em;
|
|
||||||
margin-top: 16px;
|
|
||||||
opacity: 0.7;
|
|
||||||
font-size: 0.9em;
|
|
||||||
}
|
|
||||||
> .footer {
|
|
||||||
position: relative;
|
|
||||||
z-index: 2;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
pointer-events: none; // Allow clicking anything w/out pointer-events: all; to open post
|
|
||||||
margin-top: 0.4em;
|
|
||||||
> :deep(.button) {
|
|
||||||
position: relative;
|
|
||||||
margin: 0;
|
|
||||||
padding: 8px;
|
|
||||||
opacity: 0.7;
|
|
||||||
flex-grow: 1;
|
|
||||||
max-width: 3.5em;
|
|
||||||
width: max-content;
|
|
||||||
min-width: max-content;
|
|
||||||
pointer-events: all;
|
|
||||||
height: auto;
|
|
||||||
transition: opacity 0.2s;
|
|
||||||
&::before {
|
|
||||||
content: "";
|
|
||||||
position: absolute;
|
|
||||||
inset: 0;
|
|
||||||
bottom: 2px;
|
|
||||||
background: var(--panel);
|
|
||||||
z-index: -1;
|
|
||||||
transition: background 0.2s;
|
|
||||||
}
|
|
||||||
&:first-of-type {
|
|
||||||
margin-left: -0.5em;
|
|
||||||
&::before {
|
|
||||||
border-radius: 100px 0 0 100px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&:last-of-type {
|
|
||||||
&::before {
|
|
||||||
border-radius: 0 100px 100px 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&:hover {
|
|
||||||
color: var(--fgHighlighted);
|
|
||||||
}
|
|
||||||
|
|
||||||
> i {
|
|
||||||
display: inline !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
> .count {
|
|
||||||
display: inline;
|
|
||||||
margin: 0 0 0 8px;
|
|
||||||
opacity: 0.7;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.reacted {
|
|
||||||
color: var(--accent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
> .reply {
|
|
||||||
border-top: solid 0.5px var(--divider);
|
|
||||||
}
|
|
||||||
|
|
||||||
&.max-width_500px {
|
|
||||||
font-size: 0.975em;
|
|
||||||
--avatarSize: 46px;
|
|
||||||
padding-top: 6px;
|
|
||||||
> .note-context {
|
|
||||||
padding-inline: 16px;
|
|
||||||
margin-top: 8px;
|
|
||||||
> :not(.line) {
|
|
||||||
margin-top: 0px;
|
|
||||||
}
|
|
||||||
> .line {
|
|
||||||
margin-right: 10px;
|
|
||||||
&::before {
|
|
||||||
margin-top: 8px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
> .article {
|
|
||||||
padding: 18px 16px 8px;
|
|
||||||
&:first-child,
|
|
||||||
&:nth-child(2) {
|
|
||||||
padding-top: 104px;
|
|
||||||
}
|
|
||||||
> .main > .header-container > .avatar {
|
|
||||||
margin-right: 10px;
|
|
||||||
// top: calc(14px + var(--stickyTop, 0px));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.max-width_300px {
|
|
||||||
--avatarSize: 40px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.muted {
|
|
||||||
padding: 8px;
|
|
||||||
text-align: center;
|
|
||||||
opacity: 0.7;
|
|
||||||
width: 100%;
|
|
||||||
|
|
||||||
._blur_text {
|
|
||||||
pointer-events: auto;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="defgtij">
|
<div class="defgtij">
|
||||||
<div v-for="user in users" :key="user.id" class="avatar-holder">
|
<div v-for="user in users" :key="user.id" class="avatar-holder">
|
||||||
<MkAvatar :user="user" class="avatar" />
|
<MkAvatar :user="user" :show-indicator="true" class="avatar" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -18,12 +18,10 @@ import { length } from "stringz";
|
||||||
import * as misskey from "calckey-js";
|
import * as misskey from "calckey-js";
|
||||||
import { concat } from "@/scripts/array";
|
import { concat } from "@/scripts/array";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { packed } from "magnetar-common";
|
|
||||||
import { magTransProperty } from "@/scripts-mag/mag-util";
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
modelValue: boolean;
|
modelValue: boolean;
|
||||||
note: packed.PackNoteMaybeFull | misskey.entities.Note;
|
note: misskey.entities.Note;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
|
@ -33,18 +31,15 @@ const emit = defineEmits<{
|
||||||
const el = ref<HTMLElement>();
|
const el = ref<HTMLElement>();
|
||||||
|
|
||||||
const label = computed(() => {
|
const label = computed(() => {
|
||||||
const attachments = magTransProperty(props.note, "attachments", "files");
|
|
||||||
const renote = magTransProperty(props.note, "renoted_note", "renote");
|
|
||||||
|
|
||||||
return concat([
|
return concat([
|
||||||
props.note.text
|
props.note.text
|
||||||
? [i18n.t("_cw.chars", { count: length(props.note.text) })]
|
? [i18n.t("_cw.chars", { count: length(props.note.text) })]
|
||||||
: [],
|
: [],
|
||||||
attachments && attachments.length !== 0
|
props.note.files && props.note.files.length !== 0
|
||||||
? [i18n.t("_cw.files", { count: attachments.length })]
|
? [i18n.t("_cw.files", { count: props.note.files.length })]
|
||||||
: [],
|
: [],
|
||||||
props.note.poll != null ? [i18n.ts.poll] : [],
|
props.note.poll != null ? [i18n.ts.poll] : [],
|
||||||
renote != null ? [i18n.ts.quoteAttached] : [],
|
props.note.renote != null ? [i18n.ts.quoteAttached] : [],
|
||||||
] as string[][]).join(", ");
|
] as string[][]).join(", ");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
}"
|
}"
|
||||||
:disabled="wait"
|
:disabled="wait"
|
||||||
@click.stop="onClick"
|
@click.stop="onClick"
|
||||||
:aria-label="`${state} ${magTransUsername(user)}`"
|
:aria-label="`${state} ${user.name || user.username}`"
|
||||||
v-tooltip="full ? null : `${state} ${magTransUsername(user)}`"
|
v-tooltip="full ? null : `${state} ${user.name || user.username}`"
|
||||||
>
|
>
|
||||||
<template v-if="!wait">
|
<template v-if="!wait">
|
||||||
<template v-if="isBlocking">
|
<template v-if="isBlocking">
|
||||||
|
@ -28,19 +28,13 @@
|
||||||
><i class="ph-prohibit ph-bold ph-lg"></i>
|
><i class="ph-prohibit ph-bold ph-lg"></i>
|
||||||
</template>
|
</template>
|
||||||
<template
|
<template
|
||||||
v-else-if="
|
v-else-if="hasPendingFollowRequestFromYou && user.isLocked"
|
||||||
hasPendingFollowRequestFromYou &&
|
|
||||||
magTransProperty(user, 'is_locked', 'isLocked')
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<span>{{ (state = i18n.ts.followRequestPending) }}</span
|
<span>{{ (state = i18n.ts.followRequestPending) }}</span
|
||||||
><i class="ph-hourglass-medium ph-bold ph-lg"></i>
|
><i class="ph-hourglass-medium ph-bold ph-lg"></i>
|
||||||
</template>
|
</template>
|
||||||
<template
|
<template
|
||||||
v-else-if="
|
v-else-if="hasPendingFollowRequestFromYou && !user.isLocked"
|
||||||
hasPendingFollowRequestFromYou &&
|
|
||||||
!magTransProperty(user, 'is_locked', 'isLocked')
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<!-- つまりリモートフォローの場合。 -->
|
<!-- つまりリモートフォローの場合。 -->
|
||||||
<span>{{ (state = i18n.ts.processing) }}</span
|
<span>{{ (state = i18n.ts.processing) }}</span
|
||||||
|
@ -50,21 +44,11 @@
|
||||||
<span>{{ (state = i18n.ts.unfollow) }}</span
|
<span>{{ (state = i18n.ts.unfollow) }}</span
|
||||||
><i class="ph-minus ph-bold ph-lg"></i>
|
><i class="ph-minus ph-bold ph-lg"></i>
|
||||||
</template>
|
</template>
|
||||||
<template
|
<template v-else-if="!isFollowing && user.isLocked">
|
||||||
v-else-if="
|
|
||||||
!isFollowing &&
|
|
||||||
magTransProperty(user, 'is_locked', 'isLocked')
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<span>{{ (state = i18n.ts.followRequest) }}</span
|
<span>{{ (state = i18n.ts.followRequest) }}</span
|
||||||
><i class="ph-plus ph-bold ph-lg"></i>
|
><i class="ph-plus ph-bold ph-lg"></i>
|
||||||
</template>
|
</template>
|
||||||
<template
|
<template v-else-if="!isFollowing && !user.isLocked">
|
||||||
v-else-if="
|
|
||||||
!isFollowing &&
|
|
||||||
!magTransProperty(user, 'is_locked', 'isLocked')
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<span>{{ (state = i18n.ts.follow) }}</span
|
<span>{{ (state = i18n.ts.follow) }}</span
|
||||||
><i class="ph-plus ph-bold ph-lg"></i>
|
><i class="ph-plus ph-bold ph-lg"></i>
|
||||||
</template>
|
</template>
|
||||||
|
@ -85,15 +69,13 @@ import { i18n } from "@/i18n";
|
||||||
import { $i } from "@/account";
|
import { $i } from "@/account";
|
||||||
import { getUserMenu } from "@/scripts/get-user-menu";
|
import { getUserMenu } from "@/scripts/get-user-menu";
|
||||||
import { useRouter } from "@/router";
|
import { useRouter } from "@/router";
|
||||||
import { packed } from "magnetar-common";
|
|
||||||
import { magTransProperty, magTransUsername } from "@/scripts-mag/mag-util";
|
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const emit = defineEmits(["refresh"]);
|
const emit = defineEmits(["refresh"]);
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
user: packed.PackUserMaybeAll | Misskey.entities.User;
|
user: Misskey.entities.UserDetailed;
|
||||||
full?: boolean;
|
full?: boolean;
|
||||||
large?: boolean;
|
large?: boolean;
|
||||||
hideMenu?: boolean;
|
hideMenu?: boolean;
|
||||||
|
@ -104,38 +86,24 @@ const props = withDefaults(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const isBlocking = computed(() =>
|
const isBlocking = computed(() => props.user.isBlocking);
|
||||||
magTransProperty(props.user, "you_block", "isBlocking")
|
|
||||||
);
|
|
||||||
|
|
||||||
let state = $ref(i18n.ts.processing);
|
let state = $ref(i18n.ts.processing);
|
||||||
|
|
||||||
let isFollowing = $ref(
|
let isFollowing = $ref(props.user.isFollowing);
|
||||||
magTransProperty(props.user, "you_follow", "isFollowing")
|
|
||||||
);
|
|
||||||
let hasPendingFollowRequestFromYou = $ref(
|
let hasPendingFollowRequestFromYou = $ref(
|
||||||
magTransProperty(
|
props.user.hasPendingFollowRequestFromYou
|
||||||
props.user,
|
|
||||||
"you_request_follow",
|
|
||||||
"hasPendingFollowRequestFromYou"
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
let wait = $ref(false);
|
let wait = $ref(false);
|
||||||
const connection = stream.useChannel("main");
|
const connection = stream.useChannel("main");
|
||||||
|
|
||||||
if (
|
if (props.user.isFollowing == null) {
|
||||||
typeof magTransProperty(props.user, "you_follow", "isFollowing") !==
|
|
||||||
"boolean"
|
|
||||||
) {
|
|
||||||
os.api("users/show", {
|
os.api("users/show", {
|
||||||
userId: props.user.id,
|
userId: props.user.id,
|
||||||
}).then(onFollowChange);
|
}).then(onFollowChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFollowChange(user: Misskey.entities.User) {
|
function onFollowChange(user: Misskey.entities.UserDetailed) {
|
||||||
if (!("isFollowing" in user && "hasPendingFollowRequestFromYou" in user))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (user.id === props.user.id) {
|
if (user.id === props.user.id) {
|
||||||
isFollowing = user.isFollowing;
|
isFollowing = user.isFollowing;
|
||||||
hasPendingFollowRequestFromYou = user.hasPendingFollowRequestFromYou;
|
hasPendingFollowRequestFromYou = user.hasPendingFollowRequestFromYou;
|
||||||
|
@ -156,7 +124,7 @@ async function onClick() {
|
||||||
await os.api("blocking/delete", {
|
await os.api("blocking/delete", {
|
||||||
userId: props.user.id,
|
userId: props.user.id,
|
||||||
});
|
});
|
||||||
if (magTransProperty(props.user, "mute", "isMuted")) {
|
if (props.user.isMuted) {
|
||||||
await os.api("mute/delete", {
|
await os.api("mute/delete", {
|
||||||
userId: props.user.id,
|
userId: props.user.id,
|
||||||
});
|
});
|
||||||
|
@ -166,7 +134,7 @@ async function onClick() {
|
||||||
const { canceled } = await os.confirm({
|
const { canceled } = await os.confirm({
|
||||||
type: "warning",
|
type: "warning",
|
||||||
text: i18n.t("unfollowConfirm", {
|
text: i18n.t("unfollowConfirm", {
|
||||||
name: magTransUsername(props.user),
|
name: props.user.name || props.user.username,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="hpaizdrt"
|
class="hpaizdrt"
|
||||||
v-tooltip="
|
v-tooltip="capitalize(instance.softwareName)"
|
||||||
capitalize(
|
|
||||||
magTransProperty(instance, 'software_name', 'softwareName') ??
|
|
||||||
'?'
|
|
||||||
)
|
|
||||||
"
|
|
||||||
ref="ticker"
|
ref="ticker"
|
||||||
:style="bg"
|
:style="bg"
|
||||||
>
|
>
|
||||||
|
@ -19,59 +14,44 @@
|
||||||
import { instanceName } from "@/config";
|
import { instanceName } from "@/config";
|
||||||
import { instance as Instance } from "@/instance";
|
import { instance as Instance } from "@/instance";
|
||||||
import { getProxiedImageUrlNullable } from "@/scripts/media-proxy";
|
import { getProxiedImageUrlNullable } from "@/scripts/media-proxy";
|
||||||
import * as Misskey from "calckey-js";
|
|
||||||
import { types } from "magnetar-common";
|
|
||||||
import { magTransProperty } from "@/scripts-mag/mag-util";
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
instance?: Misskey.entities.User["instance"] | types.InstanceTicker | null;
|
instance?: {
|
||||||
|
faviconUrl?: string;
|
||||||
|
name: string;
|
||||||
|
themeColor?: string;
|
||||||
|
softwareName?: string;
|
||||||
|
};
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
let ticker = $ref<HTMLElement | null>(null);
|
let ticker = $ref<HTMLElement | null>(null);
|
||||||
|
|
||||||
// if no instance data is given, this is for the local instance
|
// if no instance data is given, this is for the local instance
|
||||||
const instance = props.instance ?? {
|
const instance = props.instance ?? {
|
||||||
iconUrl: null,
|
faviconUrl: Instance.iconUrl || Instance.faviconUrl || "/favicon.ico",
|
||||||
faviconUrl: (Instance.iconUrl || Instance.faviconUrl || "/favicon.ico") as
|
|
||||||
| string
|
|
||||||
| null,
|
|
||||||
name: instanceName,
|
name: instanceName,
|
||||||
themeColor: (
|
themeColor: (
|
||||||
document.querySelector(
|
document.querySelector(
|
||||||
'meta[name="theme-color-orig"]'
|
'meta[name="theme-color-orig"]'
|
||||||
) as HTMLMetaElement
|
) as HTMLMetaElement
|
||||||
)?.content,
|
)?.content,
|
||||||
softwareName: (Instance.softwareName || "Magnetar") as string | null,
|
softwareName: Instance.softwareName || "Calckey",
|
||||||
softwareVersion: (Instance.softwareVersion || Instance.version || "") as
|
|
||||||
| string
|
|
||||||
| null,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const capitalize = (s: string) => s && s[0].toUpperCase() + s.slice(1);
|
const capitalize = (s: string) => s && s[0].toUpperCase() + s.slice(1);
|
||||||
|
|
||||||
const computedStyle = getComputedStyle(document.documentElement);
|
const computedStyle = getComputedStyle(document.documentElement);
|
||||||
const themeColor =
|
const themeColor =
|
||||||
magTransProperty(instance, "theme_color", "themeColor") ??
|
instance.themeColor ?? computedStyle.getPropertyValue("--bg");
|
||||||
computedStyle.getPropertyValue("--bg");
|
|
||||||
|
|
||||||
const bg = {
|
const bg = {
|
||||||
background: `linear-gradient(90deg, ${themeColor}, ${themeColor}55)`,
|
background: `linear-gradient(90deg, ${themeColor}, ${themeColor}55)`,
|
||||||
};
|
};
|
||||||
|
|
||||||
function getInstanceIcon(
|
function getInstanceIcon(instance): string {
|
||||||
instance?: Misskey.entities.User["instance"] | types.InstanceTicker | null
|
|
||||||
): string {
|
|
||||||
if (!instance) return "/client-assets/dummy.png";
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
getProxiedImageUrlNullable(
|
getProxiedImageUrlNullable(instance.iconUrl, "preview") ??
|
||||||
magTransProperty(instance, "icon_url", "iconUrl"),
|
getProxiedImageUrlNullable(instance.faviconUrl, "preview") ??
|
||||||
"preview"
|
|
||||||
) ??
|
|
||||||
getProxiedImageUrlNullable(
|
|
||||||
magTransProperty(instance, "favicon_url", "faviconUrl"),
|
|
||||||
"preview"
|
|
||||||
) ??
|
|
||||||
"/client-assets/dummy.png"
|
"/client-assets/dummy.png"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="mk-media-banner" @click.stop>
|
<div class="mk-media-banner" @click.stop>
|
||||||
<div
|
<div
|
||||||
v-if="magTransProperty(media, 'sensitive', 'isSensitive') && hide"
|
v-if="media.isSensitive && hide"
|
||||||
class="sensitive"
|
class="sensitive"
|
||||||
@click="hide = false"
|
@click="hide = false"
|
||||||
>
|
>
|
||||||
|
@ -11,9 +11,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-else-if="
|
v-else-if="
|
||||||
((type) => type.startsWith('audio') && type !== 'audio/midi')(
|
media.type.startsWith('audio') && media.type !== 'audio/midi'
|
||||||
magTransProperty(media, 'mime_type', 'type')
|
|
||||||
)
|
|
||||||
"
|
"
|
||||||
class="audio"
|
class="audio"
|
||||||
>
|
>
|
||||||
|
@ -64,12 +62,10 @@ import type * as misskey from "calckey-js";
|
||||||
import { ColdDeviceStorage } from "@/store";
|
import { ColdDeviceStorage } from "@/store";
|
||||||
import "vue-plyr/dist/vue-plyr.css";
|
import "vue-plyr/dist/vue-plyr.css";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { packed } from "magnetar-common";
|
|
||||||
import { magTransProperty } from "@/scripts-mag/mag-util";
|
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
media: packed.PackDriveFileBase | misskey.entities.DriveFile;
|
media: misskey.entities.DriveFile;
|
||||||
}>(),
|
}>(),
|
||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
|
|
|
@ -53,19 +53,12 @@
|
||||||
@click="$refs.modal.close()"
|
@click="$refs.modal.close()"
|
||||||
/>
|
/>
|
||||||
<footer>
|
<footer>
|
||||||
<span>{{ image.mime_type || image.type }}</span>
|
<span>{{ image.type }}</span>
|
||||||
<span>{{ bytes(image.size) }}</span>
|
<span>{{ bytes(image.size) }}</span>
|
||||||
<span v-if="image.properties && image.properties.width"
|
<span v-if="image.properties && image.properties.width"
|
||||||
>{{ number(image.properties.width) }}px ×
|
>{{ number(image.properties.width) }}px ×
|
||||||
{{ number(image.properties.height) }}px</span
|
{{ number(image.properties.height) }}px</span
|
||||||
>
|
>
|
||||||
<span
|
|
||||||
v-if="
|
|
||||||
image.media_metadata && image.media_metadata.width
|
|
||||||
"
|
|
||||||
>{{ number(image.media_metadata.width) }}px ×
|
|
||||||
{{ number(image.media_metadata.height) }}px</span
|
|
||||||
>
|
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<button v-if="hide" class="qjewsnkg" @click="hide = false">
|
<button v-if="hide" class="qjewsnkg" @click="hide = false">
|
||||||
<ImgWithBlurhash
|
<ImgWithBlurhash
|
||||||
:hash="image.blurhash ?? undefined"
|
:hash="image.blurhash"
|
||||||
:title="image.comment"
|
:title="image.comment"
|
||||||
:alt="image.comment ?? ''"
|
:alt="image.comment"
|
||||||
/>
|
/>
|
||||||
<div class="text">
|
<div class="text">
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
|
@ -18,21 +18,14 @@
|
||||||
<div v-else class="gqnyydlz">
|
<div v-else class="gqnyydlz">
|
||||||
<a :href="image.url" :title="image.name">
|
<a :href="image.url" :title="image.name">
|
||||||
<ImgWithBlurhash
|
<ImgWithBlurhash
|
||||||
:hash="image.blurhash ?? undefined"
|
:hash="image.blurhash"
|
||||||
:src="url"
|
:src="url"
|
||||||
:alt="image.comment ?? ''"
|
:alt="image.comment"
|
||||||
:type="magTransProperty(image, 'mime_type', 'type')"
|
:type="image.type"
|
||||||
:title="image.comment"
|
:title="image.comment"
|
||||||
:cover="false"
|
:cover="false"
|
||||||
/>
|
/>
|
||||||
<div
|
<div v-if="image.type === 'image/gif'" class="gif">GIF</div>
|
||||||
v-if="
|
|
||||||
magTransProperty(image, 'mime_type', 'type') === 'image/gif'
|
|
||||||
"
|
|
||||||
class="gif"
|
|
||||||
>
|
|
||||||
GIF
|
|
||||||
</div>
|
|
||||||
</a>
|
</a>
|
||||||
<div class="_image_controls">
|
<div class="_image_controls">
|
||||||
<button
|
<button
|
||||||
|
@ -70,11 +63,9 @@ import { getStaticImageUrl } from "@/scripts/get-static-image-url";
|
||||||
import ImgWithBlurhash from "@/components/MkImgWithBlurhash.vue";
|
import ImgWithBlurhash from "@/components/MkImgWithBlurhash.vue";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { packed } from "magnetar-common";
|
|
||||||
import { magTransProperty } from "@/scripts-mag/mag-util";
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
image: packed.PackDriveFileBase | misskey.entities.DriveFile;
|
image: misskey.entities.DriveFile;
|
||||||
raw?: boolean;
|
raw?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
@ -104,10 +95,8 @@ const url =
|
||||||
props.raw || defaultStore.state.loadRawImages
|
props.raw || defaultStore.state.loadRawImages
|
||||||
? props.image.url
|
? props.image.url
|
||||||
: defaultStore.state.disableShowingAnimatedImages
|
: defaultStore.state.disableShowingAnimatedImages
|
||||||
? getStaticImageUrl(
|
? getStaticImageUrl(props.image.thumbnailUrl)
|
||||||
magTransProperty(props.image, "thumbnail_url", "thumbnailUrl")!
|
: props.image.thumbnailUrl;
|
||||||
)
|
|
||||||
: magTransProperty(props.image, "thumbnail_url", "thumbnailUrl")!;
|
|
||||||
|
|
||||||
// Plugin:register_note_view_interruptor を使って書き換えられる可能性があるためwatchする
|
// Plugin:register_note_view_interruptor を使って書き換えられる可能性があるためwatchする
|
||||||
watch(
|
watch(
|
||||||
|
@ -116,7 +105,7 @@ watch(
|
||||||
hide =
|
hide =
|
||||||
defaultStore.state.nsfw === "force"
|
defaultStore.state.nsfw === "force"
|
||||||
? true
|
? true
|
||||||
: magTransProperty(props.image, "sensitive", "isSensitive") &&
|
: props.image.isSensitive &&
|
||||||
defaultStore.state.nsfw !== "ignore";
|
defaultStore.state.nsfw !== "ignore";
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,24 +18,12 @@
|
||||||
)"
|
)"
|
||||||
>
|
>
|
||||||
<XVideo
|
<XVideo
|
||||||
v-if="
|
v-if="media.type.startsWith('video')"
|
||||||
magTransProperty(
|
|
||||||
media,
|
|
||||||
'mime_type',
|
|
||||||
'type'
|
|
||||||
).startsWith('video')
|
|
||||||
"
|
|
||||||
:key="media.id"
|
:key="media.id"
|
||||||
:video="media"
|
:video="media"
|
||||||
/>
|
/>
|
||||||
<XImage
|
<XImage
|
||||||
v-else-if="
|
v-else-if="media.type.startsWith('image')"
|
||||||
magTransProperty(
|
|
||||||
media,
|
|
||||||
'mime_type',
|
|
||||||
'type'
|
|
||||||
).startsWith('image')
|
|
||||||
"
|
|
||||||
:key="media.id"
|
:key="media.id"
|
||||||
class="image"
|
class="image"
|
||||||
:data-id="media.id"
|
:data-id="media.id"
|
||||||
|
@ -59,11 +47,10 @@ import XImage from "@/components/MkMediaImage.vue";
|
||||||
import XVideo from "@/components/MkMediaVideo.vue";
|
import XVideo from "@/components/MkMediaVideo.vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { FILE_TYPE_BROWSERSAFE } from "@/const";
|
import { FILE_TYPE_BROWSERSAFE } from "@/const";
|
||||||
import { packed } from "magnetar-common";
|
import { defaultStore } from "@/store";
|
||||||
import { magTransProperty } from "@/scripts-mag/mag-util";
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
mediaList: (packed.PackDriveFileBase | misskey.entities.DriveFile)[];
|
mediaList: misskey.entities.DriveFile[];
|
||||||
raw?: boolean;
|
raw?: boolean;
|
||||||
inDm?: boolean;
|
inDm?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
@ -75,30 +62,22 @@ onMounted(() => {
|
||||||
const lightbox = new PhotoSwipeLightbox({
|
const lightbox = new PhotoSwipeLightbox({
|
||||||
dataSource: props.mediaList
|
dataSource: props.mediaList
|
||||||
.filter((media) => {
|
.filter((media) => {
|
||||||
const type = magTransProperty(media, "mime_type", "type");
|
if (media.type === "image/svg+xml") return true; // svgのwebpublicはpngなのでtrue
|
||||||
|
|
||||||
if (type === "image/svg+xml") return true; // svgのwebpublicはpngなのでtrue
|
|
||||||
return (
|
return (
|
||||||
type.startsWith("image") &&
|
media.type.startsWith("image") &&
|
||||||
FILE_TYPE_BROWSERSAFE.includes(type)
|
FILE_TYPE_BROWSERSAFE.includes(media.type)
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.map((media) => {
|
.map((media) => {
|
||||||
const properties = magTransProperty(
|
|
||||||
media,
|
|
||||||
"media_metadata",
|
|
||||||
"properties"
|
|
||||||
);
|
|
||||||
|
|
||||||
const item = {
|
const item = {
|
||||||
src: media.url,
|
src: media.url,
|
||||||
w: properties.width,
|
w: media.properties.width,
|
||||||
h: properties.height,
|
h: media.properties.height,
|
||||||
alt: media.comment,
|
alt: media.comment,
|
||||||
};
|
};
|
||||||
if (
|
if (
|
||||||
properties.orientation != null &&
|
media.properties.orientation != null &&
|
||||||
properties.orientation >= 5
|
media.properties.orientation >= 5
|
||||||
) {
|
) {
|
||||||
[item.w, item.h] = [item.h, item.w];
|
[item.w, item.h] = [item.h, item.w];
|
||||||
}
|
}
|
||||||
|
@ -137,21 +116,16 @@ onMounted(() => {
|
||||||
const id = element.dataset.id;
|
const id = element.dataset.id;
|
||||||
const file = props.mediaList.find((media) => media.id === id);
|
const file = props.mediaList.find((media) => media.id === id);
|
||||||
|
|
||||||
if (!file) return;
|
|
||||||
|
|
||||||
const properties = magTransProperty(
|
|
||||||
file,
|
|
||||||
"media_metadata",
|
|
||||||
"properties"
|
|
||||||
);
|
|
||||||
|
|
||||||
itemData.src = file.url;
|
itemData.src = file.url;
|
||||||
itemData.w = Number(properties.width);
|
itemData.w = Number(file.properties.width);
|
||||||
itemData.h = Number(properties.height);
|
itemData.h = Number(file.properties.height);
|
||||||
if (properties.orientation != null && properties.orientation >= 5) {
|
if (
|
||||||
|
file.properties.orientation != null &&
|
||||||
|
file.properties.orientation >= 5
|
||||||
|
) {
|
||||||
[itemData.w, itemData.h] = [itemData.h, itemData.w];
|
[itemData.w, itemData.h] = [itemData.h, itemData.w];
|
||||||
}
|
}
|
||||||
itemData.msrc = magTransProperty(file, "thumbnail_url", "thumbnailUrl");
|
itemData.msrc = file.thumbnailUrl;
|
||||||
itemData.alt = file.comment;
|
itemData.alt = file.comment;
|
||||||
itemData.thumbCropped = true;
|
itemData.thumbCropped = true;
|
||||||
});
|
});
|
||||||
|
@ -204,16 +178,12 @@ onMounted(() => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const previewable = (
|
const previewable = (file: misskey.entities.DriveFile): boolean => {
|
||||||
file: packed.PackDriveFileBase | misskey.entities.DriveFile
|
if (file.type === "image/svg+xml") return true; // svgのwebpublic/thumbnailはpngなのでtrue
|
||||||
): boolean => {
|
|
||||||
const type = magTransProperty(file, "mime_type", "type");
|
|
||||||
|
|
||||||
if (type === "image/svg+xml") return true; // svgのwebpublic/thumbnailはpngなのでtrue
|
|
||||||
// FILE_TYPE_BROWSERSAFEに適合しないものはブラウザで表示するのに不適切
|
// FILE_TYPE_BROWSERSAFEに適合しないものはブラウザで表示するのに不適切
|
||||||
return (
|
return (
|
||||||
(type.startsWith("video") || type.startsWith("image")) &&
|
(file.type.startsWith("video") || file.type.startsWith("image")) &&
|
||||||
FILE_TYPE_BROWSERSAFE.includes(type)
|
FILE_TYPE_BROWSERSAFE.includes(file.type)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
const previewableCount = props.mediaList.filter((media) =>
|
const previewableCount = props.mediaList.filter((media) =>
|
||||||
|
|
|
@ -31,19 +31,14 @@
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<video
|
<video
|
||||||
:poster="
|
:poster="video.thumbnailUrl"
|
||||||
magTransProperty(video, 'thumbnail_url', 'thumbnailUrl')
|
|
||||||
"
|
|
||||||
:title="video.comment"
|
:title="video.comment"
|
||||||
:aria-label="video.comment"
|
:aria-label="video.comment"
|
||||||
preload="none"
|
preload="none"
|
||||||
controls
|
controls
|
||||||
@contextmenu.stop
|
@contextmenu.stop
|
||||||
>
|
>
|
||||||
<source
|
<source :src="video.url" :type="video.type" />
|
||||||
:src="video.url"
|
|
||||||
:type="magTransProperty(video, 'mime_type', 'type')"
|
|
||||||
/>
|
|
||||||
</video>
|
</video>
|
||||||
</VuePlyr>
|
</VuePlyr>
|
||||||
<button
|
<button
|
||||||
|
@ -63,11 +58,9 @@ import type * as misskey from "calckey-js";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import "vue-plyr/dist/vue-plyr.css";
|
import "vue-plyr/dist/vue-plyr.css";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { packed } from "magnetar-common";
|
|
||||||
import { magTransProperty } from "@/scripts-mag/mag-util";
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
video: packed.PackDriveFileBase | misskey.entities.DriveFile;
|
video: misskey.entities.DriveFile;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const plyr = ref();
|
const plyr = ref();
|
||||||
|
@ -76,8 +69,7 @@ const mini = ref(false);
|
||||||
const hide = ref(
|
const hide = ref(
|
||||||
defaultStore.state.nsfw === "force"
|
defaultStore.state.nsfw === "force"
|
||||||
? true
|
? true
|
||||||
: magTransProperty(props.video, "sensitive", "isSensitive") &&
|
: props.video.isSensitive && defaultStore.state.nsfw !== "ignore"
|
||||||
defaultStore.state.nsfw !== "ignore"
|
|
||||||
);
|
);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|
|
@ -235,23 +235,28 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { Ref } from "vue";
|
import { computed, inject, onMounted, onUnmounted, reactive, ref } from "vue";
|
||||||
import { computed, inject, onMounted, ref, toRaw } from "vue";
|
|
||||||
import * as mfm from "mfm-js";
|
import * as mfm from "mfm-js";
|
||||||
|
import type { Ref } from "vue";
|
||||||
import type * as misskey from "calckey-js";
|
import type * as misskey from "calckey-js";
|
||||||
import MkNoteSub from "@/components/MkNoteSub.vue";
|
import MkNoteSub from "@/components/MkNoteSub.vue";
|
||||||
import MkSubNoteContent from "./MkSubNoteContent.vue";
|
import MkSubNoteContent from "./MkSubNoteContent.vue";
|
||||||
import XNoteHeader from "@/components/MkNoteHeader.vue";
|
import XNoteHeader from "@/components/MkNoteHeader.vue";
|
||||||
|
import XNoteSimple from "@/components/MkNoteSimple.vue";
|
||||||
|
import XMediaList from "@/components/MkMediaList.vue";
|
||||||
|
import XCwButton from "@/components/MkCwButton.vue";
|
||||||
|
import XPoll from "@/components/MkPoll.vue";
|
||||||
import XRenoteButton from "@/components/MkRenoteButton.vue";
|
import XRenoteButton from "@/components/MkRenoteButton.vue";
|
||||||
import XReactionsViewer from "@/components/MkReactionsViewer.vue";
|
import XReactionsViewer from "@/components/MkReactionsViewer.vue";
|
||||||
import XStarButton from "@/components/MkStarButton.vue";
|
import XStarButton from "@/components/MkStarButton.vue";
|
||||||
import XStarButtonNoEmoji from "@/components/MkStarButtonNoEmoji.vue";
|
import XStarButtonNoEmoji from "@/components/MkStarButtonNoEmoji.vue";
|
||||||
import XQuoteButton from "@/components/MkQuoteButton.vue";
|
import XQuoteButton from "@/components/MkQuoteButton.vue";
|
||||||
|
import MkUrlPreview from "@/components/MkUrlPreview.vue";
|
||||||
import MkVisibility from "@/components/MkVisibility.vue";
|
import MkVisibility from "@/components/MkVisibility.vue";
|
||||||
import copyToClipboard from "@/scripts/copy-to-clipboard";
|
import copyToClipboard from "@/scripts/copy-to-clipboard";
|
||||||
import { url } from "@/config";
|
import { url } from "@/config";
|
||||||
import { pleaseLogin } from "@/scripts/please-login";
|
import { pleaseLogin } from "@/scripts/please-login";
|
||||||
import { focusNext, focusPrev } from "@/scripts/focus";
|
import { focusPrev, focusNext } from "@/scripts/focus";
|
||||||
import { getWordSoftMute } from "@/scripts/check-word-mute";
|
import { getWordSoftMute } from "@/scripts/check-word-mute";
|
||||||
import { useRouter } from "@/router";
|
import { useRouter } from "@/router";
|
||||||
import { userPage } from "@/filters/user";
|
import { userPage } from "@/filters/user";
|
||||||
|
@ -263,6 +268,7 @@ import { i18n } from "@/i18n";
|
||||||
import { getNoteMenu } from "@/scripts/get-note-menu";
|
import { getNoteMenu } from "@/scripts/get-note-menu";
|
||||||
import { useNoteCapture } from "@/scripts/use-note-capture";
|
import { useNoteCapture } from "@/scripts/use-note-capture";
|
||||||
import { notePage } from "@/filters/note";
|
import { notePage } from "@/filters/note";
|
||||||
|
import { deepClone } from "@/scripts/clone";
|
||||||
import { getNoteSummary } from "@/scripts/get-note-summary";
|
import { getNoteSummary } from "@/scripts/get-note-summary";
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
@ -274,7 +280,7 @@ const props = defineProps<{
|
||||||
collapsedReply?: boolean;
|
collapsedReply?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
let note = $ref<misskey.entities.Note>(structuredClone(toRaw(props.note)));
|
let note = $ref(deepClone(props.note));
|
||||||
|
|
||||||
const softMuteReasonI18nSrc = (what?: string) => {
|
const softMuteReasonI18nSrc = (what?: string) => {
|
||||||
if (what === "note") return i18n.ts.userSaysSomethingReason;
|
if (what === "note") return i18n.ts.userSaysSomethingReason;
|
||||||
|
@ -289,7 +295,7 @@ const softMuteReasonI18nSrc = (what?: string) => {
|
||||||
// plugin
|
// plugin
|
||||||
if (noteViewInterruptors.length > 0) {
|
if (noteViewInterruptors.length > 0) {
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
let result = structuredClone(toRaw(note));
|
let result = deepClone(note);
|
||||||
for (const interruptor of noteViewInterruptors) {
|
for (const interruptor of noteViewInterruptors) {
|
||||||
result = await interruptor.handler(result);
|
result = await interruptor.handler(result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
v-size="{ max: [500, 350, 300] }"
|
v-size="{ max: [500, 350, 300] }"
|
||||||
class="lxwezrsl _block"
|
class="lxwezrsl _block"
|
||||||
:tabindex="!isDeleted ? '-1' : null"
|
:tabindex="!isDeleted ? '-1' : null"
|
||||||
:class="{ renote: magIsRenote(note) }"
|
:class="{ renote: isRenote }"
|
||||||
>
|
>
|
||||||
<MkNoteSub
|
<MkNoteSub
|
||||||
v-if="conversation"
|
v-if="conversation"
|
||||||
|
@ -17,38 +17,38 @@
|
||||||
:note="note"
|
:note="note"
|
||||||
:detailedView="true"
|
:detailedView="true"
|
||||||
/>
|
/>
|
||||||
<MkLoading v-else-if="note.parent_note" mini />
|
<MkLoading v-else-if="note.reply" mini />
|
||||||
<MkNoteSub
|
<MkNoteSub
|
||||||
v-if="note.parent_note"
|
v-if="note.reply"
|
||||||
:note="note.parent_note"
|
:note="note.reply"
|
||||||
class="reply-to"
|
class="reply-to"
|
||||||
:detailedView="true"
|
:detailedView="true"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<MagNote
|
<MkNote
|
||||||
ref="noteEl"
|
ref="noteEl"
|
||||||
@contextmenu.stop="onContextmenu"
|
@contextmenu.stop="onContextmenu"
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
:note="note"
|
:note="note"
|
||||||
detailedView
|
detailedView
|
||||||
></MagNote>
|
></MkNote>
|
||||||
|
|
||||||
<MkTab v-model="tab" :style="'underline'" @update:modelValue="loadTab">
|
<MkTab v-model="tab" :style="'underline'" @update:modelValue="loadTab">
|
||||||
<option value="replies">
|
<option value="replies">
|
||||||
<!-- <i class="ph-arrow-u-up-left ph-bold ph-lg"></i> -->
|
<!-- <i class="ph-arrow-u-up-left ph-bold ph-lg"></i> -->
|
||||||
<span v-if="note.reply_count > 0" class="count">{{
|
<span v-if="note.repliesCount > 0" class="count">{{
|
||||||
note.reply_count
|
note.repliesCount
|
||||||
}}</span>
|
}}</span>
|
||||||
{{ i18n.ts._notification._types.reply }}
|
{{ i18n.ts._notification._types.reply }}
|
||||||
</option>
|
</option>
|
||||||
<option value="renotes" v-if="note.renote_count > 0">
|
<option value="renotes" v-if="note.renoteCount > 0">
|
||||||
<!-- <i class="ph-repeat ph-bold ph-lg"></i> -->
|
<!-- <i class="ph-repeat ph-bold ph-lg"></i> -->
|
||||||
<span class="count">{{ note.renote_count }}</span>
|
<span class="count">{{ note.renoteCount }}</span>
|
||||||
{{ i18n.ts._notification._types.renote }}
|
{{ i18n.ts._notification._types.renote }}
|
||||||
</option>
|
</option>
|
||||||
<option value="reactions" v-if="magReactionCount(note) > 0">
|
<option value="reactions" v-if="reactionsCount > 0">
|
||||||
<!-- <i class="ph-smiley ph-bold ph-lg"></i> -->
|
<!-- <i class="ph-smiley ph-bold ph-lg"></i> -->
|
||||||
<span class="count">{{ magReactionCount(note) }}</span>
|
<span class="count">{{ reactionsCount }}</span>
|
||||||
{{ i18n.ts.reaction }}
|
{{ i18n.ts.reaction }}
|
||||||
</option>
|
</option>
|
||||||
<option value="quotes" v-if="directQuotes?.length > 0">
|
<option value="quotes" v-if="directQuotes?.length > 0">
|
||||||
|
@ -73,7 +73,7 @@
|
||||||
:detailedView="true"
|
:detailedView="true"
|
||||||
:parentId="note.id"
|
:parentId="note.id"
|
||||||
/>
|
/>
|
||||||
<MkLoading v-else-if="tab === 'replies' && note.reply_count > 0" />
|
<MkLoading v-else-if="tab === 'replies' && note.repliesCount > 0" />
|
||||||
|
|
||||||
<MkNoteSub
|
<MkNoteSub
|
||||||
v-if="directQuotes && tab === 'quotes'"
|
v-if="directQuotes && tab === 'quotes'"
|
||||||
|
@ -101,7 +101,7 @@
|
||||||
:with-chart="false"
|
:with-chart="false"
|
||||||
/>
|
/>
|
||||||
<!-- </MkPagination> -->
|
<!-- </MkPagination> -->
|
||||||
<MkLoading v-else-if="tab === 'renotes' && note.renote_count > 0" />
|
<MkLoading v-else-if="tab === 'renotes' && note.renoteCount > 0" />
|
||||||
|
|
||||||
<div v-if="tab === 'clips' && clips.length > 0" class="_content clips">
|
<div v-if="tab === 'clips' && clips.length > 0" class="_content clips">
|
||||||
<MkA
|
<MkA
|
||||||
|
@ -127,7 +127,7 @@
|
||||||
<MkLoading v-else-if="tab === 'clips' && clips.length > 0" />
|
<MkLoading v-else-if="tab === 'clips' && clips.length > 0" />
|
||||||
|
|
||||||
<MkReactedUsers
|
<MkReactedUsers
|
||||||
v-if="tab === 'reactions' && magReactionCount(note) > 0"
|
v-if="tab === 'reactions' && reactionsCount > 0"
|
||||||
:note-id="note.id"
|
:note-id="note.id"
|
||||||
></MkReactedUsers>
|
></MkReactedUsers>
|
||||||
</div>
|
</div>
|
||||||
|
@ -135,7 +135,7 @@
|
||||||
<I18n :src="softMuteReasonI18nSrc(muted.what)" tag="small">
|
<I18n :src="softMuteReasonI18nSrc(muted.what)" tag="small">
|
||||||
<template #name>
|
<template #name>
|
||||||
<MkA
|
<MkA
|
||||||
v-user-preview="note.user.id"
|
v-user-preview="note.userId"
|
||||||
class="name"
|
class="name"
|
||||||
:to="userPage(note.user)"
|
:to="userPage(note.user)"
|
||||||
>
|
>
|
||||||
|
@ -150,11 +150,22 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, onUnmounted, onUpdated, ref, toRaw } from "vue";
|
import {
|
||||||
|
computed,
|
||||||
|
inject,
|
||||||
|
onMounted,
|
||||||
|
onUnmounted,
|
||||||
|
onUpdated,
|
||||||
|
reactive,
|
||||||
|
ref,
|
||||||
|
} from "vue";
|
||||||
import * as misskey from "calckey-js";
|
import * as misskey from "calckey-js";
|
||||||
import MkTab from "@/components/MkTab.vue";
|
import MkTab from "@/components/MkTab.vue";
|
||||||
|
import MkNote from "@/components/MkNote.vue";
|
||||||
import MkNoteSub from "@/components/MkNoteSub.vue";
|
import MkNoteSub from "@/components/MkNoteSub.vue";
|
||||||
|
import XStarButton from "@/components/MkStarButton.vue";
|
||||||
import XRenoteButton from "@/components/MkRenoteButton.vue";
|
import XRenoteButton from "@/components/MkRenoteButton.vue";
|
||||||
|
import MkPagination from "@/components/MkPagination.vue";
|
||||||
import MkUserCardMini from "@/components/MkUserCardMini.vue";
|
import MkUserCardMini from "@/components/MkUserCardMini.vue";
|
||||||
import MkReactedUsers from "@/components/MkReactedUsers.vue";
|
import MkReactedUsers from "@/components/MkReactedUsers.vue";
|
||||||
import { pleaseLogin } from "@/scripts/please-login";
|
import { pleaseLogin } from "@/scripts/please-login";
|
||||||
|
@ -167,20 +178,19 @@ import { $i } from "@/account";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { getNoteMenu } from "@/scripts/get-note-menu";
|
import { getNoteMenu } from "@/scripts/get-note-menu";
|
||||||
import { useNoteCapture } from "@/scripts/use-note-capture";
|
import { useNoteCapture } from "@/scripts/use-note-capture";
|
||||||
|
import { deepClone } from "@/scripts/clone";
|
||||||
import { stream } from "@/stream";
|
import { stream } from "@/stream";
|
||||||
import { NoteUpdatedEvent } from "calckey-js/built/streaming.types";
|
import { NoteUpdatedEvent } from "calckey-js/built/streaming.types";
|
||||||
import { packed } from "magnetar-common";
|
import appear from "@/directives/appear";
|
||||||
import { magIsRenote, magReactionCount } from "@/scripts-mag/mag-util";
|
|
||||||
import MagNote from "@/components/MagNote.vue";
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
note: packed.PackNoteMaybeFull;
|
note: misskey.entities.Note;
|
||||||
pinned?: boolean;
|
pinned?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
let tab = $ref("replies");
|
let tab = $ref("replies");
|
||||||
|
|
||||||
let note = $ref<packed.PackNoteMaybeFull>(structuredClone(toRaw(props.note)));
|
let note = $ref(deepClone(props.note));
|
||||||
|
|
||||||
const softMuteReasonI18nSrc = (what?: string) => {
|
const softMuteReasonI18nSrc = (what?: string) => {
|
||||||
if (what === "note") return i18n.ts.userSaysSomethingReason;
|
if (what === "note") return i18n.ts.userSaysSomethingReason;
|
||||||
|
@ -195,7 +205,7 @@ const softMuteReasonI18nSrc = (what?: string) => {
|
||||||
// plugin
|
// plugin
|
||||||
if (noteViewInterruptors.length > 0) {
|
if (noteViewInterruptors.length > 0) {
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
let result = structuredClone(toRaw(note));
|
let result = deepClone(note);
|
||||||
for (const interruptor of noteViewInterruptors) {
|
for (const interruptor of noteViewInterruptors) {
|
||||||
result = await interruptor.handler(result);
|
result = await interruptor.handler(result);
|
||||||
}
|
}
|
||||||
|
@ -221,6 +231,11 @@ let clips = $ref();
|
||||||
let renotes = $ref();
|
let renotes = $ref();
|
||||||
let isScrolling;
|
let isScrolling;
|
||||||
|
|
||||||
|
const reactionsCount = Object.values(props.note.reactions).reduce(
|
||||||
|
(x, y) => x + y,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
const keymap = {
|
const keymap = {
|
||||||
r: () => reply(true),
|
r: () => reply(true),
|
||||||
"e|a|plus": () => react(true),
|
"e|a|plus": () => react(true),
|
||||||
|
@ -279,7 +294,7 @@ function onContextmenu(ev: MouseEvent): void {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (isLink(ev.target)) return;
|
if (isLink(ev.target)) return;
|
||||||
if (window.getSelection()?.toString() !== "") return;
|
if (window.getSelection().toString() !== "") return;
|
||||||
|
|
||||||
if (defaultStore.state.useReactionPickerForContextMenu) {
|
if (defaultStore.state.useReactionPickerForContextMenu) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
@ -329,7 +344,7 @@ os.api("notes/children", {
|
||||||
depth: 12,
|
depth: 12,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
res = res.reduce((acc, resNote) => {
|
res = res.reduce((acc, resNote) => {
|
||||||
if (resNote.userId == note.user.id) {
|
if (resNote.userId == note.userId) {
|
||||||
return [...acc, resNote];
|
return [...acc, resNote];
|
||||||
}
|
}
|
||||||
return [resNote, ...acc];
|
return [resNote, ...acc];
|
||||||
|
@ -342,9 +357,9 @@ os.api("notes/children", {
|
||||||
});
|
});
|
||||||
|
|
||||||
conversation = null;
|
conversation = null;
|
||||||
if (note.parent_note_id) {
|
if (note.replyId) {
|
||||||
os.api("notes/conversation", {
|
os.api("notes/conversation", {
|
||||||
noteId: note.parent_note_id,
|
noteId: note.replyId,
|
||||||
limit: 30,
|
limit: 30,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
conversation = res.reverse();
|
conversation = res.reverse();
|
|
@ -9,13 +9,7 @@
|
||||||
@click.stop
|
@click.stop
|
||||||
>
|
>
|
||||||
<MkUserName :user="note.user" class="mkusername">
|
<MkUserName :user="note.user" class="mkusername">
|
||||||
<span
|
<span v-if="note.user.isBot" class="is-bot">bot</span>
|
||||||
v-if="
|
|
||||||
magTransProperty(note.user, 'is_bot', 'isBot')
|
|
||||||
"
|
|
||||||
class="is-bot"
|
|
||||||
>bot</span
|
|
||||||
>
|
|
||||||
</MkUserName>
|
</MkUserName>
|
||||||
</MkA>
|
</MkA>
|
||||||
<div class="username"><MkAcct :user="note.user" /></div>
|
<div class="username"><MkAcct :user="note.user" /></div>
|
||||||
|
@ -23,38 +17,16 @@
|
||||||
<div>
|
<div>
|
||||||
<div class="info">
|
<div class="info">
|
||||||
<MkA class="created-at" :to="notePage(note)">
|
<MkA class="created-at" :to="notePage(note)">
|
||||||
<MkTime
|
<MkTime :time="note.createdAt" />
|
||||||
:time="
|
|
||||||
magTransProperty(
|
|
||||||
note,
|
|
||||||
'created_at',
|
|
||||||
'createdAt'
|
|
||||||
)
|
|
||||||
"
|
|
||||||
/>
|
|
||||||
<i
|
<i
|
||||||
v-if="
|
v-if="note.updatedAt"
|
||||||
magTransProperty(
|
|
||||||
note,
|
|
||||||
'updated_at',
|
|
||||||
'updatedAt'
|
|
||||||
)
|
|
||||||
"
|
|
||||||
v-tooltip.noDelay="
|
v-tooltip.noDelay="
|
||||||
i18n.t('edited', {
|
i18n.t('edited', {
|
||||||
date: new Date(
|
date: new Date(
|
||||||
magTransProperty(
|
note.updatedAt
|
||||||
note,
|
|
||||||
'updated_at',
|
|
||||||
'updatedAt'
|
|
||||||
)!
|
|
||||||
).toLocaleDateString(),
|
).toLocaleDateString(),
|
||||||
time: new Date(
|
time: new Date(
|
||||||
magTransProperty(
|
note.updatedAt
|
||||||
note,
|
|
||||||
'updated_at',
|
|
||||||
'updatedAt'
|
|
||||||
)!
|
|
||||||
).toLocaleTimeString(),
|
).toLocaleTimeString(),
|
||||||
})
|
})
|
||||||
"
|
"
|
||||||
|
@ -65,7 +37,7 @@
|
||||||
<MkVisibility :note="note" />
|
<MkVisibility :note="note" />
|
||||||
</div>
|
</div>
|
||||||
<MkInstanceTicker
|
<MkInstanceTicker
|
||||||
v-if="showTicker && note.user.instance"
|
v-if="showTicker"
|
||||||
class="ticker"
|
class="ticker"
|
||||||
:instance="note.user.instance"
|
:instance="note.user.instance"
|
||||||
/>
|
/>
|
||||||
|
@ -75,18 +47,17 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import {} from "vue";
|
||||||
import type * as misskey from "calckey-js";
|
import type * as misskey from "calckey-js";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore, noteViewInterruptors } from "@/store";
|
||||||
import MkVisibility from "@/components/MkVisibility.vue";
|
import MkVisibility from "@/components/MkVisibility.vue";
|
||||||
import MkInstanceTicker from "@/components/MkInstanceTicker.vue";
|
import MkInstanceTicker from "@/components/MkInstanceTicker.vue";
|
||||||
import { notePage } from "@/filters/note";
|
import { notePage } from "@/filters/note";
|
||||||
import { userPage } from "@/filters/user";
|
import { userPage } from "@/filters/user";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { packed } from "magnetar-common";
|
|
||||||
import { magTransProperty } from "@/scripts-mag/mag-util";
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
note: packed.PackNoteBase | misskey.entities.Note;
|
note: misskey.entities.Note;
|
||||||
pinned?: boolean;
|
pinned?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
@ -94,7 +65,7 @@ let note = $ref(props.note);
|
||||||
|
|
||||||
const showTicker =
|
const showTicker =
|
||||||
defaultStore.state.instanceTicker === "always" ||
|
defaultStore.state.instanceTicker === "always" ||
|
||||||
(defaultStore.state.instanceTicker === "remote" && note.user.host);
|
(defaultStore.state.instanceTicker === "remote" && note.user.instance);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -11,13 +11,13 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import {} from "vue";
|
||||||
import * as misskey from "calckey-js";
|
import * as misskey from "calckey-js";
|
||||||
import XNoteHeader from "@/components/MkNoteHeader.vue";
|
import XNoteHeader from "@/components/MkNoteHeader.vue";
|
||||||
import MkSubNoteContent from "@/components/MkSubNoteContent.vue";
|
import MkSubNoteContent from "@/components/MkSubNoteContent.vue";
|
||||||
import { packed } from "magnetar-common";
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
note: packed.PackNoteMaybeFull | misskey.entities.Note;
|
note: misskey.entities.Note;
|
||||||
pinned?: boolean;
|
pinned?: boolean;
|
||||||
}>();
|
}>();
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -68,52 +68,32 @@
|
||||||
@click="reply()"
|
@click="reply()"
|
||||||
>
|
>
|
||||||
<i class="ph-arrow-u-up-left ph-bold ph-lg"></i>
|
<i class="ph-arrow-u-up-left ph-bold ph-lg"></i>
|
||||||
<template
|
<template v-if="appearNote.repliesCount > 0">
|
||||||
v-if="
|
<p class="count">{{ appearNote.repliesCount }}</p>
|
||||||
Number(
|
|
||||||
magTransProperty(
|
|
||||||
appearNote,
|
|
||||||
'reply_count',
|
|
||||||
'repliesCount'
|
|
||||||
)
|
|
||||||
) > 0
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<p class="count">
|
|
||||||
{{
|
|
||||||
magTransProperty(
|
|
||||||
appearNote,
|
|
||||||
"reply_count",
|
|
||||||
"repliesCount"
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
</p>
|
|
||||||
</template>
|
</template>
|
||||||
</button>
|
</button>
|
||||||
<XRenoteButton
|
<XRenoteButton
|
||||||
ref="renoteButton"
|
ref="renoteButton"
|
||||||
class="button"
|
class="button"
|
||||||
:note="appearNote"
|
:note="appearNote"
|
||||||
:count="
|
:count="appearNote.renoteCount"
|
||||||
Number(
|
|
||||||
magTransProperty(
|
|
||||||
appearNote,
|
|
||||||
'renote_count',
|
|
||||||
'renoteCount'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
"
|
|
||||||
/>
|
/>
|
||||||
<XStarButtonNoEmoji
|
<XStarButtonNoEmoji
|
||||||
v-if="!enableEmojiReactions"
|
v-if="!enableEmojiReactions"
|
||||||
class="button"
|
class="button"
|
||||||
:note="appearNote"
|
:note="appearNote"
|
||||||
:count="magReactionCount(appearNote)"
|
:count="
|
||||||
:reacted="magHasReacted(appearNote)"
|
Object.values(appearNote.reactions).reduce(
|
||||||
|
(partialSum, val) => partialSum + val,
|
||||||
|
0
|
||||||
|
)
|
||||||
|
"
|
||||||
|
:reacted="appearNote.myReaction != null"
|
||||||
/>
|
/>
|
||||||
<XStarButton
|
<XStarButton
|
||||||
v-if="
|
v-if="
|
||||||
enableEmojiReactions && !magHasReacted(appearNote)
|
enableEmojiReactions &&
|
||||||
|
appearNote.myReaction == null
|
||||||
"
|
"
|
||||||
ref="starButton"
|
ref="starButton"
|
||||||
class="button"
|
class="button"
|
||||||
|
@ -121,7 +101,8 @@
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
v-if="
|
v-if="
|
||||||
enableEmojiReactions && !magHasReacted(appearNote)
|
enableEmojiReactions &&
|
||||||
|
appearNote.myReaction == null
|
||||||
"
|
"
|
||||||
ref="reactButton"
|
ref="reactButton"
|
||||||
v-tooltip.noDelay.bottom="i18n.ts.reaction"
|
v-tooltip.noDelay.bottom="i18n.ts.reaction"
|
||||||
|
@ -131,7 +112,10 @@
|
||||||
<i class="ph-smiley ph-bold ph-lg"></i>
|
<i class="ph-smiley ph-bold ph-lg"></i>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
v-if="enableEmojiReactions && magHasReacted(appearNote)"
|
v-if="
|
||||||
|
enableEmojiReactions &&
|
||||||
|
appearNote.myReaction != null
|
||||||
|
"
|
||||||
ref="reactButton"
|
ref="reactButton"
|
||||||
class="button _button reacted"
|
class="button _button reacted"
|
||||||
@click="undoReact(appearNote)"
|
@click="undoReact(appearNote)"
|
||||||
|
@ -178,9 +162,7 @@
|
||||||
<I18n :src="softMuteReasonI18nSrc(muted.what)" tag="small">
|
<I18n :src="softMuteReasonI18nSrc(muted.what)" tag="small">
|
||||||
<template #name>
|
<template #name>
|
||||||
<MkA
|
<MkA
|
||||||
v-user-preview="
|
v-user-preview="note.userId"
|
||||||
magTransMap(note, 'user', 'userId', (u) => u.id)
|
|
||||||
"
|
|
||||||
class="name"
|
class="name"
|
||||||
:to="userPage(note.user)"
|
:to="userPage(note.user)"
|
||||||
>
|
>
|
||||||
|
@ -195,8 +177,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import { inject, ref } from "vue";
|
||||||
import type { Ref } from "vue";
|
import type { Ref } from "vue";
|
||||||
import { inject, ref, toRaw } from "vue";
|
|
||||||
import * as misskey from "calckey-js";
|
import * as misskey from "calckey-js";
|
||||||
import XNoteHeader from "@/components/MkNoteHeader.vue";
|
import XNoteHeader from "@/components/MkNoteHeader.vue";
|
||||||
import MkSubNoteContent from "@/components/MkSubNoteContent.vue";
|
import MkSubNoteContent from "@/components/MkSubNoteContent.vue";
|
||||||
|
@ -219,20 +201,13 @@ import { $i } from "@/account";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { useNoteCapture } from "@/scripts/use-note-capture";
|
import { useNoteCapture } from "@/scripts/use-note-capture";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import { packed } from "magnetar-common";
|
import { deepClone } from "@/scripts/clone";
|
||||||
import {
|
|
||||||
magHasReacted,
|
|
||||||
magIsRenote,
|
|
||||||
magReactionCount,
|
|
||||||
magTransMap,
|
|
||||||
magTransProperty,
|
|
||||||
} from "@/scripts-mag/mag-util";
|
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
note: packed.PackNoteMaybeFull | misskey.entities.Note;
|
note: misskey.entities.Note;
|
||||||
conversation?: misskey.entities.Note[];
|
conversation?: misskey.entities.Note[];
|
||||||
parentId?;
|
parentId?;
|
||||||
detailedView?;
|
detailedView?;
|
||||||
|
@ -248,9 +223,7 @@ const props = withDefaults(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
let note = $ref<packed.PackNoteMaybeFull | misskey.entities.Note>(
|
let note = $ref(deepClone(props.note));
|
||||||
structuredClone(toRaw(props.note))
|
|
||||||
);
|
|
||||||
|
|
||||||
const softMuteReasonI18nSrc = (what?: string) => {
|
const softMuteReasonI18nSrc = (what?: string) => {
|
||||||
if (what === "note") return i18n.ts.userSaysSomethingReason;
|
if (what === "note") return i18n.ts.userSaysSomethingReason;
|
||||||
|
@ -262,6 +235,12 @@ const softMuteReasonI18nSrc = (what?: string) => {
|
||||||
return i18n.ts.userSaysSomething;
|
return i18n.ts.userSaysSomething;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isRenote =
|
||||||
|
note.renote != null &&
|
||||||
|
note.text == null &&
|
||||||
|
note.fileIds.length === 0 &&
|
||||||
|
note.poll == null;
|
||||||
|
|
||||||
const el = ref<HTMLElement>();
|
const el = ref<HTMLElement>();
|
||||||
const footerEl = ref<HTMLElement>();
|
const footerEl = ref<HTMLElement>();
|
||||||
const menuButton = ref<HTMLElement>();
|
const menuButton = ref<HTMLElement>();
|
||||||
|
@ -269,11 +248,7 @@ const starButton = ref<InstanceType<typeof XStarButton>>();
|
||||||
const renoteButton = ref<InstanceType<typeof XRenoteButton>>();
|
const renoteButton = ref<InstanceType<typeof XRenoteButton>>();
|
||||||
const reactButton = ref<HTMLElement>();
|
const reactButton = ref<HTMLElement>();
|
||||||
let appearNote = $computed(() =>
|
let appearNote = $computed(() =>
|
||||||
magIsRenote(note)
|
isRenote ? (note.renote as misskey.entities.Note) : note
|
||||||
? (magTransProperty(note, "renoted_note", "renote") as
|
|
||||||
| packed.PackNoteMaybeFull
|
|
||||||
| misskey.entities.Note)
|
|
||||||
: note
|
|
||||||
);
|
);
|
||||||
const isDeleted = ref(false);
|
const isDeleted = ref(false);
|
||||||
const muted = ref(getWordSoftMute(note, $i, defaultStore.state.mutedWords));
|
const muted = ref(getWordSoftMute(note, $i, defaultStore.state.mutedWords));
|
||||||
|
@ -354,8 +329,6 @@ function menu(viaKeyboard = false): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onContextmenu(ev: MouseEvent): void {
|
function onContextmenu(ev: MouseEvent): void {
|
||||||
if (!ev.target || !(ev.target instanceof HTMLElement)) return;
|
|
||||||
|
|
||||||
const isLink = (el: HTMLElement) => {
|
const isLink = (el: HTMLElement) => {
|
||||||
if (el.tagName === "A") return true;
|
if (el.tagName === "A") return true;
|
||||||
if (el.parentElement) {
|
if (el.parentElement) {
|
||||||
|
@ -363,7 +336,7 @@ function onContextmenu(ev: MouseEvent): void {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (isLink(ev.target)) return;
|
if (isLink(ev.target)) return;
|
||||||
if (window.getSelection()?.toString() !== "") return;
|
if (window.getSelection().toString() !== "") return;
|
||||||
|
|
||||||
if (defaultStore.state.useReactionPickerForContextMenu) {
|
if (defaultStore.state.useReactionPickerForContextMenu) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
@ -422,15 +395,15 @@ function onContextmenu(ev: MouseEvent): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
function focus() {
|
function focus() {
|
||||||
el.value?.focus();
|
el.value.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
function blur() {
|
function blur() {
|
||||||
el.value?.blur();
|
el.value.blur();
|
||||||
}
|
}
|
||||||
|
|
||||||
function noteClick(e) {
|
function noteClick(e) {
|
||||||
if (document.getSelection()?.type === "Range" || !expandOnNoteClick) {
|
if (document.getSelection().type === "Range" || !expandOnNoteClick) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
} else {
|
} else {
|
||||||
router.push(notePage(props.note));
|
router.push(notePage(props.note));
|
||||||
|
|
|
@ -2,50 +2,31 @@
|
||||||
<div class="tivcixzd" :class="{ done: closed || isVoted }">
|
<div class="tivcixzd" :class="{ done: closed || isVoted }">
|
||||||
<ul>
|
<ul>
|
||||||
<li
|
<li
|
||||||
v-for="(choice, i) in magTransProperty(
|
v-for="(choice, i) in note.poll.choices"
|
||||||
note.poll,
|
|
||||||
'options',
|
|
||||||
'choices'
|
|
||||||
)"
|
|
||||||
:key="i"
|
:key="i"
|
||||||
:class="{ voted: magTransProperty(choice, 'voted', 'isVoted') }"
|
:class="{ voted: choice.voted }"
|
||||||
@click.stop="vote(i)"
|
@click.stop="vote(i)"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="backdrop"
|
class="backdrop"
|
||||||
:style="{
|
:style="{
|
||||||
width: `${
|
width: `${
|
||||||
showResult
|
showResult ? (choice.votes / total) * 100 : 0
|
||||||
? (magTransProperty(
|
|
||||||
choice,
|
|
||||||
'votes_count',
|
|
||||||
'votes'
|
|
||||||
) /
|
|
||||||
total) *
|
|
||||||
100
|
|
||||||
: 0
|
|
||||||
}%`,
|
}%`,
|
||||||
}"
|
}"
|
||||||
></div>
|
></div>
|
||||||
<span>
|
<span>
|
||||||
<template
|
<template v-if="choice.isVoted"
|
||||||
v-if="magTransProperty(choice, 'voted', 'isVoted')"
|
|
||||||
><i class="ph-check ph-bold ph-lg"></i
|
><i class="ph-check ph-bold ph-lg"></i
|
||||||
></template>
|
></template>
|
||||||
<Mfm
|
<Mfm
|
||||||
:text="magTransProperty(choice, 'title', 'text')"
|
:text="choice.text"
|
||||||
:plain="true"
|
:plain="true"
|
||||||
:custom-emojis="note.emojis"
|
:custom-emojis="note.emojis"
|
||||||
/>
|
/>
|
||||||
<span v-if="showResult" class="votes"
|
<span v-if="showResult" class="votes"
|
||||||
>({{
|
>({{
|
||||||
i18n.t("_poll.votesCount", {
|
i18n.t("_poll.votesCount", { n: choice.votes })
|
||||||
n: magTransProperty(
|
|
||||||
choice,
|
|
||||||
"votes_count",
|
|
||||||
"votes"
|
|
||||||
),
|
|
||||||
})
|
|
||||||
}})</span
|
}})</span
|
||||||
>
|
>
|
||||||
</span>
|
</span>
|
||||||
|
@ -84,35 +65,22 @@ import { pleaseLogin } from "@/scripts/please-login";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { useInterval } from "@/scripts/use-interval";
|
import { useInterval } from "@/scripts/use-interval";
|
||||||
import { packed } from "magnetar-common";
|
|
||||||
import { magTransProperty } from "@/scripts-mag/mag-util";
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
note:
|
note: misskey.entities.Note & Required<Pick<misskey.entities.Note, "poll">>;
|
||||||
| (packed.PackNoteMaybeFull & { poll: {} })
|
|
||||||
| (misskey.entities.Note &
|
|
||||||
Required<Pick<misskey.entities.Note, "poll">>);
|
|
||||||
readOnly?: boolean;
|
readOnly?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const pollRefreshing = ref(false);
|
const pollRefreshing = ref(false);
|
||||||
const remaining = ref(-1);
|
const remaining = ref(-1);
|
||||||
|
|
||||||
const total = computed(() =>
|
const total = computed(() => sum(props.note.poll.choices.map((x) => x.votes)));
|
||||||
sum(
|
|
||||||
magTransProperty(props.note.poll, "options", "choices").map(
|
|
||||||
(x) => magTransProperty(x, "votes_count", "votes") as number
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
const closed = computed(() => remaining.value === 0);
|
const closed = computed(() => remaining.value === 0);
|
||||||
const isLocal = computed(() => !props.note.uri);
|
const isLocal = computed(() => !props.note.uri);
|
||||||
const isVoted = computed(
|
const isVoted = computed(
|
||||||
() =>
|
() =>
|
||||||
!magTransProperty(props.note.poll, "multiple_choice", "multiple") &&
|
!props.note.poll.multiple &&
|
||||||
magTransProperty(props.note.poll, "options", "choices").some(
|
props.note.poll.choices.some((c) => c.isVoted)
|
||||||
(c) => magTransProperty(c, "voted", "isVoted") ?? false
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
const timer = computed(() =>
|
const timer = computed(() =>
|
||||||
i18n.t(
|
i18n.t(
|
||||||
|
@ -135,17 +103,11 @@ const timer = computed(() =>
|
||||||
const showResult = ref(props.readOnly || isVoted.value);
|
const showResult = ref(props.readOnly || isVoted.value);
|
||||||
|
|
||||||
// 期限付きアンケート
|
// 期限付きアンケート
|
||||||
if (magTransProperty(props.note.poll, "expires_at", "expiresAt")) {
|
if (props.note.poll.expiresAt) {
|
||||||
const tick = () => {
|
const tick = () => {
|
||||||
remaining.value = Math.floor(
|
remaining.value = Math.floor(
|
||||||
Math.max(
|
Math.max(
|
||||||
new Date(
|
new Date(props.note.poll.expiresAt!).getTime() - Date.now(),
|
||||||
magTransProperty(
|
|
||||||
props.note.poll,
|
|
||||||
"expires_at",
|
|
||||||
"expiresAt"
|
|
||||||
)!
|
|
||||||
).getTime() - Date.now(),
|
|
||||||
0
|
0
|
||||||
) / 1000
|
) / 1000
|
||||||
);
|
);
|
||||||
|
@ -190,11 +152,7 @@ const vote = async (id: number) => {
|
||||||
const { canceled } = await os.confirm({
|
const { canceled } = await os.confirm({
|
||||||
type: "question",
|
type: "question",
|
||||||
text: i18n.t("voteConfirm", {
|
text: i18n.t("voteConfirm", {
|
||||||
choice: magTransProperty(
|
choice: props.note.poll.choices[id].text,
|
||||||
magTransProperty(props.note.poll, "options", "choices")[id],
|
|
||||||
"title",
|
|
||||||
"text"
|
|
||||||
),
|
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
if (canceled) return;
|
if (canceled) return;
|
||||||
|
@ -203,12 +161,7 @@ const vote = async (id: number) => {
|
||||||
noteId: props.note.id,
|
noteId: props.note.id,
|
||||||
choice: id,
|
choice: id,
|
||||||
});
|
});
|
||||||
if (!showResult.value)
|
if (!showResult.value) showResult.value = !props.note.poll.multiple;
|
||||||
showResult.value = !magTransProperty(
|
|
||||||
props.note.poll,
|
|
||||||
"multiple_choice",
|
|
||||||
"multiple"
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -252,32 +252,24 @@ import {
|
||||||
openAccountMenu as openAccountMenu_,
|
openAccountMenu as openAccountMenu_,
|
||||||
} from "@/account";
|
} from "@/account";
|
||||||
import { uploadFile } from "@/scripts/upload";
|
import { uploadFile } from "@/scripts/upload";
|
||||||
|
import { deepClone } from "@/scripts/clone";
|
||||||
import XCheatSheet from "@/components/MkCheatSheetDialog.vue";
|
import XCheatSheet from "@/components/MkCheatSheetDialog.vue";
|
||||||
import { preprocess } from "@/scripts/preprocess";
|
import { preprocess } from "@/scripts/preprocess";
|
||||||
import { packed } from "magnetar-common";
|
|
||||||
import {
|
|
||||||
magLegacyVisibility,
|
|
||||||
magTransMap,
|
|
||||||
magTransProperty,
|
|
||||||
} from "@/scripts-mag/mag-util";
|
|
||||||
|
|
||||||
const modal = inject("modal");
|
const modal = inject("modal");
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
reply?: packed.PackNoteMaybeFull | misskey.entities.Note;
|
reply?: misskey.entities.Note;
|
||||||
renote?: packed.PackNoteMaybeFull | misskey.entities.Note;
|
renote?: misskey.entities.Note;
|
||||||
mention?: misskey.entities.User;
|
mention?: misskey.entities.User;
|
||||||
specified?: misskey.entities.User;
|
specified?: misskey.entities.User;
|
||||||
initialText?: string;
|
initialText?: string;
|
||||||
initialVisibility?: typeof misskey.noteVisibilities;
|
initialVisibility?: typeof misskey.noteVisibilities;
|
||||||
initialFiles?: (
|
initialFiles?: misskey.entities.DriveFile[];
|
||||||
| packed.PackDriveFileBase
|
|
||||||
| misskey.entities.DriveFile
|
|
||||||
)[];
|
|
||||||
initialLocalOnly?: boolean;
|
initialLocalOnly?: boolean;
|
||||||
initialVisibleUsers?: misskey.entities.User[];
|
initialVisibleUsers?: misskey.entities.User[];
|
||||||
initialNote?: packed.PackNoteMaybeFull | misskey.entities.Note;
|
initialNote?: misskey.entities.Note;
|
||||||
instant?: boolean;
|
instant?: boolean;
|
||||||
fixed?: boolean;
|
fixed?: boolean;
|
||||||
autofocus?: boolean;
|
autofocus?: boolean;
|
||||||
|
@ -473,26 +465,21 @@ if (
|
||||||
) {
|
) {
|
||||||
visibility = "specified";
|
visibility = "specified";
|
||||||
} else {
|
} else {
|
||||||
visibility = magLegacyVisibility(props.reply.visibility);
|
visibility = props.reply.visibility;
|
||||||
}
|
}
|
||||||
if (visibility === "specified") {
|
if (visibility === "specified") {
|
||||||
const ids = magTransProperty(
|
if (props.reply.visibleUserIds) {
|
||||||
props.reply,
|
|
||||||
"visible_user_ids",
|
|
||||||
"visibleUserIds"
|
|
||||||
);
|
|
||||||
if (ids) {
|
|
||||||
os.api("users/show", {
|
os.api("users/show", {
|
||||||
userIds: ids.filter(
|
userIds: props.reply.visibleUserIds.filter(
|
||||||
(uid) => uid !== $i.id && uid !== props.reply!.user.id
|
(uid) => uid !== $i.id && uid !== props.reply.userId
|
||||||
),
|
),
|
||||||
}).then((users) => {
|
}).then((users) => {
|
||||||
users.forEach(pushVisibleUser);
|
users.forEach(pushVisibleUser);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (props.reply.user.id !== $i.id) {
|
if (props.reply.userId !== $i.id) {
|
||||||
os.api("users/show", { userId: props.reply.user.id }).then(
|
os.api("users/show", { userId: props.reply.userId }).then(
|
||||||
(user) => {
|
(user) => {
|
||||||
pushVisibleUser(user);
|
pushVisibleUser(user);
|
||||||
}
|
}
|
||||||
|
@ -604,10 +591,7 @@ function updateFiles(_files) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateFileSensitive(file, sensitive) {
|
function updateFileSensitive(file, sensitive) {
|
||||||
const idx = files.findIndex((x) => x.id === file.id);
|
files[files.findIndex((x) => x.id === file.id)].isSensitive = sensitive;
|
||||||
const f = files[idx];
|
|
||||||
if ("isSensitive" in f) f.isSensitive = sensitive;
|
|
||||||
else f.sensitive = sensitive;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateFileName(file, name) {
|
function updateFileName(file, name) {
|
||||||
|
@ -846,7 +830,7 @@ async function post() {
|
||||||
// plugin
|
// plugin
|
||||||
if (notePostInterruptors.length > 0) {
|
if (notePostInterruptors.length > 0) {
|
||||||
for (const interruptor of notePostInterruptors) {
|
for (const interruptor of notePostInterruptors) {
|
||||||
postData = await interruptor.handler(structuredClone(postData));
|
postData = await interruptor.handler(deepClone(postData));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -988,39 +972,20 @@ onMounted(() => {
|
||||||
if (props.initialNote) {
|
if (props.initialNote) {
|
||||||
const init = props.initialNote;
|
const init = props.initialNote;
|
||||||
text = init.text ? init.text : "";
|
text = init.text ? init.text : "";
|
||||||
|
files = init.files;
|
||||||
files = magTransProperty(init, "attachments", "files") ?? [];
|
|
||||||
cw = init.cw;
|
cw = init.cw;
|
||||||
useCw = init.cw != null;
|
useCw = init.cw != null;
|
||||||
if (init.poll) {
|
if (init.poll) {
|
||||||
poll = {
|
poll = {
|
||||||
choices: magTransMap(
|
choices: init.poll.choices.map((x) => x.text),
|
||||||
init.poll,
|
multiple: init.poll.multiple,
|
||||||
"options",
|
expiresAt: init.poll.expiresAt,
|
||||||
"choices",
|
expiredAfter: init.poll.expiredAfter,
|
||||||
(a) => a.map((x) => x.title),
|
|
||||||
(b) => b.map((x) => x.text)
|
|
||||||
),
|
|
||||||
multiple: magTransProperty(
|
|
||||||
init.poll,
|
|
||||||
"multiple_choice",
|
|
||||||
"multiple"
|
|
||||||
),
|
|
||||||
expiresAt: magTransProperty(
|
|
||||||
init.poll,
|
|
||||||
"expires_at",
|
|
||||||
"expiresAt"
|
|
||||||
),
|
|
||||||
// TODO(Natty)
|
|
||||||
expiredAfter: null,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
visibility = magLegacyVisibility(init.visibility);
|
visibility = init.visibility;
|
||||||
localOnly =
|
localOnly = init.localOnly;
|
||||||
magTransProperty(init, "local_only", "localOnly") ?? false;
|
quoteId = init.renote ? init.renote.id : null;
|
||||||
quoteId = magTransProperty(init, "renote", "renoted_note")
|
|
||||||
? magTransProperty(init, "renote", "renoted_note")!.id
|
|
||||||
: null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nextTick(() => watchForDraft());
|
nextTick(() => watchForDraft());
|
||||||
|
|
|
@ -20,10 +20,7 @@
|
||||||
:file="element"
|
:file="element"
|
||||||
fit="cover"
|
fit="cover"
|
||||||
/>
|
/>
|
||||||
<div
|
<div v-if="element.isSensitive" class="sensitive">
|
||||||
v-if="element.sensitive ?? element.isSensitive"
|
|
||||||
class="sensitive"
|
|
||||||
>
|
|
||||||
<i class="ph-warning ph-bold ph-lg icon"></i>
|
<i class="ph-warning ph-bold ph-lg icon"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -34,7 +31,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineAsyncComponent, defineComponent } from "vue";
|
import { defineComponent, defineAsyncComponent } from "vue";
|
||||||
import MkDriveFileThumbnail from "@/components/MkDriveFileThumbnail.vue";
|
import MkDriveFileThumbnail from "@/components/MkDriveFileThumbnail.vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
|
@ -89,13 +86,9 @@ export default defineComponent({
|
||||||
toggleSensitive(file) {
|
toggleSensitive(file) {
|
||||||
os.api("drive/files/update", {
|
os.api("drive/files/update", {
|
||||||
fileId: file.id,
|
fileId: file.id,
|
||||||
isSensitive: !(file.sensitive ?? file.isSensitive),
|
isSensitive: !file.isSensitive,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.$emit(
|
this.$emit("changeSensitive", file, !file.isSensitive);
|
||||||
"changeSensitive",
|
|
||||||
file,
|
|
||||||
!(file.sensitive ?? file.isSensitive)
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async rename(file) {
|
async rename(file) {
|
||||||
|
@ -157,8 +150,7 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text:
|
text: file.isSensitive
|
||||||
file.sensitive ?? file.isSensitive
|
|
||||||
? i18n.ts.unmarkAsSensitive
|
? i18n.ts.unmarkAsSensitive
|
||||||
: i18n.ts.markAsSensitive,
|
: i18n.ts.markAsSensitive,
|
||||||
icon: file.isSensitive
|
icon: file.isSensitive
|
||||||
|
|
|
@ -19,14 +19,14 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import {} from "vue";
|
||||||
import * as misskey from "calckey-js";
|
import * as misskey from "calckey-js";
|
||||||
import MkModal from "@/components/MkModal.vue";
|
import MkModal from "@/components/MkModal.vue";
|
||||||
import MkPostForm from "@/components/MkPostForm.vue";
|
import MkPostForm from "@/components/MkPostForm.vue";
|
||||||
import { packed } from "magnetar-common";
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
reply?: packed.PackNoteMaybeFull | misskey.entities.Note;
|
reply?: misskey.entities.Note;
|
||||||
renote?: packed.PackNoteMaybeFull | misskey.entities.Note;
|
renote?: misskey.entities.Note;
|
||||||
mention?: misskey.entities.User;
|
mention?: misskey.entities.User;
|
||||||
specified?: misskey.entities.User;
|
specified?: misskey.entities.User;
|
||||||
initialText?: string;
|
initialText?: string;
|
||||||
|
@ -34,7 +34,7 @@ const props = defineProps<{
|
||||||
initialFiles?: misskey.entities.DriveFile[];
|
initialFiles?: misskey.entities.DriveFile[];
|
||||||
initialLocalOnly?: boolean;
|
initialLocalOnly?: boolean;
|
||||||
initialVisibleUsers?: misskey.entities.User[];
|
initialVisibleUsers?: misskey.entities.User[];
|
||||||
initialNote?: packed.PackNoteMaybeFull | misskey.entities.Note;
|
initialNote?: misskey.entities.Note;
|
||||||
instant?: boolean;
|
instant?: boolean;
|
||||||
fixed?: boolean;
|
fixed?: boolean;
|
||||||
autofocus?: boolean;
|
autofocus?: boolean;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
v-ripple="canToggle"
|
v-ripple="canToggle"
|
||||||
class="hkzvhatu _button"
|
class="hkzvhatu _button"
|
||||||
:class="{
|
:class="{
|
||||||
reacted: magReactionSelf(note) === reaction,
|
reacted: note.myReaction == reaction,
|
||||||
canToggle,
|
canToggle,
|
||||||
newlyAdded: !isInitial,
|
newlyAdded: !isInitial,
|
||||||
}"
|
}"
|
||||||
|
@ -28,14 +28,12 @@ import XReactionIcon from "@/components/MkReactionIcon.vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { useTooltip } from "@/scripts/use-tooltip";
|
import { useTooltip } from "@/scripts/use-tooltip";
|
||||||
import { $i } from "@/account";
|
import { $i } from "@/account";
|
||||||
import { packed } from "magnetar-common";
|
|
||||||
import { magReactionSelf } from "@/scripts-mag/mag-util";
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
reaction: string;
|
reaction: string;
|
||||||
count: number;
|
count: number;
|
||||||
isInitial: boolean;
|
isInitial: boolean;
|
||||||
note: packed.PackNoteMaybeFull | misskey.entities.Note;
|
note: misskey.entities.Note;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const buttonRef = ref<HTMLElement>();
|
const buttonRef = ref<HTMLElement>();
|
||||||
|
@ -45,7 +43,7 @@ const canToggle = computed(() => !props.reaction.match(/@\w/) && $i);
|
||||||
const toggleReaction = () => {
|
const toggleReaction = () => {
|
||||||
if (!canToggle.value) return;
|
if (!canToggle.value) return;
|
||||||
|
|
||||||
const oldReaction = magReactionSelf(props.note);
|
const oldReaction = props.note.myReaction;
|
||||||
if (oldReaction) {
|
if (oldReaction) {
|
||||||
os.api("notes/reactions/delete", {
|
os.api("notes/reactions/delete", {
|
||||||
noteId: props.note.id,
|
noteId: props.note.id,
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="tdflqwzn" :class="{ isMe }">
|
<div class="tdflqwzn" :class="{ isMe }">
|
||||||
<XReaction
|
<XReaction
|
||||||
v-for="r in Array.isArray(note.reactions)
|
v-for="(count, reaction) in note.reactions"
|
||||||
? note.reactions
|
:key="reaction"
|
||||||
: Object.entries(note.reactions)"
|
:reaction="reaction"
|
||||||
:key="magReactionPairToLegacy(r)[0]"
|
:count="count"
|
||||||
:reaction="magReactionPairToLegacy(r)[0]"
|
:is-initial="initialReactions.has(reaction)"
|
||||||
:count="magReactionPairToLegacy(r)[1]"
|
|
||||||
:is-initial="initialReactions.has(magReactionPairToLegacy(r)[0])"
|
|
||||||
:note="note"
|
:note="note"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -18,16 +16,14 @@ import { computed } from "vue";
|
||||||
import * as misskey from "calckey-js";
|
import * as misskey from "calckey-js";
|
||||||
import { $i } from "@/account";
|
import { $i } from "@/account";
|
||||||
import XReaction from "@/components/MkReactionsViewer.reaction.vue";
|
import XReaction from "@/components/MkReactionsViewer.reaction.vue";
|
||||||
import { packed } from "magnetar-common";
|
|
||||||
import { magReactionPairToLegacy } from "@/scripts-mag/mag-util";
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
note: packed.PackNoteMaybeFull | misskey.entities.Note;
|
note: misskey.entities.Note;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const initialReactions = new Set(Object.keys(props.note.reactions));
|
const initialReactions = new Set(Object.keys(props.note.reactions));
|
||||||
|
|
||||||
const isMe = computed(() => $i && $i.id === props.note.user.id);
|
const isMe = computed(() => $i && $i.id === props.note.userId);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, ref } from "vue";
|
import { computed, ref } from "vue";
|
||||||
|
import type * as misskey from "calckey-js";
|
||||||
import Ripple from "@/components/MkRipple.vue";
|
import Ripple from "@/components/MkRipple.vue";
|
||||||
import XDetails from "@/components/MkUsersTooltip.vue";
|
import XDetails from "@/components/MkUsersTooltip.vue";
|
||||||
import { pleaseLogin } from "@/scripts/please-login";
|
import { pleaseLogin } from "@/scripts/please-login";
|
||||||
|
@ -32,37 +33,21 @@ import { useTooltip } from "@/scripts/use-tooltip";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import { MenuItem } from "@/types/menu";
|
import { MenuItem } from "@/types/menu";
|
||||||
import { packed } from "magnetar-common";
|
|
||||||
import {
|
|
||||||
magLegacyVisibility,
|
|
||||||
magTransMap,
|
|
||||||
magTransProperty,
|
|
||||||
} from "@/scripts-mag/mag-util";
|
|
||||||
import * as Misskey from "calckey-js";
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
note: packed.PackNoteMaybeFull | Misskey.entities.Note;
|
note: misskey.entities.Note;
|
||||||
count: number;
|
count: number;
|
||||||
detailedView?;
|
detailedView?;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const buttonRef = ref<HTMLElement>();
|
const buttonRef = ref<HTMLElement>();
|
||||||
|
|
||||||
const hasRenotedBefore = ref<boolean>(
|
const hasRenotedBefore = ref(props.note.hasRenotedBefore ?? false);
|
||||||
magTransMap(
|
|
||||||
props.note,
|
|
||||||
"self_renote_count",
|
|
||||||
"hasRenotedBefore",
|
|
||||||
(n) => (n ?? 0) > 0
|
|
||||||
) ?? false
|
|
||||||
);
|
|
||||||
|
|
||||||
const canRenote = computed(
|
const canRenote = computed(
|
||||||
() =>
|
() =>
|
||||||
["public", "home"].includes(props.note.visibility) ||
|
["public", "home"].includes(props.note.visibility) ||
|
||||||
($i &&
|
props.note.userId === $i.id
|
||||||
magTransMap(props.note, "user", "userId", (user) => user.id) ===
|
|
||||||
$i.id)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
useTooltip(buttonRef, async (showing) => {
|
useTooltip(buttonRef, async (showing) => {
|
||||||
|
@ -156,12 +141,7 @@ const renote = async (viaKeyboard = false, ev?: MouseEvent) => {
|
||||||
os.api("notes/create", {
|
os.api("notes/create", {
|
||||||
renoteId: props.note.id,
|
renoteId: props.note.id,
|
||||||
visibility: "specified",
|
visibility: "specified",
|
||||||
visibleUserIds:
|
visibleUserIds: props.note.visibleUserIds,
|
||||||
magTransProperty(
|
|
||||||
props.note,
|
|
||||||
"visible_user_ids",
|
|
||||||
"visibleUserIds"
|
|
||||||
) ?? [],
|
|
||||||
});
|
});
|
||||||
hasRenotedBefore.value = true;
|
hasRenotedBefore.value = true;
|
||||||
const el =
|
const el =
|
||||||
|
@ -213,25 +193,16 @@ const renote = async (viaKeyboard = false, ev?: MouseEvent) => {
|
||||||
action: () => {
|
action: () => {
|
||||||
os.api(
|
os.api(
|
||||||
"notes/create",
|
"notes/create",
|
||||||
magLegacyVisibility(props.note.visibility) === "specified"
|
props.note.visibility === "specified"
|
||||||
? {
|
? {
|
||||||
renoteId: props.note.id,
|
renoteId: props.note.id,
|
||||||
visibility: magLegacyVisibility(
|
visibility: props.note.visibility,
|
||||||
props.note.visibility
|
visibleUserIds: props.note.visibleUserIds,
|
||||||
),
|
|
||||||
visibleUserIds:
|
|
||||||
magTransProperty(
|
|
||||||
props.note,
|
|
||||||
"visible_user_ids",
|
|
||||||
"visibleUserIds"
|
|
||||||
) ?? [],
|
|
||||||
localOnly: true,
|
localOnly: true,
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
renoteId: props.note.id,
|
renoteId: props.note.id,
|
||||||
visibility: magLegacyVisibility(
|
visibility: props.note.visibility,
|
||||||
props.note.visibility
|
|
||||||
),
|
|
||||||
localOnly: true,
|
localOnly: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -45,10 +45,9 @@ import * as os from "@/os";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { instance } from "@/instance";
|
import { instance } from "@/instance";
|
||||||
import { packed } from "magnetar-common";
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
note: packed.PackNoteBase | Note;
|
note: Note;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
function star(ev?: MouseEvent): void {
|
function star(ev?: MouseEvent): void {
|
||||||
|
|
|
@ -47,13 +47,13 @@ import Ripple from "@/components/MkRipple.vue";
|
||||||
import XDetails from "@/components/MkUsersTooltip.vue";
|
import XDetails from "@/components/MkUsersTooltip.vue";
|
||||||
import { pleaseLogin } from "@/scripts/please-login";
|
import { pleaseLogin } from "@/scripts/please-login";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
|
import { defaultStore } from "@/store";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { instance } from "@/instance";
|
import { instance } from "@/instance";
|
||||||
import { useTooltip } from "@/scripts/use-tooltip";
|
import { useTooltip } from "@/scripts/use-tooltip";
|
||||||
import { packed } from "magnetar-common";
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
note: packed.PackNoteBase | Note;
|
note: Note;
|
||||||
count: number;
|
count: number;
|
||||||
reacted: boolean;
|
reacted: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<p v-if="note.cw != null" class="cw">
|
<p v-if="note.cw != null" class="cw">
|
||||||
<MkA
|
<MkA
|
||||||
v-if="
|
v-if="conversation && note.renoteId == parentId"
|
||||||
conversation &&
|
|
||||||
magTransProperty(note, 'renoted_note_id', 'renoteId') ==
|
|
||||||
parentId
|
|
||||||
"
|
|
||||||
:to="
|
:to="
|
||||||
detailedView ? `#${parentId}` : `${notePage(note)}#${parentId}`
|
detailedView ? `#${parentId}` : `${notePage(note)}#${parentId}`
|
||||||
"
|
"
|
||||||
|
@ -16,17 +12,11 @@
|
||||||
<i class="ph-quotes ph-bold ph-lg"></i>
|
<i class="ph-quotes ph-bold ph-lg"></i>
|
||||||
</MkA>
|
</MkA>
|
||||||
<MkA
|
<MkA
|
||||||
v-else-if="
|
v-else-if="!detailed && note.replyId"
|
||||||
!detailed && magTransProperty(note, 'parent_note_id', 'replyId')
|
|
||||||
"
|
|
||||||
:to="
|
:to="
|
||||||
detailedView
|
detailedView
|
||||||
? `#${magTransProperty(note, 'parent_note_id', 'replyId')}`
|
? `#${note.replyId}`
|
||||||
: `${notePage(note)}#${magTransProperty(
|
: `${notePage(note)}#${note.replyId}`
|
||||||
note,
|
|
||||||
'parent_note_id',
|
|
||||||
'replyId'
|
|
||||||
)}`
|
|
||||||
"
|
"
|
||||||
behavior="browser"
|
behavior="browser"
|
||||||
v-tooltip="i18n.ts.jumpToPrevious"
|
v-tooltip="i18n.ts.jumpToPrevious"
|
||||||
|
@ -50,8 +40,7 @@
|
||||||
:class="{
|
:class="{
|
||||||
collapsed,
|
collapsed,
|
||||||
isLong,
|
isLong,
|
||||||
manyImages:
|
manyImages: note.files.length > 4,
|
||||||
magTransProperty(note, 'attachments', 'files')?.length > 4,
|
|
||||||
showContent: note.cw && !showContent,
|
showContent: note.cw && !showContent,
|
||||||
animatedMfm: !disableMfm,
|
animatedMfm: !disableMfm,
|
||||||
}"
|
}"
|
||||||
|
@ -76,17 +65,13 @@
|
||||||
'aria-hidden': note.cw && !showContent ? 'true' : null,
|
'aria-hidden': note.cw && !showContent ? 'true' : null,
|
||||||
tabindex: !showContent ? '-1' : null,
|
tabindex: !showContent ? '-1' : null,
|
||||||
}"
|
}"
|
||||||
|
>
|
||||||
|
<span v-if="note.deletedAt" style="opacity: 0.5"
|
||||||
|
>({{ i18n.ts.deleted }})</span
|
||||||
>
|
>
|
||||||
<template v-if="!note.cw">
|
<template v-if="!note.cw">
|
||||||
<MkA
|
<MkA
|
||||||
v-if="
|
v-if="conversation && note.renoteId == parentId"
|
||||||
conversation &&
|
|
||||||
magTransProperty(
|
|
||||||
note,
|
|
||||||
'renoted_note_id',
|
|
||||||
'renoteId'
|
|
||||||
) == parentId
|
|
||||||
"
|
|
||||||
:to="
|
:to="
|
||||||
detailedView
|
detailedView
|
||||||
? `#${parentId}`
|
? `#${parentId}`
|
||||||
|
@ -99,22 +84,11 @@
|
||||||
<i class="ph-quotes ph-bold ph-lg"></i>
|
<i class="ph-quotes ph-bold ph-lg"></i>
|
||||||
</MkA>
|
</MkA>
|
||||||
<MkA
|
<MkA
|
||||||
v-else-if="
|
v-else-if="!detailed && note.replyId"
|
||||||
!detailed &&
|
|
||||||
magTransProperty(note, 'parent_note_id', 'replyId')
|
|
||||||
"
|
|
||||||
:to="
|
:to="
|
||||||
detailedView
|
detailedView
|
||||||
? `#${magTransProperty(
|
? `#${note.replyId}`
|
||||||
note,
|
: `${notePage(note)}#${note.replyId}`
|
||||||
'parent_note_id',
|
|
||||||
'replyId'
|
|
||||||
)}`
|
|
||||||
: `${notePage(note)}#${magTransProperty(
|
|
||||||
note,
|
|
||||||
'parent_note_id',
|
|
||||||
'replyId'
|
|
||||||
)}`
|
|
||||||
"
|
"
|
||||||
behavior="browser"
|
behavior="browser"
|
||||||
v-tooltip="i18n.ts.jumpToPrevious"
|
v-tooltip="i18n.ts.jumpToPrevious"
|
||||||
|
@ -132,24 +106,14 @@
|
||||||
:custom-emojis="note.emojis"
|
:custom-emojis="note.emojis"
|
||||||
/>
|
/>
|
||||||
<MkA
|
<MkA
|
||||||
v-if="
|
v-if="!detailed && note.renoteId"
|
||||||
!detailed &&
|
|
||||||
magTransProperty(note, 'renoted_note_id', 'renoteId')
|
|
||||||
"
|
|
||||||
class="rp"
|
class="rp"
|
||||||
:to="`/notes/${magTransProperty(
|
:to="`/notes/${note.renoteId}`"
|
||||||
note,
|
|
||||||
'renoted_note_id',
|
|
||||||
'renoteId'
|
|
||||||
)}`"
|
|
||||||
>{{ i18n.ts.quoteAttached }}: ...</MkA
|
>{{ i18n.ts.quoteAttached }}: ...</MkA
|
||||||
>
|
>
|
||||||
<XMediaList
|
<XMediaList
|
||||||
v-if="
|
v-if="note.files.length > 0"
|
||||||
magTransProperty(note, 'attachments', 'files')?.length >
|
:media-list="note.files"
|
||||||
0
|
|
||||||
"
|
|
||||||
:media-list="magTransProperty(note, 'attachments', 'files')!"
|
|
||||||
/>
|
/>
|
||||||
<XPoll v-if="note.poll" :note="note" class="poll" />
|
<XPoll v-if="note.poll" :note="note" class="poll" />
|
||||||
<template v-if="detailed">
|
<template v-if="detailed">
|
||||||
|
@ -162,18 +126,11 @@
|
||||||
class="url-preview"
|
class="url-preview"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
v-if="magTransProperty(note, 'renoted_note', 'renote')"
|
v-if="note.renote"
|
||||||
class="renote"
|
class="renote"
|
||||||
@click.stop="
|
@click.stop="emit('push', note.renote)"
|
||||||
emit(
|
|
||||||
'push',
|
|
||||||
magTransProperty(note, 'renoted_note', 'renote')
|
|
||||||
)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<XNoteSimple
|
<XNoteSimple :note="note.renote" />
|
||||||
:note="magTransProperty(note, 'renoted_note', 'renote')!"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<div
|
<div
|
||||||
|
@ -235,12 +192,9 @@ import { extractUrlFromMfm } from "@/scripts/extract-url-from-mfm";
|
||||||
import { extractMfmWithAnimation } from "@/scripts/extract-mfm";
|
import { extractMfmWithAnimation } from "@/scripts/extract-mfm";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import { $i } from "@/account";
|
|
||||||
import { magTransProperty } from "@/scripts-mag/mag-util";
|
|
||||||
import { packed } from "magnetar-common";
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
note: packed.PackNoteMaybeFull | misskey.entities.Note;
|
note: misskey.entities.Note;
|
||||||
parentId?;
|
parentId?;
|
||||||
conversation?;
|
conversation?;
|
||||||
detailed?: boolean;
|
detailed?: boolean;
|
||||||
|
@ -262,8 +216,7 @@ const isLong =
|
||||||
((props.note.text != null &&
|
((props.note.text != null &&
|
||||||
(props.note.text.split("\n").length > 10 ||
|
(props.note.text.split("\n").length > 10 ||
|
||||||
props.note.text.length > 800)) ||
|
props.note.text.length > 800)) ||
|
||||||
(magTransProperty(props.note, "attachments", "files") ?? []).length >
|
props.note.files.length > 4);
|
||||||
4);
|
|
||||||
const collapsed = $ref(props.note.cw == null && isLong);
|
const collapsed = $ref(props.note.cw == null && isLong);
|
||||||
const urls = props.note.text
|
const urls = props.note.text
|
||||||
? extractUrlFromMfm(mfm.parse(props.note.text)).slice(0, 5)
|
? extractUrlFromMfm(mfm.parse(props.note.text)).slice(0, 5)
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
<template>
|
||||||
|
<div v-tooltip="text" class="fzgwjkgc" :class="user.onlineStatus"></div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import {} from "vue";
|
||||||
|
import * as misskey from "calckey-js";
|
||||||
|
import { i18n } from "@/i18n";
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
user: misskey.entities.User;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const text = $computed(() => {
|
||||||
|
switch (props.user.onlineStatus) {
|
||||||
|
case "online":
|
||||||
|
return i18n.ts.online;
|
||||||
|
case "active":
|
||||||
|
return i18n.ts.active;
|
||||||
|
case "offline":
|
||||||
|
return i18n.ts.offline;
|
||||||
|
case "unknown":
|
||||||
|
return i18n.ts.unknown;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.fzgwjkgc {
|
||||||
|
box-shadow: 0 0 0 3px var(--panel);
|
||||||
|
border-radius: 120%; // Blinkのバグか知らんけど、100%ぴったりにすると何故か若干楕円でレンダリングされる
|
||||||
|
|
||||||
|
&.online {
|
||||||
|
background: #9ccfd8;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
background: #f6c177;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.offline {
|
||||||
|
background: #eb6f92;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.unknown {
|
||||||
|
background: #6e6a86;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -13,10 +13,9 @@
|
||||||
import * as misskey from "calckey-js";
|
import * as misskey from "calckey-js";
|
||||||
import { toUnicode } from "punycode/";
|
import { toUnicode } from "punycode/";
|
||||||
import { host as hostRaw } from "@/config";
|
import { host as hostRaw } from "@/config";
|
||||||
import { packed } from "magnetar-common";
|
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
user: packed.PackUserBase | misskey.entities.User;
|
user: misskey.entities.UserDetailed;
|
||||||
detail?: boolean;
|
detail?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
|
|
@ -3,36 +3,23 @@
|
||||||
v-if="disableLink"
|
v-if="disableLink"
|
||||||
v-user-preview="disablePreview ? undefined : user.id"
|
v-user-preview="disablePreview ? undefined : user.id"
|
||||||
class="eiwwqkts _noSelect"
|
class="eiwwqkts _noSelect"
|
||||||
:class="{
|
:class="{ cat: user.isCat, square: $store.state.squareAvatars }"
|
||||||
cat:
|
|
||||||
magTransMap(
|
|
||||||
props.user,
|
|
||||||
'avatar_decoration',
|
|
||||||
'isCat',
|
|
||||||
(a) => a === 'CatEars'
|
|
||||||
) || false,
|
|
||||||
square: $store.state.squareAvatars,
|
|
||||||
}"
|
|
||||||
:style="{ color }"
|
:style="{ color }"
|
||||||
:title="acct(user)"
|
:title="acct(user)"
|
||||||
@click="onClick"
|
@click="onClick"
|
||||||
>
|
>
|
||||||
<img class="inner" :src="url" decoding="async" />
|
<img class="inner" :src="url" decoding="async" />
|
||||||
|
<MkUserOnlineIndicator
|
||||||
|
v-if="showIndicator && user.instance == null"
|
||||||
|
class="indicator"
|
||||||
|
:user="user"
|
||||||
|
/>
|
||||||
</span>
|
</span>
|
||||||
<MkA
|
<MkA
|
||||||
v-else
|
v-else
|
||||||
v-user-preview="disablePreview ? undefined : user.id"
|
v-user-preview="disablePreview ? undefined : user.id"
|
||||||
class="eiwwqkts _noSelect"
|
class="eiwwqkts _noSelect"
|
||||||
:class="{
|
:class="{ cat: user.isCat, square: $store.state.squareAvatars }"
|
||||||
cat:
|
|
||||||
magTransMap(
|
|
||||||
props.user,
|
|
||||||
'avatar_decoration',
|
|
||||||
'isCat',
|
|
||||||
(d) => d === 'CatEars'
|
|
||||||
) || false,
|
|
||||||
square: $store.state.squareAvatars,
|
|
||||||
}"
|
|
||||||
:style="{ color }"
|
:style="{ color }"
|
||||||
:to="userPage(user)"
|
:to="userPage(user)"
|
||||||
:title="acct(user)"
|
:title="acct(user)"
|
||||||
|
@ -40,30 +27,36 @@
|
||||||
@click.stop
|
@click.stop
|
||||||
>
|
>
|
||||||
<img class="inner" :src="url" decoding="async" />
|
<img class="inner" :src="url" decoding="async" />
|
||||||
|
<MkUserOnlineIndicator
|
||||||
|
v-if="showIndicator && user.instance == null"
|
||||||
|
class="indicator"
|
||||||
|
:user="user"
|
||||||
|
/>
|
||||||
</MkA>
|
</MkA>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { watch } from "vue";
|
import { onMounted, watch } from "vue";
|
||||||
import * as misskey from "calckey-js";
|
import * as misskey from "calckey-js";
|
||||||
import { getStaticImageUrl } from "@/scripts/get-static-image-url";
|
import { getStaticImageUrl } from "@/scripts/get-static-image-url";
|
||||||
import { extractAvgColorFromBlurhash } from "@/scripts/extract-avg-color-from-blurhash";
|
import { extractAvgColorFromBlurhash } from "@/scripts/extract-avg-color-from-blurhash";
|
||||||
import { acct, userPage } from "@/filters/user";
|
import { acct, userPage } from "@/filters/user";
|
||||||
|
import MkUserOnlineIndicator from "@/components/MkUserOnlineIndicator.vue";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import { packed } from "magnetar-common";
|
|
||||||
import { magTransMap, magTransProperty } from "@/scripts-mag/mag-util";
|
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
user: packed.PackUserBase | misskey.entities.User;
|
user: misskey.entities.User;
|
||||||
target?: string | null;
|
target?: string | null;
|
||||||
disableLink?: boolean;
|
disableLink?: boolean;
|
||||||
disablePreview?: boolean;
|
disablePreview?: boolean;
|
||||||
|
showIndicator?: boolean;
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
target: null,
|
target: null,
|
||||||
disableLink: false,
|
disableLink: false,
|
||||||
disablePreview: false,
|
disablePreview: false,
|
||||||
|
showIndicator: false,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -73,10 +66,8 @@ const emit = defineEmits<{
|
||||||
|
|
||||||
const url = $computed(() =>
|
const url = $computed(() =>
|
||||||
defaultStore.state.disableShowingAnimatedImages
|
defaultStore.state.disableShowingAnimatedImages
|
||||||
? getStaticImageUrl(
|
? getStaticImageUrl(props.user.avatarUrl)
|
||||||
magTransProperty(props.user, "avatar_url", "avatarUrl")
|
: props.user.avatarUrl
|
||||||
)
|
|
||||||
: magTransProperty(props.user, "avatar_url", "avatarUrl")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
function onClick(ev: MouseEvent) {
|
function onClick(ev: MouseEvent) {
|
||||||
|
@ -86,11 +77,9 @@ function onClick(ev: MouseEvent) {
|
||||||
let color = $ref();
|
let color = $ref();
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => magTransProperty(props.user, "avatar_blurhash", "avatarBlurhash"),
|
() => props.user.avatarBlurhash,
|
||||||
() => {
|
() => {
|
||||||
color = extractAvgColorFromBlurhash(
|
color = extractAvgColorFromBlurhash(props.user.avatarBlurhash);
|
||||||
magTransProperty(props.user, "avatar_blurhash", "avatarBlurhash")
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
immediate: true,
|
immediate: true,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<Mfm
|
<Mfm
|
||||||
:class="$style.root"
|
:class="$style.root"
|
||||||
:text="magTransUsername(user)"
|
:text="user.name || user.username"
|
||||||
:plain="true"
|
:plain="true"
|
||||||
:nowrap="nowrap"
|
:nowrap="nowrap"
|
||||||
:custom-emojis="user.emojis"
|
:custom-emojis="user.emojis"
|
||||||
|
@ -9,13 +9,12 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import {} from "vue";
|
||||||
import * as misskey from "calckey-js";
|
import * as misskey from "calckey-js";
|
||||||
import { packed } from "magnetar-common";
|
|
||||||
import { magTransUsername } from "@/scripts-mag/mag-util";
|
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
user: packed.PackUserBase | misskey.entities.User;
|
user: misskey.entities.User;
|
||||||
nowrap?: boolean;
|
nowrap?: boolean;
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,11 +15,10 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, onMounted, PropType, Ref, ref } from "vue";
|
import { defineComponent, onMounted, PropType, Ref, ref } from "vue";
|
||||||
import XNote from "@/components/MagNote.vue";
|
import XNote from "@/components/MkNote.vue";
|
||||||
import XNoteDetailed from "@/components/MagNoteDetailed.vue";
|
import XNoteDetailed from "@/components/MkNoteDetailed.vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { NoteBlock } from "@/scripts/hpml/block";
|
import { NoteBlock } from "@/scripts/hpml/block";
|
||||||
import { endpoints, packed } from "magnetar-common";
|
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
|
@ -33,18 +32,14 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
setup(props, ctx) {
|
setup(props, ctx) {
|
||||||
const note: Ref<packed.PackNoteMaybeFull | null> = ref(null);
|
const note: Ref<Record<string, any> | null> = ref(null);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (!props.block.note) return;
|
os.api("notes/show", { noteId: props.block.note }).then(
|
||||||
|
(result) => {
|
||||||
os.magApi(
|
|
||||||
endpoints.GetNoteById,
|
|
||||||
{ context: props.block.detailed, attachments: true },
|
|
||||||
{ id: props.block.note }
|
|
||||||
).then((result) => {
|
|
||||||
note.value = result;
|
note.value = result;
|
||||||
});
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -15,6 +15,6 @@ export const lang = localStorage.getItem("lang");
|
||||||
export const langs = _LANGS_;
|
export const langs = _LANGS_;
|
||||||
export const locale = JSON.parse(localStorage.getItem("locale"));
|
export const locale = JSON.parse(localStorage.getItem("locale"));
|
||||||
export const version = _VERSION_;
|
export const version = _VERSION_;
|
||||||
export const instanceName = siteName === "Magnetar" ? "" + host : siteName;
|
export const instanceName = siteName === "Magnetar" ? host : siteName;
|
||||||
export const ui = localStorage.getItem("ui");
|
export const ui = localStorage.getItem("ui");
|
||||||
export const debug = localStorage.getItem("debug") === "true";
|
export const debug = localStorage.getItem("debug") === "true";
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
import * as Misskey from "calckey-js";
|
export const notePage = (note) => {
|
||||||
import { packed } from "magnetar-common";
|
|
||||||
|
|
||||||
export const notePage = (note: {
|
|
||||||
id: packed.PackNoteBase["id"] | Misskey.entities.Note["id"];
|
|
||||||
}) => {
|
|
||||||
return `/notes/${note.id}`;
|
return `/notes/${note.id}`;
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,28 +11,36 @@ import "@phosphor-icons/web/fill";
|
||||||
|
|
||||||
//#region account indexedDB migration
|
//#region account indexedDB migration
|
||||||
import { set } from "@/scripts/idb-proxy";
|
import { set } from "@/scripts/idb-proxy";
|
||||||
|
|
||||||
|
const accounts = localStorage.getItem("accounts");
|
||||||
|
if (accounts) {
|
||||||
|
set("accounts", JSON.parse(accounts));
|
||||||
|
localStorage.removeItem("accounts");
|
||||||
|
}
|
||||||
|
//#endregion
|
||||||
|
|
||||||
import {
|
import {
|
||||||
computed,
|
computed,
|
||||||
createApp,
|
createApp,
|
||||||
defineAsyncComponent,
|
watch,
|
||||||
markRaw,
|
markRaw,
|
||||||
version as vueVersion,
|
version as vueVersion,
|
||||||
watch,
|
defineAsyncComponent,
|
||||||
} from "vue";
|
} from "vue";
|
||||||
import { compareVersions } from "compare-versions";
|
import { compareVersions } from "compare-versions";
|
||||||
|
|
||||||
import widgets from "@/widgets";
|
import widgets from "@/widgets";
|
||||||
import directives from "@/directives";
|
import directives from "@/directives";
|
||||||
import components from "@/components";
|
import components from "@/components";
|
||||||
import { lang, ui, version } from "@/config";
|
import { version, ui, lang, host } from "@/config";
|
||||||
import { applyTheme } from "@/scripts/theme";
|
import { applyTheme } from "@/scripts/theme";
|
||||||
import { isDeviceDarkmode } from "@/scripts/is-device-darkmode";
|
import { isDeviceDarkmode } from "@/scripts/is-device-darkmode";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { alert, confirm, popup, post, toast } from "@/os";
|
import { confirm, alert, post, popup, toast } from "@/os";
|
||||||
import { stream } from "@/stream";
|
import { stream } from "@/stream";
|
||||||
import * as sound from "@/scripts/sound";
|
import * as sound from "@/scripts/sound";
|
||||||
import { $i, login, refreshAccount, signout, updateAccount } from "@/account";
|
import { $i, refreshAccount, login, updateAccount, signout } from "@/account";
|
||||||
import { ColdDeviceStorage, defaultStore } from "@/store";
|
import { defaultStore, ColdDeviceStorage } from "@/store";
|
||||||
import { fetchInstance, instance } from "@/instance";
|
import { fetchInstance, instance } from "@/instance";
|
||||||
import { makeHotkey } from "@/scripts/hotkey";
|
import { makeHotkey } from "@/scripts/hotkey";
|
||||||
import { search } from "@/scripts/search";
|
import { search } from "@/scripts/search";
|
||||||
|
@ -43,13 +51,6 @@ import { reactionPicker } from "@/scripts/reaction-picker";
|
||||||
import { getUrlWithoutLoginId } from "@/scripts/login-id";
|
import { getUrlWithoutLoginId } from "@/scripts/login-id";
|
||||||
import { getAccountFromId } from "@/scripts/get-account-from-id";
|
import { getAccountFromId } from "@/scripts/get-account-from-id";
|
||||||
|
|
||||||
const accounts = localStorage.getItem("accounts");
|
|
||||||
if (accounts) {
|
|
||||||
set("accounts", JSON.parse(accounts));
|
|
||||||
localStorage.removeItem("accounts");
|
|
||||||
}
|
|
||||||
//#endregion
|
|
||||||
|
|
||||||
function checkForSplash() {
|
function checkForSplash() {
|
||||||
const splash = document.getElementById("splash");
|
const splash = document.getElementById("splash");
|
||||||
// 念のためnullチェック(HTMLが古い場合があるため(そのうち消す))
|
// 念のためnullチェック(HTMLが古い場合があるため(そのうち消す))
|
||||||
|
@ -63,7 +64,7 @@ function checkForSplash() {
|
||||||
}
|
}
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
console.info(`Magnetar v${version}`);
|
console.info(`Calckey v${version}`);
|
||||||
|
|
||||||
if (_DEV_) {
|
if (_DEV_) {
|
||||||
console.warn("Development mode!!!");
|
console.warn("Development mode!!!");
|
||||||
|
|
|
@ -13,12 +13,9 @@ import { MenuItem } from "@/types/menu";
|
||||||
import { $i } from "@/account";
|
import { $i } from "@/account";
|
||||||
import { i18n } from "./i18n";
|
import { i18n } from "./i18n";
|
||||||
import {
|
import {
|
||||||
BackendApiEndpoint,
|
|
||||||
FrontendApiEndpoint,
|
FrontendApiEndpoint,
|
||||||
FrontendApiEndpoints,
|
FrontendApiEndpoints,
|
||||||
MagApiClient,
|
} from "magnetar-common/built/fe-api";
|
||||||
Method,
|
|
||||||
} from "magnetar-common";
|
|
||||||
|
|
||||||
export const pendingApiRequestsCount = ref(0);
|
export const pendingApiRequestsCount = ref(0);
|
||||||
|
|
||||||
|
@ -26,39 +23,6 @@ const apiClient = new Misskey.api.APIClient({
|
||||||
origin: url,
|
origin: url,
|
||||||
});
|
});
|
||||||
|
|
||||||
const magnetarApiClient = new MagApiClient(`${url}/mag/v1`);
|
|
||||||
|
|
||||||
export async function magApi<
|
|
||||||
T extends BackendApiEndpoint<
|
|
||||||
T["method"] & Method,
|
|
||||||
T["pathParams"] & string[],
|
|
||||||
T["request"],
|
|
||||||
T["response"]
|
|
||||||
>
|
|
||||||
>(
|
|
||||||
endpoint: T,
|
|
||||||
data: T["request"],
|
|
||||||
pathParams: {
|
|
||||||
[K in keyof T["pathParams"] as T["pathParams"][K] & string]:
|
|
||||||
| string
|
|
||||||
| number;
|
|
||||||
},
|
|
||||||
token?: string | null | undefined
|
|
||||||
): Promise<T["response"]> {
|
|
||||||
pendingApiRequestsCount.value++;
|
|
||||||
|
|
||||||
try {
|
|
||||||
return await magnetarApiClient.call(
|
|
||||||
endpoint,
|
|
||||||
data,
|
|
||||||
pathParams,
|
|
||||||
token || $i?.token
|
|
||||||
);
|
|
||||||
} finally {
|
|
||||||
pendingApiRequestsCount.value--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function feApi<T extends keyof FrontendApiEndpoints & string>(
|
export async function feApi<T extends keyof FrontendApiEndpoints & string>(
|
||||||
endpointDef: FrontendApiEndpoint<
|
endpointDef: FrontendApiEndpoint<
|
||||||
FrontendApiEndpoints[T]["method"],
|
FrontendApiEndpoints[T]["method"],
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<div class="note _gap">
|
<div class="note _gap">
|
||||||
<MkRemoteCaution
|
<MkRemoteCaution
|
||||||
v-if="appearNote.user.host != null"
|
v-if="appearNote.user.host != null"
|
||||||
:href="(appearNote.url ?? appearNote.uri) !"
|
:href="appearNote.url ?? appearNote.uri"
|
||||||
/>
|
/>
|
||||||
<XNoteDetailed
|
<XNoteDetailed
|
||||||
:key="appearNote.id"
|
:key="appearNote.id"
|
||||||
|
@ -70,28 +70,27 @@
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, watch } from "vue";
|
import { computed, watch } from "vue";
|
||||||
import XNoteDetailed from "@/components/MagNoteDetailed.vue";
|
import * as misskey from "calckey-js";
|
||||||
|
import XNoteDetailed from "@/components/MkNoteDetailed.vue";
|
||||||
import XNotes from "@/components/MkNotes.vue";
|
import XNotes from "@/components/MkNotes.vue";
|
||||||
import MkRemoteCaution from "@/components/MkRemoteCaution.vue";
|
import MkRemoteCaution from "@/components/MkRemoteCaution.vue";
|
||||||
import MkButton from "@/components/MkButton.vue";
|
import MkButton from "@/components/MkButton.vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { endpoints, packed } from "magnetar-common";
|
|
||||||
import { magTransUsername } from "@/scripts-mag/mag-util";
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
noteId: string;
|
noteId: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
let note = $ref<null | packed.PackNoteMaybeFull>();
|
let note = $ref<null | misskey.entities.Note>();
|
||||||
let hasPrev = $ref(false);
|
let hasPrev = $ref(false);
|
||||||
let hasNext = $ref(false);
|
let hasNext = $ref(false);
|
||||||
let showPrev = $ref(false);
|
let showPrev = $ref(false);
|
||||||
let showNext = $ref(false);
|
let showNext = $ref(false);
|
||||||
let error = $ref();
|
let error = $ref();
|
||||||
let isRenote = $ref(false);
|
let isRenote = $ref(false);
|
||||||
let appearNote = $ref<null | packed.PackNoteMaybeFull>();
|
let appearNote = $ref<null | misskey.entities.Note>();
|
||||||
|
|
||||||
const prevPagination = {
|
const prevPagination = {
|
||||||
endpoint: "users/notes" as const,
|
endpoint: "users/notes" as const,
|
||||||
|
@ -99,7 +98,7 @@ const prevPagination = {
|
||||||
params: computed(() =>
|
params: computed(() =>
|
||||||
appearNote
|
appearNote
|
||||||
? {
|
? {
|
||||||
userId: appearNote.user.id,
|
userId: appearNote.userId,
|
||||||
untilId: appearNote.id,
|
untilId: appearNote.id,
|
||||||
}
|
}
|
||||||
: null
|
: null
|
||||||
|
@ -113,7 +112,7 @@ const nextPagination = {
|
||||||
params: computed(() =>
|
params: computed(() =>
|
||||||
appearNote
|
appearNote
|
||||||
? {
|
? {
|
||||||
userId: appearNote.user.id,
|
userId: appearNote.userId,
|
||||||
sinceId: appearNote.id,
|
sinceId: appearNote.id,
|
||||||
}
|
}
|
||||||
: null
|
: null
|
||||||
|
@ -126,30 +125,28 @@ function fetchNote() {
|
||||||
showPrev = false;
|
showPrev = false;
|
||||||
showNext = false;
|
showNext = false;
|
||||||
note = null;
|
note = null;
|
||||||
os.magApi(
|
os.api("notes/show", {
|
||||||
endpoints.GetNoteById,
|
noteId: props.noteId,
|
||||||
{ context: true, attachments: true },
|
})
|
||||||
{ id: props.noteId }
|
|
||||||
)
|
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
note = res;
|
note = res;
|
||||||
isRenote =
|
isRenote =
|
||||||
note.renoted_note_id != null &&
|
note.renote != null &&
|
||||||
note.text == null &&
|
note.text == null &&
|
||||||
note.file_ids.length === 0 &&
|
note.fileIds.length === 0 &&
|
||||||
note.poll == null;
|
note.poll == null;
|
||||||
appearNote = isRenote
|
appearNote = isRenote
|
||||||
? (note.renoted_note as packed.PackNoteMaybeFull)
|
? (note.renote as misskey.entities.Note)
|
||||||
: note;
|
: note;
|
||||||
|
|
||||||
Promise.all([
|
Promise.all([
|
||||||
os.api("users/notes", {
|
os.api("users/notes", {
|
||||||
userId: note.user.id,
|
userId: note.userId,
|
||||||
untilId: note.id,
|
untilId: note.id,
|
||||||
limit: 1,
|
limit: 1,
|
||||||
}),
|
}),
|
||||||
os.api("users/notes", {
|
os.api("users/notes", {
|
||||||
userId: note.user.id,
|
userId: note.userId,
|
||||||
sinceId: note.id,
|
sinceId: note.id,
|
||||||
limit: 1,
|
limit: 1,
|
||||||
}),
|
}),
|
||||||
|
@ -176,14 +173,15 @@ definePageMetadata(
|
||||||
appearNote
|
appearNote
|
||||||
? {
|
? {
|
||||||
title: i18n.t("noteOf", {
|
title: i18n.t("noteOf", {
|
||||||
user: magTransUsername(appearNote.user),
|
user: appearNote.user.name || appearNote.user.username,
|
||||||
}),
|
}),
|
||||||
subtitle: new Date(appearNote.created_at).toLocaleString(),
|
subtitle: new Date(appearNote.createdAt).toLocaleString(),
|
||||||
avatar: appearNote.user,
|
avatar: appearNote.user,
|
||||||
path: `/notes/${appearNote.id}`,
|
path: `/notes/${appearNote.id}`,
|
||||||
share: {
|
share: {
|
||||||
title: i18n.t("noteOf", {
|
title: i18n.t("noteOf", {
|
||||||
user: magTransUsername(appearNote.user),
|
user:
|
||||||
|
appearNote.user.name || appearNote.user.username,
|
||||||
}),
|
}),
|
||||||
text: appearNote.text,
|
text: appearNote.text,
|
||||||
},
|
},
|
||||||
|
|
|
@ -35,15 +35,14 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, watch } from "vue";
|
import { watch } from "vue";
|
||||||
import XContainer from "../page-editor.container.vue";
|
import XContainer from "../page-editor.container.vue";
|
||||||
import MkInput from "@/components/form/input.vue";
|
import MkInput from "@/components/form/input.vue";
|
||||||
import MkSwitch from "@/components/form/switch.vue";
|
import MkSwitch from "@/components/form/switch.vue";
|
||||||
import XNote from "@/components/MkNote.vue";
|
import XNote from "@/components/MkNote.vue";
|
||||||
import XNoteDetailed from "@/components/MagNoteDetailed.vue";
|
import XNoteDetailed from "@/components/MkNoteDetailed.vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { endpoints, packed } from "magnetar-common";
|
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
|
@ -57,32 +56,21 @@ const props = withDefaults(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
let id = ref<string | null>(props.value.note);
|
let id: any = $ref(props.value.note);
|
||||||
let note = ref<packed.PackNoteMaybeFull | null>(null);
|
let note: any = $ref(null);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
id,
|
id,
|
||||||
async () => {
|
async () => {
|
||||||
if (
|
if (id && (id.startsWith("http://") || id.startsWith("https://"))) {
|
||||||
id.value &&
|
props.value.note = (id.endsWith("/") ? id.slice(0, -1) : id)
|
||||||
(id.value.startsWith("http://") || id.value.startsWith("https://"))
|
|
||||||
) {
|
|
||||||
props.value.note = (
|
|
||||||
id.value.endsWith("/") ? id.value.slice(0, -1) : id.value
|
|
||||||
)
|
|
||||||
.split("/")
|
.split("/")
|
||||||
.pop();
|
.pop();
|
||||||
} else {
|
} else {
|
||||||
props.value.note = id.value;
|
props.value.note = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (props.value.note) return;
|
note = await os.api("notes/show", { noteId: props.value.note });
|
||||||
|
|
||||||
note.value = await os.magApi(
|
|
||||||
endpoints.GetNoteById,
|
|
||||||
{ context: true, attachments: true },
|
|
||||||
{ id: props.value.note }
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
immediate: true,
|
immediate: true,
|
||||||
|
|
|
@ -125,6 +125,7 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { defineAsyncComponent, watch } from "vue";
|
import { defineAsyncComponent, watch } from "vue";
|
||||||
import XDraggable from "vuedraggable";
|
import XDraggable from "vuedraggable";
|
||||||
|
import FormInput from "@/components/form/input.vue";
|
||||||
import FormRadios from "@/components/form/radios.vue";
|
import FormRadios from "@/components/form/radios.vue";
|
||||||
import FromSlot from "@/components/form/slot.vue";
|
import FromSlot from "@/components/form/slot.vue";
|
||||||
import FormButton from "@/components/MkButton.vue";
|
import FormButton from "@/components/MkButton.vue";
|
||||||
|
@ -134,6 +135,7 @@ import * as os from "@/os";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { definePageMetadata } from "@/scripts/page-metadata";
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
||||||
|
import { deepClone } from "@/scripts/clone";
|
||||||
import { unisonReload } from "@/scripts/unison-reload";
|
import { unisonReload } from "@/scripts/unison-reload";
|
||||||
|
|
||||||
async function reloadAsk() {
|
async function reloadAsk() {
|
||||||
|
@ -146,7 +148,7 @@ async function reloadAsk() {
|
||||||
unisonReload();
|
unisonReload();
|
||||||
}
|
}
|
||||||
|
|
||||||
let reactions = $ref(structuredClone(defaultStore.state.reactions));
|
let reactions = $ref(deepClone(defaultStore.state.reactions));
|
||||||
|
|
||||||
const reactionPickerSkinTone = $computed(
|
const reactionPickerSkinTone = $computed(
|
||||||
defaultStore.makeGetterSetter("reactionPickerSkinTone")
|
defaultStore.makeGetterSetter("reactionPickerSkinTone")
|
||||||
|
@ -209,7 +211,7 @@ async function setDefault() {
|
||||||
});
|
});
|
||||||
if (canceled) return;
|
if (canceled) return;
|
||||||
|
|
||||||
reactions = structuredClone(defaultStore.def.reactions.default);
|
reactions = deepClone(defaultStore.def.reactions.default);
|
||||||
}
|
}
|
||||||
|
|
||||||
function chooseEmoji(ev: MouseEvent) {
|
function chooseEmoji(ev: MouseEvent) {
|
||||||
|
|
|
@ -142,15 +142,17 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { reactive, watch } from "vue";
|
import { computed, reactive, ref, watch } from "vue";
|
||||||
import FormSelect from "@/components/form/select.vue";
|
import FormSelect from "@/components/form/select.vue";
|
||||||
import MkInput from "@/components/form/input.vue";
|
import MkInput from "@/components/form/input.vue";
|
||||||
import MkSwitch from "@/components/form/switch.vue";
|
import MkSwitch from "@/components/form/switch.vue";
|
||||||
import FormRadios from "@/components/form/radios.vue";
|
import FormRadios from "@/components/form/radios.vue";
|
||||||
import FormButton from "@/components/MkButton.vue";
|
import FormButton from "@/components/MkButton.vue";
|
||||||
import FormRange from "@/components/form/range.vue";
|
import FormRange from "@/components/form/range.vue";
|
||||||
|
import * as os from "@/os";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
|
import { deepClone } from "@/scripts/clone";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
_id: string;
|
_id: string;
|
||||||
|
@ -158,9 +160,7 @@ const props = defineProps<{
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const statusbar = reactive(
|
const statusbar = reactive(
|
||||||
structuredClone(
|
deepClone(defaultStore.state.statusbars.find((x) => x.id === props._id))
|
||||||
defaultStore.state.statusbars.find((x) => x.id === props._id)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
@ -197,8 +197,8 @@ async function save() {
|
||||||
const i = defaultStore.state.statusbars.findIndex(
|
const i = defaultStore.state.statusbars.findIndex(
|
||||||
(x) => x.id === props._id
|
(x) => x.id === props._id
|
||||||
);
|
);
|
||||||
const statusbars = structuredClone(defaultStore.state.statusbars);
|
const statusbars = deepClone(defaultStore.state.statusbars);
|
||||||
statusbars[i] = structuredClone(statusbar);
|
statusbars[i] = deepClone(statusbar);
|
||||||
defaultStore.set("statusbars", statusbars);
|
defaultStore.set("statusbars", statusbars);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ function registerPostFormAction({ pluginId, title, handler }) {
|
||||||
postFormActions.push({
|
postFormActions.push({
|
||||||
title,
|
title,
|
||||||
handler: (form, update) => {
|
handler: (form, update) => {
|
||||||
pluginContexts.get(pluginId)?.execFn(handler, [
|
pluginContexts.get(pluginId).execFn(handler, [
|
||||||
utils.jsToVal(form),
|
utils.jsToVal(form),
|
||||||
values.FN_NATIVE(([key, value]) => {
|
values.FN_NATIVE(([key, value]) => {
|
||||||
update(key.value, value.value);
|
update(key.value, value.value);
|
||||||
|
@ -149,9 +149,7 @@ function registerUserAction({ pluginId, title, handler }) {
|
||||||
userActions.push({
|
userActions.push({
|
||||||
title,
|
title,
|
||||||
handler: (user) => {
|
handler: (user) => {
|
||||||
pluginContexts
|
pluginContexts.get(pluginId).execFn(handler, [utils.jsToVal(user)]);
|
||||||
.get(pluginId)
|
|
||||||
?.execFn(handler, [utils.jsToVal(user)]);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -160,9 +158,7 @@ function registerNoteAction({ pluginId, title, handler }) {
|
||||||
noteActions.push({
|
noteActions.push({
|
||||||
title,
|
title,
|
||||||
handler: (note) => {
|
handler: (note) => {
|
||||||
pluginContexts
|
pluginContexts.get(pluginId).execFn(handler, [utils.jsToVal(note)]);
|
||||||
.get(pluginId)
|
|
||||||
?.execFn(handler, [utils.jsToVal(note)]);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,240 +0,0 @@
|
||||||
import * as Misskey from "calckey-js";
|
|
||||||
import { packed, types } from "magnetar-common";
|
|
||||||
|
|
||||||
// https://stackoverflow.com/a/50375286 Evil magic
|
|
||||||
type Dist<U> = U extends any ? (k: U) => void : never;
|
|
||||||
|
|
||||||
type UnionToIntersection<U> = Dist<U> extends (k: infer I) => void ? I : never;
|
|
||||||
// End of evil magic
|
|
||||||
|
|
||||||
type UnionMerged<A> = { [AK in keyof A]: AK extends keyof A ? A[AK] : never };
|
|
||||||
type UnionIntersectionMerge<A> = Omit<
|
|
||||||
UnionToIntersection<A>,
|
|
||||||
keyof UnionMerged<A>
|
|
||||||
> &
|
|
||||||
UnionMerged<A>;
|
|
||||||
|
|
||||||
export function magTransProperty<
|
|
||||||
A extends Record<string, any>,
|
|
||||||
AA extends keyof UnionToIntersection<A> & string,
|
|
||||||
BB extends keyof UnionToIntersection<A> & string
|
|
||||||
>(
|
|
||||||
x: A,
|
|
||||||
keyA: AA,
|
|
||||||
keyB: BB
|
|
||||||
): UnionIntersectionMerge<A>[AA] | UnionIntersectionMerge<A>[BB] {
|
|
||||||
const a = x[keyA];
|
|
||||||
|
|
||||||
if (typeof a !== "undefined") {
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
|
|
||||||
return x[keyB];
|
|
||||||
}
|
|
||||||
|
|
||||||
export function magTransMap<
|
|
||||||
A extends Record<string, any>,
|
|
||||||
AA extends keyof UnionIntersectionMerge<A> & string,
|
|
||||||
BB extends keyof UnionIntersectionMerge<A> & string,
|
|
||||||
X extends any
|
|
||||||
>(
|
|
||||||
x: A,
|
|
||||||
keyA: AA,
|
|
||||||
keyB: BB,
|
|
||||||
mapLeft: (a: UnionIntersectionMerge<A>[AA]) => X = (a) => a as X,
|
|
||||||
mapRight: (b: UnionIntersectionMerge<A>[BB]) => X = (a) => a as X
|
|
||||||
): X {
|
|
||||||
const a = x[keyA];
|
|
||||||
|
|
||||||
if (typeof a !== "undefined") {
|
|
||||||
return mapLeft(a as UnionIntersectionMerge<A>[AA]);
|
|
||||||
}
|
|
||||||
|
|
||||||
const b = x[keyB];
|
|
||||||
return typeof b === "undefined"
|
|
||||||
? b
|
|
||||||
: mapRight(b as UnionIntersectionMerge<A>[BB]);
|
|
||||||
}
|
|
||||||
|
|
||||||
type UserUnion = packed.PackUserBase | Misskey.entities.User;
|
|
||||||
|
|
||||||
export function magTransUsername(x: UserUnion): string {
|
|
||||||
return (
|
|
||||||
(x as UnionToIntersection<UserUnion>)["display_name"] ||
|
|
||||||
(x as UnionToIntersection<UserUnion>)["name"] ||
|
|
||||||
(x as UnionToIntersection<UserUnion>)["username"]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function magReactionCount(
|
|
||||||
note: packed.PackNoteMaybeFull | Misskey.entities.Note
|
|
||||||
): number {
|
|
||||||
if (Array.isArray(note.reactions)) {
|
|
||||||
return Number(
|
|
||||||
note.reactions
|
|
||||||
.map(([, cnt]) => cnt)
|
|
||||||
.reduce((partialSum, val) => partialSum + val, 0)
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return Object.values(note).reduce((accum, val) => accum + val, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function magHasReacted(
|
|
||||||
note: packed.PackNoteMaybeFull | Misskey.entities.Note
|
|
||||||
): boolean {
|
|
||||||
if (Array.isArray(note.reactions)) {
|
|
||||||
return note.reactions.some(([, , reacted]) => reacted === true);
|
|
||||||
} else {
|
|
||||||
return (
|
|
||||||
typeof (note as Misskey.entities.Note).myReaction !== "undefined" &&
|
|
||||||
(note as Misskey.entities.Note).myReaction !== null
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function magReactionSelf(
|
|
||||||
note: packed.PackNoteMaybeFull | Misskey.entities.Note
|
|
||||||
): string | null {
|
|
||||||
if (Array.isArray(note.reactions)) {
|
|
||||||
const found = note.reactions.find(
|
|
||||||
([, , reacted]) => reacted === true
|
|
||||||
)?.[0];
|
|
||||||
return typeof found !== "undefined" ? magReactionToLegacy(found) : null;
|
|
||||||
} else if ((note as Misskey.entities.Note).myReaction !== "undefined") {
|
|
||||||
return (note as Misskey.entities.Note).myReaction ?? null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function noteIsMag(
|
|
||||||
note: packed.PackNoteMaybeFull | Misskey.entities.Note
|
|
||||||
): note is packed.PackNoteMaybeFull {
|
|
||||||
return "created_at" in note;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function magIsRenote(
|
|
||||||
note: packed.PackNoteMaybeFull | Misskey.entities.Note
|
|
||||||
): boolean {
|
|
||||||
return (
|
|
||||||
magTransProperty(note, "renoted_note", "renote") != null &&
|
|
||||||
note.text == null &&
|
|
||||||
magTransProperty(note, "file_ids", "fileIds").length === 0 &&
|
|
||||||
note.poll == null
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function magEffectiveNote(
|
|
||||||
note: packed.PackNoteMaybeFull | Misskey.entities.Note
|
|
||||||
): packed.PackNoteMaybeFull | Misskey.entities.Note {
|
|
||||||
return magIsRenote(note)
|
|
||||||
? (magTransProperty(note, "renoted_note", "renote") as
|
|
||||||
| packed.PackNoteMaybeFull
|
|
||||||
| Misskey.entities.Note)
|
|
||||||
: note;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function magLegacyVisibility(
|
|
||||||
vis: types.NoteVisibility | Misskey.entities.Note["visibility"]
|
|
||||||
): Misskey.entities.Note["visibility"];
|
|
||||||
|
|
||||||
export function magLegacyVisibility(vis: undefined): undefined;
|
|
||||||
|
|
||||||
export function magLegacyVisibility(
|
|
||||||
vis: types.NoteVisibility | Misskey.entities.Note["visibility"] | undefined
|
|
||||||
): Misskey.entities.Note["visibility"] | undefined {
|
|
||||||
if (typeof vis === "undefined") return vis;
|
|
||||||
|
|
||||||
switch (vis) {
|
|
||||||
case "Public":
|
|
||||||
return "public";
|
|
||||||
case "Home":
|
|
||||||
return "home";
|
|
||||||
case "Followers":
|
|
||||||
return "followers";
|
|
||||||
case "Direct":
|
|
||||||
return "specified";
|
|
||||||
|
|
||||||
case "public":
|
|
||||||
case "home":
|
|
||||||
case "followers":
|
|
||||||
case "specified":
|
|
||||||
return vis;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function magConvertReaction(
|
|
||||||
reaction: string,
|
|
||||||
urlHint?: string | null
|
|
||||||
): types.Reaction {
|
|
||||||
if (reaction.endsWith("@.:")) {
|
|
||||||
reaction = reaction.replaceAll(/@\.:$/, ":");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reaction.match(/^:.+:$/)) {
|
|
||||||
const [name, host] = reaction.split("@");
|
|
||||||
return {
|
|
||||||
name,
|
|
||||||
host: host || null,
|
|
||||||
url: urlHint!,
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return reaction;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function magReactionToLegacy(reaction: types.Reaction | string): string {
|
|
||||||
if (typeof reaction === "string") {
|
|
||||||
return reaction;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("name" in reaction) {
|
|
||||||
if (reaction.host) {
|
|
||||||
return `:${reaction.name}@${reaction.host}:`;
|
|
||||||
} else {
|
|
||||||
return `:${reaction.name}@.:`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("raw" in reaction) {
|
|
||||||
return reaction.raw;
|
|
||||||
}
|
|
||||||
|
|
||||||
return reaction;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function magReactionPairToLegacy(
|
|
||||||
reaction: types.ReactionPair | [string, number]
|
|
||||||
): [string, number] {
|
|
||||||
const legacy = magReactionToLegacy(reaction[0]);
|
|
||||||
return [legacy, reaction[1]];
|
|
||||||
}
|
|
||||||
|
|
||||||
export function magReactionIndex(
|
|
||||||
reactions: types.ReactionPair[],
|
|
||||||
reactionType: types.Reaction
|
|
||||||
) {
|
|
||||||
return reactions.findIndex(([r, ,]) => {
|
|
||||||
if (typeof r !== typeof reactionType) return false;
|
|
||||||
|
|
||||||
if (typeof r === "string") {
|
|
||||||
return r === reactionType;
|
|
||||||
} else if (
|
|
||||||
"name" in r &&
|
|
||||||
"name" in (reactionType as { name: string; host: string | null })
|
|
||||||
) {
|
|
||||||
const { name, host } = reactionType as {
|
|
||||||
name: string;
|
|
||||||
host: string | null;
|
|
||||||
};
|
|
||||||
const { name: rName, host: rHost } = r;
|
|
||||||
|
|
||||||
return name === rName && (host ?? null) === (rHost ?? null);
|
|
||||||
} else if ("raw" in r && "raw" in (reactionType as { raw: string })) {
|
|
||||||
return r.raw === (reactionType as { raw: string }).raw;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -1,28 +1,23 @@
|
||||||
import { packed } from "magnetar-common";
|
|
||||||
import * as Misskey from "calckey-js";
|
|
||||||
import { magTransMap, magTransProperty } from "@/scripts-mag/mag-util";
|
|
||||||
|
|
||||||
export type Muted = {
|
export type Muted = {
|
||||||
muted: boolean;
|
muted: boolean;
|
||||||
matched: string[];
|
matched: string[];
|
||||||
what?: "note" | "reply" | "renote" | "quote";
|
what?: string; // "note" || "reply" || "renote" || "quote"
|
||||||
};
|
};
|
||||||
|
|
||||||
export type NotMuted = { muted: false; matched: string[] };
|
const NotMuted = { muted: false, matched: [] };
|
||||||
|
|
||||||
function checkWordMute(
|
function checkWordMute(
|
||||||
note: packed.PackNoteMaybeFull | Misskey.entities.Note,
|
note: NoteLike,
|
||||||
mutedWords: Array<string | string[]>
|
mutedWords: Array<string | string[]>
|
||||||
): Muted {
|
): Muted {
|
||||||
let text = `${note.cw ?? ""} ${note.text ?? ""}`;
|
let text = `${note.cw ?? ""} ${note.text ?? ""}`;
|
||||||
const attachments = magTransProperty(note, "attachments", "files");
|
if (note.files != null)
|
||||||
if (attachments)
|
text += ` ${note.files.map((f) => f.comment ?? "").join(" ")}`;
|
||||||
text += ` ${attachments.map((f) => f.comment ?? "").join(" ")}`;
|
|
||||||
text = text.trim();
|
text = text.trim();
|
||||||
|
|
||||||
let result: Muted | NotMuted = { muted: false, matched: [] };
|
if (text === "") return NotMuted;
|
||||||
|
|
||||||
if (text === "") return result;
|
let result = { muted: false, matched: [] };
|
||||||
|
|
||||||
for (const mutePattern of mutedWords) {
|
for (const mutePattern of mutedWords) {
|
||||||
if (Array.isArray(mutePattern)) {
|
if (Array.isArray(mutePattern)) {
|
||||||
|
@ -64,13 +59,13 @@ function checkWordMute(
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getWordSoftMute(
|
export function getWordSoftMute(
|
||||||
note: packed.PackNoteMaybeFull | Misskey.entities.Note,
|
note: Record<string, any>,
|
||||||
me: Record<string, any> | null | undefined,
|
me: Record<string, any> | null | undefined,
|
||||||
mutedWords: Array<string | string[]>
|
mutedWords: Array<string | string[]>
|
||||||
): Muted {
|
): Muted {
|
||||||
// 自分自身
|
// 自分自身
|
||||||
if (me && magTransMap(note, "user", "userId", (u) => u.id) === me.id) {
|
if (me && note.userId === me.id) {
|
||||||
return { muted: false, matched: [] };
|
return NotMuted;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mutedWords.length > 0) {
|
if (mutedWords.length > 0) {
|
||||||
|
@ -80,18 +75,16 @@ export function getWordSoftMute(
|
||||||
return noteMuted;
|
return noteMuted;
|
||||||
}
|
}
|
||||||
|
|
||||||
const renote = magTransProperty(note, "renoted_note", "renote");
|
if (note.renote) {
|
||||||
if (renote) {
|
let renoteMuted = checkWordMute(note.renote, mutedWords);
|
||||||
let renoteMuted = checkWordMute(renote, mutedWords);
|
|
||||||
if (renoteMuted.muted) {
|
if (renoteMuted.muted) {
|
||||||
renoteMuted.what = note.text == null ? "renote" : "quote";
|
renoteMuted.what = note.text == null ? "renote" : "quote";
|
||||||
return renoteMuted;
|
return renoteMuted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const reply = magTransProperty(note, "parent_note", "reply");
|
if (note.reply) {
|
||||||
if (reply) {
|
let replyMuted = checkWordMute(note.reply, mutedWords);
|
||||||
let replyMuted = checkWordMute(reply, mutedWords);
|
|
||||||
if (replyMuted.muted) {
|
if (replyMuted.muted) {
|
||||||
replyMuted.what = "reply";
|
replyMuted.what = "reply";
|
||||||
return replyMuted;
|
return replyMuted;
|
||||||
|
@ -99,5 +92,5 @@ export function getWordSoftMute(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return { muted: false, matched: [] };
|
return NotMuted;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
// structredCloneが遅いため
|
||||||
|
// SEE: http://var.blog.jp/archives/86038606.html
|
||||||
|
|
||||||
|
type Cloneable =
|
||||||
|
| string
|
||||||
|
| number
|
||||||
|
| boolean
|
||||||
|
| null
|
||||||
|
| { [key: string]: Cloneable }
|
||||||
|
| Cloneable[];
|
||||||
|
|
||||||
|
export function deepClone<T extends Cloneable>(x: T): T {
|
||||||
|
if (typeof x === "object") {
|
||||||
|
if (x === null) return x;
|
||||||
|
if (Array.isArray(x)) return x.map(deepClone) as T;
|
||||||
|
const obj = {} as Record<string, Cloneable>;
|
||||||
|
for (const [k, v] of Object.entries(x)) {
|
||||||
|
obj[k] = deepClone(v);
|
||||||
|
}
|
||||||
|
return obj as T;
|
||||||
|
} else {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
export function extractAvgColorFromBlurhash(hash: string | null) {
|
export function extractAvgColorFromBlurhash(hash: string) {
|
||||||
return hash
|
return typeof hash === "string"
|
||||||
? `#${[...hash.slice(2, 6)]
|
? `#${[...hash.slice(2, 6)]
|
||||||
.map((x) =>
|
.map((x) =>
|
||||||
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#$%*+,-.:;=?@[]^_{|}~".indexOf(
|
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#$%*+,-.:;=?@[]^_{|}~".indexOf(
|
||||||
|
|
|
@ -9,23 +9,24 @@ import { url } from "@/config";
|
||||||
import { noteActions } from "@/store";
|
import { noteActions } from "@/store";
|
||||||
import { shareAvailable } from "@/scripts/share-available";
|
import { shareAvailable } from "@/scripts/share-available";
|
||||||
import { getUserMenu } from "@/scripts/get-user-menu";
|
import { getUserMenu } from "@/scripts/get-user-menu";
|
||||||
import {
|
|
||||||
magEffectiveNote,
|
|
||||||
magTransMap,
|
|
||||||
magTransProperty,
|
|
||||||
magTransUsername,
|
|
||||||
} from "@/scripts-mag/mag-util";
|
|
||||||
import { packed } from "magnetar-common";
|
|
||||||
|
|
||||||
export function getNoteMenu(props: {
|
export function getNoteMenu(props: {
|
||||||
note: packed.PackNoteMaybeFull | misskey.entities.Note;
|
note: misskey.entities.Note;
|
||||||
menuButton: Ref<HTMLElement | undefined>;
|
menuButton: Ref<HTMLElement | undefined>;
|
||||||
translation: Ref<any>;
|
translation: Ref<any>;
|
||||||
translating: Ref<boolean>;
|
translating: Ref<boolean>;
|
||||||
isDeleted: Ref<boolean>;
|
isDeleted: Ref<boolean>;
|
||||||
currentClipPage?: Ref<misskey.entities.Clip>;
|
currentClipPage?: Ref<misskey.entities.Clip>;
|
||||||
}) {
|
}) {
|
||||||
const appearNote = magEffectiveNote(props.note);
|
const isRenote =
|
||||||
|
props.note.renote != null &&
|
||||||
|
props.note.text == null &&
|
||||||
|
props.note.fileIds.length === 0 &&
|
||||||
|
props.note.poll == null;
|
||||||
|
|
||||||
|
const appearNote = isRenote
|
||||||
|
? (props.note.renote as misskey.entities.Note)
|
||||||
|
: props.note;
|
||||||
|
|
||||||
function del(): void {
|
function del(): void {
|
||||||
os.confirm({
|
os.confirm({
|
||||||
|
@ -53,8 +54,8 @@ export function getNoteMenu(props: {
|
||||||
|
|
||||||
os.post({
|
os.post({
|
||||||
initialNote: appearNote,
|
initialNote: appearNote,
|
||||||
renote: magTransProperty(appearNote, "renoted_note", "renote"),
|
renote: appearNote.renote,
|
||||||
reply: magTransProperty(appearNote, "parent_note", "reply"),
|
reply: appearNote.reply,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -62,8 +63,8 @@ export function getNoteMenu(props: {
|
||||||
function edit(): void {
|
function edit(): void {
|
||||||
os.post({
|
os.post({
|
||||||
initialNote: appearNote,
|
initialNote: appearNote,
|
||||||
renote: magTransProperty(appearNote, "renoted_note", "renote"),
|
renote: appearNote.renote,
|
||||||
reply: magTransProperty(appearNote, "parent_note", "reply"),
|
reply: appearNote.reply,
|
||||||
editId: appearNote.id,
|
editId: appearNote.id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -227,12 +228,23 @@ export function getNoteMenu(props: {
|
||||||
props.isDeleted.value = true;
|
props.isDeleted.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function promote(): Promise<void> {
|
||||||
|
const { canceled, result: days } = await os.inputNumber({
|
||||||
|
title: i18n.ts.numberOfDays,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (canceled) return;
|
||||||
|
|
||||||
|
os.apiWithDialog("admin/promo/create", {
|
||||||
|
noteId: appearNote.id,
|
||||||
|
expiresAt: Date.now() + 86400000 * days,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function share(): void {
|
function share(): void {
|
||||||
navigator.share({
|
navigator.share({
|
||||||
title: i18n.t("noteOf", {
|
title: i18n.t("noteOf", { user: appearNote.user.name }),
|
||||||
user: magTransUsername(appearNote.user),
|
text: appearNote.text,
|
||||||
}),
|
|
||||||
text: appearNote.text ?? undefined,
|
|
||||||
url: `${url}/notes/${appearNote.id}`,
|
url: `${url}/notes/${appearNote.id}`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -254,8 +266,7 @@ export function getNoteMenu(props: {
|
||||||
noteId: appearNote.id,
|
noteId: appearNote.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
const isAppearAuthor =
|
const isAppearAuthor = appearNote.userId === $i.id;
|
||||||
magTransMap(appearNote, "user", "userId", (u) => u.id) === $i.id;
|
|
||||||
const isModerator = $i.isAdmin || $i.isModerator;
|
const isModerator = $i.isAdmin || $i.isModerator;
|
||||||
|
|
||||||
menu = [
|
menu = [
|
||||||
|
@ -342,7 +353,7 @@ export function getNoteMenu(props: {
|
||||||
text: i18n.ts.showOnRemote,
|
text: i18n.ts.showOnRemote,
|
||||||
action: () => {
|
action: () => {
|
||||||
window.open(
|
window.open(
|
||||||
(appearNote.url || appearNote.uri)!,
|
appearNote.url || appearNote.uri,
|
||||||
"_blank"
|
"_blank"
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -457,7 +468,7 @@ export function getNoteMenu(props: {
|
||||||
text: i18n.ts.showOnRemote,
|
text: i18n.ts.showOnRemote,
|
||||||
action: () => {
|
action: () => {
|
||||||
window.open(
|
window.open(
|
||||||
(appearNote.url || appearNote.uri)!,
|
appearNote.url || appearNote.uri,
|
||||||
"_blank"
|
"_blank"
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
import * as misskey from "calckey-js";
|
import * as misskey from "calckey-js";
|
||||||
import { packed } from "magnetar-common";
|
import { i18n } from "@/i18n";
|
||||||
import { magTransProperty } from "@/scripts-mag/mag-util";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 投稿を表す文字列を取得します。
|
* 投稿を表す文字列を取得します。
|
||||||
* @param {*} note (packされた)投稿
|
* @param {*} note (packされた)投稿
|
||||||
*/
|
*/
|
||||||
export const getNoteSummary = (
|
export const getNoteSummary = (note: misskey.entities.Note): string => {
|
||||||
note: packed.PackNoteMaybeFull | misskey.entities.Note
|
|
||||||
): string => {
|
|
||||||
/*
|
/*
|
||||||
if (note.deletedAt) {
|
if (note.deletedAt) {
|
||||||
return `(${i18n.ts.deletedNote})`;
|
return `(${i18n.ts.deletedNote})`;
|
||||||
|
@ -25,9 +22,8 @@ export const getNoteSummary = (
|
||||||
}
|
}
|
||||||
|
|
||||||
// ファイルが添付されているとき
|
// ファイルが添付されているとき
|
||||||
const files = magTransProperty(note, "attachments", "files");
|
if ((note.files || []).length !== 0) {
|
||||||
if ((files || []).length !== 0) {
|
const len = note.files?.length;
|
||||||
const len = files?.length;
|
|
||||||
summary += ` 📎${len !== 1 ? ` (${len})` : ""}`;
|
summary += ` 📎${len !== 1 ? ` (${len})` : ""}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ import {
|
||||||
ref,
|
ref,
|
||||||
Ref,
|
Ref,
|
||||||
} from "vue";
|
} from "vue";
|
||||||
import { packed } from "magnetar-common";
|
|
||||||
|
|
||||||
export const setPageMetadata = Symbol("setPageMetadata");
|
export const setPageMetadata = Symbol("setPageMetadata");
|
||||||
export const pageMetadataProvider = Symbol("pageMetadataProvider");
|
export const pageMetadataProvider = Symbol("pageMetadataProvider");
|
||||||
|
@ -18,7 +17,7 @@ export type PageMetadata = {
|
||||||
title: string;
|
title: string;
|
||||||
subtitle?: string;
|
subtitle?: string;
|
||||||
icon?: string | null;
|
icon?: string | null;
|
||||||
avatar?: packed.PackUserBase | misskey.entities.User | null;
|
avatar?: misskey.entities.User | null;
|
||||||
userName?: misskey.entities.User | null;
|
userName?: misskey.entities.User | null;
|
||||||
bg?: string;
|
bg?: string;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import tinycolor from "tinycolor2";
|
import tinycolor from "tinycolor2";
|
||||||
import { globalEvents } from "@/events";
|
import { globalEvents } from "@/events";
|
||||||
import lightTheme from "@/themes/_light.json5";
|
|
||||||
import darkTheme from "@/themes/_dark.json5";
|
|
||||||
|
|
||||||
export type Theme = {
|
export type Theme = {
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -13,6 +11,10 @@ export type Theme = {
|
||||||
props: Record<string, string>;
|
props: Record<string, string>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
import lightTheme from "@/themes/_light.json5";
|
||||||
|
import darkTheme from "@/themes/_dark.json5";
|
||||||
|
import { deepClone } from "./clone";
|
||||||
|
|
||||||
export const themeProps = Object.keys(lightTheme.props).filter(
|
export const themeProps = Object.keys(lightTheme.props).filter(
|
||||||
(key) => !key.startsWith("X")
|
(key) => !key.startsWith("X")
|
||||||
);
|
);
|
||||||
|
@ -75,7 +77,7 @@ export function applyTheme(theme: Theme, persist = true) {
|
||||||
const colorSchema = theme.base === "dark" ? "dark" : "light";
|
const colorSchema = theme.base === "dark" ? "dark" : "light";
|
||||||
|
|
||||||
// Deep copy
|
// Deep copy
|
||||||
const _theme = structuredClone(theme);
|
const _theme = deepClone(theme);
|
||||||
|
|
||||||
if (_theme.base) {
|
if (_theme.base) {
|
||||||
const base = [lightTheme, darkTheme].find((x) => x.id === _theme.base);
|
const base = [lightTheme, darkTheme].find((x) => x.id === _theme.base);
|
||||||
|
|
|
@ -3,16 +3,10 @@ import * as misskey from "calckey-js";
|
||||||
import { stream } from "@/stream";
|
import { stream } from "@/stream";
|
||||||
import { $i } from "@/account";
|
import { $i } from "@/account";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { endpoints, packed } from "magnetar-common";
|
|
||||||
import {
|
|
||||||
magConvertReaction,
|
|
||||||
magReactionIndex,
|
|
||||||
noteIsMag,
|
|
||||||
} from "@/scripts-mag/mag-util";
|
|
||||||
|
|
||||||
export function useNoteCapture(props: {
|
export function useNoteCapture(props: {
|
||||||
rootEl: Ref<HTMLElement>;
|
rootEl: Ref<HTMLElement>;
|
||||||
note: Ref<packed.PackNoteMaybeFull | misskey.entities.Note>;
|
note: Ref<misskey.entities.Note>;
|
||||||
isDeletedRef: Ref<boolean>;
|
isDeletedRef: Ref<boolean>;
|
||||||
}) {
|
}) {
|
||||||
const note = props.note;
|
const note = props.note;
|
||||||
|
@ -23,110 +17,6 @@ export function useNoteCapture(props: {
|
||||||
|
|
||||||
if (id !== note.value.id) return;
|
if (id !== note.value.id) return;
|
||||||
|
|
||||||
if (noteIsMag(note.value)) {
|
|
||||||
switch (type) {
|
|
||||||
case "reacted": {
|
|
||||||
const reaction = body.reaction as string;
|
|
||||||
|
|
||||||
if (body.emoji) {
|
|
||||||
const emojis = note.value.emojis || [];
|
|
||||||
if (!emojis.includes(body.emoji)) {
|
|
||||||
note.value.emojis = [
|
|
||||||
...emojis,
|
|
||||||
{
|
|
||||||
id: body.emoji.id,
|
|
||||||
shortcode: body.emoji.name,
|
|
||||||
url: body.emoji.url,
|
|
||||||
width: body.emoji.width ?? null,
|
|
||||||
height: body.emoji.height ?? null,
|
|
||||||
category: null,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const reactionType = magConvertReaction(reaction);
|
|
||||||
const foundReaction = magReactionIndex(
|
|
||||||
note.value.reactions,
|
|
||||||
reactionType
|
|
||||||
);
|
|
||||||
|
|
||||||
const selfReact = ($i && body.userId === $i.id) || false;
|
|
||||||
if (foundReaction >= 0) {
|
|
||||||
note.value.reactions[foundReaction] = [
|
|
||||||
note.value.reactions[foundReaction][0],
|
|
||||||
note.value.reactions[foundReaction][1] + 1,
|
|
||||||
selfReact,
|
|
||||||
];
|
|
||||||
} else {
|
|
||||||
note.value.reactions.push([reactionType, 1, selfReact]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case "unreacted": {
|
|
||||||
const reaction = body.reaction;
|
|
||||||
|
|
||||||
const reactionType = magConvertReaction(reaction);
|
|
||||||
const foundReaction = magReactionIndex(
|
|
||||||
note.value.reactions,
|
|
||||||
reactionType
|
|
||||||
);
|
|
||||||
|
|
||||||
if (foundReaction >= 0) {
|
|
||||||
const cnt = note.value.reactions[foundReaction][1];
|
|
||||||
note.value.reactions[foundReaction] = [
|
|
||||||
note.value.reactions[foundReaction][0],
|
|
||||||
cnt === 0 ? 0 : cnt - 1,
|
|
||||||
false,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case "pollVoted": {
|
|
||||||
const choice = body.choice;
|
|
||||||
|
|
||||||
if (note.value.poll) {
|
|
||||||
const options = [...note.value.poll.options];
|
|
||||||
options[choice] = {
|
|
||||||
...options[choice],
|
|
||||||
votes_count: options[choice].votes_count + 1,
|
|
||||||
voted: ($i && body.userId === $i.id) || null,
|
|
||||||
};
|
|
||||||
note.value.poll.options = options;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case "deleted": {
|
|
||||||
props.isDeletedRef.value = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case "updated": {
|
|
||||||
const editedNote = await os.magApi(
|
|
||||||
endpoints.GetNoteById,
|
|
||||||
{
|
|
||||||
attachments: true,
|
|
||||||
context: true,
|
|
||||||
},
|
|
||||||
{ id }
|
|
||||||
);
|
|
||||||
|
|
||||||
const keys = new Set<string>();
|
|
||||||
Object.keys(editedNote)
|
|
||||||
.concat(Object.keys(note.value))
|
|
||||||
.forEach((key) => keys.add(key));
|
|
||||||
keys.forEach((key) => {
|
|
||||||
note.value[key] = editedNote[key];
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "reacted": {
|
case "reacted": {
|
||||||
const reaction = body.reaction;
|
const reaction = body.reaction;
|
||||||
|
@ -155,10 +45,7 @@ export function useNoteCapture(props: {
|
||||||
// TODO: reactionsプロパティがない場合ってあったっけ? なければ || {} は消せる
|
// TODO: reactionsプロパティがない場合ってあったっけ? なければ || {} は消せる
|
||||||
const currentCount = note.value.reactions?.[reaction] || 0;
|
const currentCount = note.value.reactions?.[reaction] || 0;
|
||||||
|
|
||||||
note.value.reactions[reaction] = Math.max(
|
note.value.reactions[reaction] = Math.max(0, currentCount - 1);
|
||||||
0,
|
|
||||||
currentCount - 1
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($i && body.userId === $i.id) {
|
if ($i && body.userId === $i.id) {
|
||||||
note.value.myReaction = undefined;
|
note.value.myReaction = undefined;
|
||||||
|
@ -207,7 +94,6 @@ export function useNoteCapture(props: {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function capture(withHandler = false): void {
|
function capture(withHandler = false): void {
|
||||||
if (connection) {
|
if (connection) {
|
||||||
|
|
|
@ -6,16 +6,11 @@ import { Storage } from "./pizzax";
|
||||||
import lightTheme from "@/themes/l-rosepinedawn.json5";
|
import lightTheme from "@/themes/l-rosepinedawn.json5";
|
||||||
import darkTheme from "@/themes/d-rosepine.json5";
|
import darkTheme from "@/themes/d-rosepine.json5";
|
||||||
|
|
||||||
export const postFormActions: {
|
export const postFormActions = [];
|
||||||
title: any;
|
export const userActions = [];
|
||||||
handler: (form: any, update: any) => void;
|
export const noteActions = [];
|
||||||
}[] = [];
|
export const noteViewInterruptors = [];
|
||||||
export const userActions: { title: any; handler: (user: any) => void }[] = [];
|
export const notePostInterruptors = [];
|
||||||
export const noteActions: { title: any; handler: (note: any) => void }[] = [];
|
|
||||||
export const noteViewInterruptors: { handler: (note: any) => Promise<any> }[] =
|
|
||||||
[];
|
|
||||||
export const notePostInterruptors: { handler: (note: any) => Promise<any> }[] =
|
|
||||||
[];
|
|
||||||
|
|
||||||
const menuOptions = [
|
const menuOptions = [
|
||||||
"notifications",
|
"notifications",
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { markRaw } from "vue";
|
||||||
import { notificationTypes } from "calckey-js";
|
import { notificationTypes } from "calckey-js";
|
||||||
import { Storage } from "../../pizzax";
|
import { Storage } from "../../pizzax";
|
||||||
import { api } from "@/os";
|
import { api } from "@/os";
|
||||||
|
import { deepClone } from "@/scripts/clone";
|
||||||
|
|
||||||
type ColumnWidget = {
|
type ColumnWidget = {
|
||||||
name: string;
|
name: string;
|
||||||
|
@ -157,7 +158,7 @@ export function swapColumn(a: Column["id"], b: Column["id"]) {
|
||||||
const aY = deckStore.state.layout[aX].findIndex((id) => id === a);
|
const aY = deckStore.state.layout[aX].findIndex((id) => id === a);
|
||||||
const bX = deckStore.state.layout.findIndex((ids) => ids.indexOf(b) !== -1);
|
const bX = deckStore.state.layout.findIndex((ids) => ids.indexOf(b) !== -1);
|
||||||
const bY = deckStore.state.layout[bX].findIndex((id) => id === b);
|
const bY = deckStore.state.layout[bX].findIndex((id) => id === b);
|
||||||
const layout = structuredClone(deckStore.state.layout);
|
const layout = deepClone(deckStore.state.layout);
|
||||||
layout[aX][aY] = b;
|
layout[aX][aY] = b;
|
||||||
layout[bX][bY] = a;
|
layout[bX][bY] = a;
|
||||||
deckStore.set("layout", layout);
|
deckStore.set("layout", layout);
|
||||||
|
@ -165,7 +166,7 @@ export function swapColumn(a: Column["id"], b: Column["id"]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function swapLeftColumn(id: Column["id"]) {
|
export function swapLeftColumn(id: Column["id"]) {
|
||||||
const layout = structuredClone(deckStore.state.layout);
|
const layout = deepClone(deckStore.state.layout);
|
||||||
deckStore.state.layout.some((ids, i) => {
|
deckStore.state.layout.some((ids, i) => {
|
||||||
if (ids.includes(id)) {
|
if (ids.includes(id)) {
|
||||||
const left = deckStore.state.layout[i - 1];
|
const left = deckStore.state.layout[i - 1];
|
||||||
|
@ -181,7 +182,7 @@ export function swapLeftColumn(id: Column["id"]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function swapRightColumn(id: Column["id"]) {
|
export function swapRightColumn(id: Column["id"]) {
|
||||||
const layout = structuredClone(deckStore.state.layout);
|
const layout = deepClone(deckStore.state.layout);
|
||||||
deckStore.state.layout.some((ids, i) => {
|
deckStore.state.layout.some((ids, i) => {
|
||||||
if (ids.includes(id)) {
|
if (ids.includes(id)) {
|
||||||
const right = deckStore.state.layout[i + 1];
|
const right = deckStore.state.layout[i + 1];
|
||||||
|
@ -197,11 +198,11 @@ export function swapRightColumn(id: Column["id"]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function swapUpColumn(id: Column["id"]) {
|
export function swapUpColumn(id: Column["id"]) {
|
||||||
const layout = structuredClone(deckStore.state.layout);
|
const layout = deepClone(deckStore.state.layout);
|
||||||
const idsIndex = deckStore.state.layout.findIndex((ids) =>
|
const idsIndex = deckStore.state.layout.findIndex((ids) =>
|
||||||
ids.includes(id)
|
ids.includes(id)
|
||||||
);
|
);
|
||||||
const ids = structuredClone(deckStore.state.layout[idsIndex]);
|
const ids = deepClone(deckStore.state.layout[idsIndex]);
|
||||||
ids.some((x, i) => {
|
ids.some((x, i) => {
|
||||||
if (x === id) {
|
if (x === id) {
|
||||||
const up = ids[i - 1];
|
const up = ids[i - 1];
|
||||||
|
@ -219,11 +220,11 @@ export function swapUpColumn(id: Column["id"]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function swapDownColumn(id: Column["id"]) {
|
export function swapDownColumn(id: Column["id"]) {
|
||||||
const layout = structuredClone(deckStore.state.layout);
|
const layout = deepClone(deckStore.state.layout);
|
||||||
const idsIndex = deckStore.state.layout.findIndex((ids) =>
|
const idsIndex = deckStore.state.layout.findIndex((ids) =>
|
||||||
ids.includes(id)
|
ids.includes(id)
|
||||||
);
|
);
|
||||||
const ids = structuredClone(deckStore.state.layout[idsIndex]);
|
const ids = deepClone(deckStore.state.layout[idsIndex]);
|
||||||
ids.some((x, i) => {
|
ids.some((x, i) => {
|
||||||
if (x === id) {
|
if (x === id) {
|
||||||
const down = ids[i + 1];
|
const down = ids[i + 1];
|
||||||
|
@ -241,7 +242,7 @@ export function swapDownColumn(id: Column["id"]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function stackLeftColumn(id: Column["id"]) {
|
export function stackLeftColumn(id: Column["id"]) {
|
||||||
let layout = structuredClone(deckStore.state.layout);
|
let layout = deepClone(deckStore.state.layout);
|
||||||
const i = deckStore.state.layout.findIndex((ids) => ids.includes(id));
|
const i = deckStore.state.layout.findIndex((ids) => ids.includes(id));
|
||||||
layout = layout.map((ids) => ids.filter((_id) => _id !== id));
|
layout = layout.map((ids) => ids.filter((_id) => _id !== id));
|
||||||
layout[i - 1].push(id);
|
layout[i - 1].push(id);
|
||||||
|
@ -251,7 +252,7 @@ export function stackLeftColumn(id: Column["id"]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function popRightColumn(id: Column["id"]) {
|
export function popRightColumn(id: Column["id"]) {
|
||||||
let layout = structuredClone(deckStore.state.layout);
|
let layout = deepClone(deckStore.state.layout);
|
||||||
const i = deckStore.state.layout.findIndex((ids) => ids.includes(id));
|
const i = deckStore.state.layout.findIndex((ids) => ids.includes(id));
|
||||||
const affected = layout[i];
|
const affected = layout[i];
|
||||||
layout = layout.map((ids) => ids.filter((_id) => _id !== id));
|
layout = layout.map((ids) => ids.filter((_id) => _id !== id));
|
||||||
|
@ -259,7 +260,7 @@ export function popRightColumn(id: Column["id"]) {
|
||||||
layout = layout.filter((ids) => ids.length > 0);
|
layout = layout.filter((ids) => ids.length > 0);
|
||||||
deckStore.set("layout", layout);
|
deckStore.set("layout", layout);
|
||||||
|
|
||||||
const columns = structuredClone(deckStore.state.columns);
|
const columns = deepClone(deckStore.state.columns);
|
||||||
for (const column of columns) {
|
for (const column of columns) {
|
||||||
if (affected.includes(column.id)) {
|
if (affected.includes(column.id)) {
|
||||||
column.active = true;
|
column.active = true;
|
||||||
|
@ -271,9 +272,9 @@ export function popRightColumn(id: Column["id"]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function addColumnWidget(id: Column["id"], widget: ColumnWidget) {
|
export function addColumnWidget(id: Column["id"], widget: ColumnWidget) {
|
||||||
const columns = structuredClone(deckStore.state.columns);
|
const columns = deepClone(deckStore.state.columns);
|
||||||
const columnIndex = deckStore.state.columns.findIndex((c) => c.id === id);
|
const columnIndex = deckStore.state.columns.findIndex((c) => c.id === id);
|
||||||
const column = structuredClone(deckStore.state.columns[columnIndex]);
|
const column = deepClone(deckStore.state.columns[columnIndex]);
|
||||||
if (column == null) return;
|
if (column == null) return;
|
||||||
if (column.widgets == null) column.widgets = [];
|
if (column.widgets == null) column.widgets = [];
|
||||||
column.widgets.unshift(widget);
|
column.widgets.unshift(widget);
|
||||||
|
@ -283,9 +284,9 @@ export function addColumnWidget(id: Column["id"], widget: ColumnWidget) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function removeColumnWidget(id: Column["id"], widget: ColumnWidget) {
|
export function removeColumnWidget(id: Column["id"], widget: ColumnWidget) {
|
||||||
const columns = structuredClone(deckStore.state.columns);
|
const columns = deepClone(deckStore.state.columns);
|
||||||
const columnIndex = deckStore.state.columns.findIndex((c) => c.id === id);
|
const columnIndex = deckStore.state.columns.findIndex((c) => c.id === id);
|
||||||
const column = structuredClone(deckStore.state.columns[columnIndex]);
|
const column = deepClone(deckStore.state.columns[columnIndex]);
|
||||||
if (column == null) return;
|
if (column == null) return;
|
||||||
column.widgets = column.widgets.filter((w) => w.id !== widget.id);
|
column.widgets = column.widgets.filter((w) => w.id !== widget.id);
|
||||||
columns[columnIndex] = column;
|
columns[columnIndex] = column;
|
||||||
|
@ -294,9 +295,9 @@ export function removeColumnWidget(id: Column["id"], widget: ColumnWidget) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setColumnWidgets(id: Column["id"], widgets: ColumnWidget[]) {
|
export function setColumnWidgets(id: Column["id"], widgets: ColumnWidget[]) {
|
||||||
const columns = structuredClone(deckStore.state.columns);
|
const columns = deepClone(deckStore.state.columns);
|
||||||
const columnIndex = deckStore.state.columns.findIndex((c) => c.id === id);
|
const columnIndex = deckStore.state.columns.findIndex((c) => c.id === id);
|
||||||
const column = structuredClone(deckStore.state.columns[columnIndex]);
|
const column = deepClone(deckStore.state.columns[columnIndex]);
|
||||||
if (column == null) return;
|
if (column == null) return;
|
||||||
column.widgets = widgets;
|
column.widgets = widgets;
|
||||||
columns[columnIndex] = column;
|
columns[columnIndex] = column;
|
||||||
|
@ -309,9 +310,9 @@ export function updateColumnWidget(
|
||||||
widgetId: string,
|
widgetId: string,
|
||||||
widgetData: any
|
widgetData: any
|
||||||
) {
|
) {
|
||||||
const columns = structuredClone(deckStore.state.columns);
|
const columns = deepClone(deckStore.state.columns);
|
||||||
const columnIndex = deckStore.state.columns.findIndex((c) => c.id === id);
|
const columnIndex = deckStore.state.columns.findIndex((c) => c.id === id);
|
||||||
const column = structuredClone(deckStore.state.columns[columnIndex]);
|
const column = deepClone(deckStore.state.columns[columnIndex]);
|
||||||
if (column == null) return;
|
if (column == null) return;
|
||||||
column.widgets = column.widgets.map((w) =>
|
column.widgets = column.widgets.map((w) =>
|
||||||
w.id === widgetId
|
w.id === widgetId
|
||||||
|
@ -327,9 +328,9 @@ export function updateColumnWidget(
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updateColumn(id: Column["id"], column: Partial<Column>) {
|
export function updateColumn(id: Column["id"], column: Partial<Column>) {
|
||||||
const columns = structuredClone(deckStore.state.columns);
|
const columns = deepClone(deckStore.state.columns);
|
||||||
const columnIndex = deckStore.state.columns.findIndex((c) => c.id === id);
|
const columnIndex = deckStore.state.columns.findIndex((c) => c.id === id);
|
||||||
const currentColumn = structuredClone(deckStore.state.columns[columnIndex]);
|
const currentColumn = deepClone(deckStore.state.columns[columnIndex]);
|
||||||
if (currentColumn == null) return;
|
if (currentColumn == null) return;
|
||||||
for (const [k, v] of Object.entries(column)) {
|
for (const [k, v] of Object.entries(column)) {
|
||||||
currentColumn[k] = v;
|
currentColumn[k] = v;
|
||||||
|
|
|
@ -123,12 +123,20 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onUnmounted, reactive } from "vue";
|
import { onMounted, onUnmounted, reactive, ref } from "vue";
|
||||||
import { useWidgetPropsManager, Widget, WidgetComponentExpose } from "./widget";
|
import {
|
||||||
|
useWidgetPropsManager,
|
||||||
|
Widget,
|
||||||
|
WidgetComponentEmits,
|
||||||
|
WidgetComponentExpose,
|
||||||
|
WidgetComponentProps,
|
||||||
|
} from "./widget";
|
||||||
import { GetFormResultType } from "@/scripts/form";
|
import { GetFormResultType } from "@/scripts/form";
|
||||||
import { stream } from "@/stream";
|
import { stream } from "@/stream";
|
||||||
import number from "@/filters/number";
|
import number from "@/filters/number";
|
||||||
import * as sound from "@/scripts/sound";
|
import * as sound from "@/scripts/sound";
|
||||||
|
import * as os from "@/os";
|
||||||
|
import { deepClone } from "@/scripts/clone";
|
||||||
|
|
||||||
const name = "jobQueue";
|
const name = "jobQueue";
|
||||||
|
|
||||||
|
@ -177,12 +185,12 @@ const prev = reactive({} as typeof current);
|
||||||
const jammedSound = sound.setVolume(sound.getAudio("syuilo/queue-jammed"), 1);
|
const jammedSound = sound.setVolume(sound.getAudio("syuilo/queue-jammed"), 1);
|
||||||
|
|
||||||
for (const domain of ["inbox", "deliver"]) {
|
for (const domain of ["inbox", "deliver"]) {
|
||||||
prev[domain] = structuredClone(current[domain]);
|
prev[domain] = deepClone(current[domain]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const onStats = (stats) => {
|
const onStats = (stats) => {
|
||||||
for (const domain of ["inbox", "deliver"]) {
|
for (const domain of ["inbox", "deliver"]) {
|
||||||
prev[domain] = structuredClone(current[domain]);
|
prev[domain] = deepClone(current[domain]);
|
||||||
current[domain].activeSincePrevTick = stats[domain].activeSincePrevTick;
|
current[domain].activeSincePrevTick = stats[domain].activeSincePrevTick;
|
||||||
current[domain].active = stats[domain].active;
|
current[domain].active = stats[domain].active;
|
||||||
current[domain].waiting = stats[domain].waiting;
|
current[domain].waiting = stats[domain].waiting;
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import { reactive, toRaw, watch } from "vue";
|
import { reactive, watch } from "vue";
|
||||||
import { throttle } from "throttle-debounce";
|
import { throttle } from "throttle-debounce";
|
||||||
import { Form, GetFormResultType } from "@/scripts/form";
|
import { Form, GetFormResultType } from "@/scripts/form";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
|
import { deepClone } from "@/scripts/clone";
|
||||||
|
|
||||||
export type Widget<P extends Record<string, unknown>> = {
|
export type Widget<P extends Record<string, unknown>> = {
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -35,7 +36,7 @@ export const useWidgetPropsManager = <
|
||||||
configure: () => void;
|
configure: () => void;
|
||||||
} => {
|
} => {
|
||||||
const widgetProps = reactive(
|
const widgetProps = reactive(
|
||||||
props.widget ? structuredClone(toRaw(props.widget.data)) : {}
|
props.widget ? deepClone(props.widget.data) : {}
|
||||||
);
|
);
|
||||||
|
|
||||||
const mergeProps = () => {
|
const mergeProps = () => {
|
||||||
|
@ -58,7 +59,7 @@ export const useWidgetPropsManager = <
|
||||||
});
|
});
|
||||||
|
|
||||||
const configure = async () => {
|
const configure = async () => {
|
||||||
const form = structuredClone(toRaw(propsDef));
|
const form = deepClone(propsDef);
|
||||||
for (const item of Object.keys(form)) {
|
for (const item of Object.keys(form)) {
|
||||||
form[item].default = widgetProps[item];
|
form[item].default = widgetProps[item];
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,8 +36,7 @@
|
||||||
"esnext",
|
"esnext",
|
||||||
"dom"
|
"dom"
|
||||||
],
|
],
|
||||||
"jsx": "preserve",
|
"jsx": "preserve"
|
||||||
"jsxImportSource": "vue"
|
|
||||||
},
|
},
|
||||||
"compileOnSave": false,
|
"compileOnSave": false,
|
||||||
"include": [
|
"include": [
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "magnetar-common",
|
"name": "magnetar-common",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"main": "./built/index.js",
|
"main": "index.js",
|
||||||
"types": "./built/index.d.ts",
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc"
|
"build": "tsc"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,126 +0,0 @@
|
||||||
export type Method = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
||||||
|
|
||||||
export interface BackendApiEndpoint<
|
|
||||||
M extends Method,
|
|
||||||
PP extends string[],
|
|
||||||
T,
|
|
||||||
R
|
|
||||||
> {
|
|
||||||
method: M;
|
|
||||||
endpoint: string;
|
|
||||||
pathParams: PP;
|
|
||||||
request?: T;
|
|
||||||
response?: R;
|
|
||||||
}
|
|
||||||
|
|
||||||
function nestedUrlSearchParams(data: any, topLevel: boolean = true): string {
|
|
||||||
switch (typeof data) {
|
|
||||||
case "string":
|
|
||||||
case "bigint":
|
|
||||||
case "boolean":
|
|
||||||
case "number":
|
|
||||||
case "symbol":
|
|
||||||
if (topLevel) return encodeURIComponent(data.toString()) + "=";
|
|
||||||
|
|
||||||
return data.toString();
|
|
||||||
case "object":
|
|
||||||
if (data === null) return "null";
|
|
||||||
|
|
||||||
if (Array.isArray(data))
|
|
||||||
return data
|
|
||||||
.map((d) => nestedUrlSearchParams(d, true))
|
|
||||||
.map(encodeURIComponent)
|
|
||||||
.join("&");
|
|
||||||
|
|
||||||
const inner = Object.entries(data).map(([k, v]) => [
|
|
||||||
k,
|
|
||||||
nestedUrlSearchParams(v, false),
|
|
||||||
]);
|
|
||||||
|
|
||||||
return new URLSearchParams(inner).toString();
|
|
||||||
|
|
||||||
default:
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export type MagApiErrorCode = "Client:GenericApiError" | string;
|
|
||||||
|
|
||||||
export interface MagApiError {
|
|
||||||
status: number;
|
|
||||||
code: MagApiErrorCode;
|
|
||||||
message: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class MagApiClient {
|
|
||||||
private readonly baseUrl: string;
|
|
||||||
|
|
||||||
constructor(baseUrl: string) {
|
|
||||||
this.baseUrl = baseUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
async call<
|
|
||||||
T extends BackendApiEndpoint<
|
|
||||||
T["method"] & Method,
|
|
||||||
T["pathParams"] & string[],
|
|
||||||
T["request"],
|
|
||||||
T["response"]
|
|
||||||
>
|
|
||||||
>(
|
|
||||||
{ endpoint, method }: T,
|
|
||||||
data: T["request"],
|
|
||||||
pathParams: {
|
|
||||||
[K in keyof T["pathParams"] as T["pathParams"][K] & string]:
|
|
||||||
| string
|
|
||||||
| number;
|
|
||||||
},
|
|
||||||
token?: string | null | undefined
|
|
||||||
): Promise<T["response"]> {
|
|
||||||
type Response = T["response"];
|
|
||||||
|
|
||||||
const authorizationToken = token ?? undefined;
|
|
||||||
const authorization = authorizationToken
|
|
||||||
? `Bearer ${authorizationToken}`
|
|
||||||
: undefined;
|
|
||||||
|
|
||||||
for (const name in pathParams) {
|
|
||||||
endpoint = endpoint.replace(`:${name}`, `${pathParams[name]}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseUrl = this.baseUrl.replace(/\/+$/, "");
|
|
||||||
let url = `${baseUrl}${endpoint}`;
|
|
||||||
|
|
||||||
if (method === "GET") {
|
|
||||||
const query = nestedUrlSearchParams(data as any);
|
|
||||||
if (query) {
|
|
||||||
url += `?${query}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return await fetch(url, {
|
|
||||||
method,
|
|
||||||
body: method !== "GET" ? JSON.stringify(data) : undefined,
|
|
||||||
credentials: "omit",
|
|
||||||
cache: "no-cache",
|
|
||||||
headers: authorization ? { authorization } : {},
|
|
||||||
})
|
|
||||||
.then(async (res) => {
|
|
||||||
const body = res.status === 204 ? null : await res.json();
|
|
||||||
|
|
||||||
if (res.status === 200) {
|
|
||||||
return body as Response;
|
|
||||||
} else if (res.status === 204) {
|
|
||||||
return null as any as Response;
|
|
||||||
} else {
|
|
||||||
throw body as MagApiError;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
throw {
|
|
||||||
status: -1,
|
|
||||||
code: "Client:GenericApiError",
|
|
||||||
message: e,
|
|
||||||
} as MagApiError;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
export { GetNoteById } from "./types/endpoints/GetNoteById";
|
|
||||||
export { GetTimeline } from "./types/endpoints/GetTimeline";
|
|
||||||
export { GetUserById } from "./types/endpoints/GetUserById";
|
|
||||||
export { GetUserByAcct } from "./types/endpoints/GetUserByAcct";
|
|
||||||
export { GetUserSelf } from "./types/endpoints/GetUserSelf";
|
|
|
@ -1,28 +0,0 @@
|
||||||
import {
|
|
||||||
BackendApiEndpoint,
|
|
||||||
MagApiClient,
|
|
||||||
MagApiError,
|
|
||||||
MagApiErrorCode,
|
|
||||||
Method,
|
|
||||||
} from "./be-api";
|
|
||||||
|
|
||||||
import {
|
|
||||||
feEndpoints,
|
|
||||||
FrontendApiEndpoint,
|
|
||||||
FrontendApiEndpoints,
|
|
||||||
} from "./fe-api";
|
|
||||||
|
|
||||||
export * as types from "./types";
|
|
||||||
export * as packed from "./packed";
|
|
||||||
export * as endpoints from "./endpoints";
|
|
||||||
|
|
||||||
export {
|
|
||||||
Method,
|
|
||||||
BackendApiEndpoint,
|
|
||||||
MagApiError,
|
|
||||||
MagApiClient,
|
|
||||||
MagApiErrorCode,
|
|
||||||
feEndpoints,
|
|
||||||
FrontendApiEndpoint,
|
|
||||||
FrontendApiEndpoints,
|
|
||||||
};
|
|
|
@ -1,16 +0,0 @@
|
||||||
export { PackDriveFileBase } from "./types/packed/PackDriveFileBase";
|
|
||||||
export { PackDriveFileFull } from "./types/packed/PackDriveFileFull";
|
|
||||||
export { PackDriveFileWithFolder } from "./types/packed/PackDriveFileWithFolder";
|
|
||||||
export { PackDriveFileWithUser } from "./types/packed/PackDriveFileWithUser";
|
|
||||||
export { PackDriveFolderBase } from "./types/packed/PackDriveFolderBase";
|
|
||||||
export { PackEmojiBase } from "./types/packed/PackEmojiBase";
|
|
||||||
export { PackDriveFolderWithParent } from "./types/packed/PackDriveFolderWithParent";
|
|
||||||
export { PackNoteBase } from "./types/packed/PackNoteBase";
|
|
||||||
export { PackNoteMaybeFull } from "./types/packed/PackNoteMaybeFull";
|
|
||||||
export { PackPollBase } from "./types/packed/PackPollBase";
|
|
||||||
export { PackNoteMaybeAttachments } from "./types/packed/PackNoteMaybeAttachments";
|
|
||||||
export { PackSecurityKeyBase } from "./types/packed/PackSecurityKeyBase";
|
|
||||||
export { PackUserBase } from "./types/packed/PackUserBase";
|
|
||||||
export { PackUserMaybeAll } from "./types/packed/PackUserMaybeAll";
|
|
||||||
export { PackUserSelf } from "./types/packed/PackUserSelf";
|
|
||||||
export { PackUserSelfMaybeAll } from "./types/packed/PackUserSelfMaybeAll";
|
|
|
@ -1,40 +0,0 @@
|
||||||
export { EmojiContext } from "./types/EmojiContext";
|
|
||||||
export { FollowVisibility } from "./types/FollowVisibility";
|
|
||||||
export { Id } from "./types/Id";
|
|
||||||
export { NotificationSettings } from "./types/NotificationSettings";
|
|
||||||
export { EmojiBase } from "./types/EmojiBase";
|
|
||||||
export { MmXml } from "./types/MmXml";
|
|
||||||
export { NotificationType } from "./types/NotificationType";
|
|
||||||
export { NoteBase } from "./types/NoteBase";
|
|
||||||
export { NoteAttachmentExt } from "./types/NoteAttachmentExt";
|
|
||||||
export { NoteDetailExt } from "./types/NoteDetailExt";
|
|
||||||
export { NoteListFilter } from "./types/NoteListFilter";
|
|
||||||
export { NoteSelfContextExt } from "./types/NoteSelfContextExt";
|
|
||||||
export { NoteVisibility } from "./types/NoteVisibility";
|
|
||||||
export { PollBase } from "./types/PollBase";
|
|
||||||
export { PollChoice } from "./types/PollChoice";
|
|
||||||
export { Reaction } from "./types/Reaction";
|
|
||||||
export { ReactionPair } from "./types/ReactionPair";
|
|
||||||
export { AvatarDecoration } from "./types/AvatarDecoration";
|
|
||||||
export { ProfileField } from "./types/ProfileField";
|
|
||||||
export { SecurityKeyBase } from "./types/SecurityKeyBase";
|
|
||||||
export { SpeechTransform } from "./types/SpeechTransform";
|
|
||||||
export { UserAuthOverviewExt } from "./types/UserAuthOverviewExt";
|
|
||||||
export { UserBase } from "./types/UserBase";
|
|
||||||
export { UserDetailExt } from "./types/UserDetailExt";
|
|
||||||
export { UserProfileExt } from "./types/UserProfileExt";
|
|
||||||
export { UserProfilePinsEx } from "./types/UserProfilePinsEx";
|
|
||||||
export { UserSecretsExt } from "./types/UserSecretsExt";
|
|
||||||
export { UserRelationExt } from "./types/UserRelationExt";
|
|
||||||
export { UserSelfExt } from "./types/UserSelfExt";
|
|
||||||
export { NoteByIdReq } from "./types/NoteByIdReq";
|
|
||||||
export { GetTimelineReq } from "./types/GetTimelineReq";
|
|
||||||
export { UserByIdReq } from "./types/UserByIdReq";
|
|
||||||
export { UserSelfReq } from "./types/UserSelfReq";
|
|
||||||
export { DriveFileBase } from "./types/DriveFileBase";
|
|
||||||
export { DriveFileFolderExt } from "./types/DriveFileFolderExt";
|
|
||||||
export { DriveFileUserExt } from "./types/DriveFileUserExt";
|
|
||||||
export { DriveFolderBase } from "./types/DriveFolderBase";
|
|
||||||
export { DriveFolderParentExt } from "./types/DriveFolderParentExt";
|
|
||||||
export { ImageMeta } from "./types/ImageMeta";
|
|
||||||
export { InstanceTicker } from "./types/InstanceTicker";
|
|
|
@ -1,3 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
|
|
||||||
export type AvatarDecoration = "None" | "CatEars";
|
|
|
@ -1,4 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
import type { ImageMeta } from "./ImageMeta";
|
|
||||||
|
|
||||||
export interface DriveFileBase { name: string, created_at: string, size: number, hash: string | null, mime_type: string, media_metadata: ImageMeta, url: string | null, source_url: string, thumbnail_url: string | null, blurhash: string | null, sensitive: boolean, comment: string | null, folder_id: string | null, user_id: string | null, }
|
|
|
@ -1,4 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
import type { PackDriveFolderBase } from "./packed/PackDriveFolderBase";
|
|
||||||
|
|
||||||
export interface DriveFileFolderExt { folder: PackDriveFolderBase, }
|
|
|
@ -1,4 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
import type { PackUserBase } from "./packed/PackUserBase";
|
|
||||||
|
|
||||||
export interface DriveFileUserExt { user: PackUserBase, }
|
|
|
@ -1,3 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
|
|
||||||
export interface DriveFolderBase { name: string, created_at: string, comment: string | null, file_count: number, folder_count: number, parent_id: string | null, user_id: string, }
|
|
|
@ -1,4 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
import type { DriveFolderBase } from "./DriveFolderBase";
|
|
||||||
|
|
||||||
export interface DriveFolderParentExt { folder: DriveFolderBase, }
|
|
|
@ -1,3 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
|
|
||||||
export interface EmojiBase { shortcode: string, url: string, category: string | null, width: number | null, height: number | null, }
|
|
|
@ -1,4 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
import type { PackEmojiBase } from "./packed/PackEmojiBase";
|
|
||||||
|
|
||||||
export type EmojiContext = Array<PackEmojiBase>;
|
|
|
@ -1,3 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
|
|
||||||
export type FollowVisibility = "Public" | "Followers" | "Private";
|
|
|
@ -1,4 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
import type { NoteListFilter } from "./NoteListFilter";
|
|
||||||
|
|
||||||
export interface GetTimelineReq { limit?: bigint, filter?: NoteListFilter, }
|
|
|
@ -1,3 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
|
|
||||||
export interface Id { id: string, }
|
|
|
@ -1,3 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
|
|
||||||
export interface ImageMeta { width: number | null, height: number | null, orientation: number | null, color: string | null, }
|
|
|
@ -1,3 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
|
|
||||||
export interface InstanceTicker { name: string | null, software_name: string | null, software_version: string | null, icon_url: string | null, favicon_url: string | null, theme_color: string | null, }
|
|
|
@ -1,3 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
|
|
||||||
export type MmXml = string;
|
|
|
@ -1,5 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
import type { PackDriveFileBase } from "./packed/PackDriveFileBase";
|
|
||||||
import type { PackPollBase } from "./packed/PackPollBase";
|
|
||||||
|
|
||||||
export interface NoteAttachmentExt { poll: PackPollBase | null, attachments: Array<PackDriveFileBase>, }
|
|
|
@ -1,8 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
import type { EmojiContext } from "./EmojiContext";
|
|
||||||
import type { MmXml } from "./MmXml";
|
|
||||||
import type { NoteVisibility } from "./NoteVisibility";
|
|
||||||
import type { PackUserBase } from "./packed/PackUserBase";
|
|
||||||
import type { ReactionPair } from "./ReactionPair";
|
|
||||||
|
|
||||||
export interface NoteBase { created_at: string, updated_at: string | null, cw: string | null, cw_mm: MmXml | null, uri: string | null, url: string | null, text: string, text_mm: MmXml | null, visibility: NoteVisibility, user: PackUserBase, parent_note_id: string | null, renoted_note_id: string | null, reply_count: number, renote_count: number, mentions: Array<string>, visible_user_ids: Array<string> | null, hashtags: Array<string>, reactions: Array<ReactionPair>, local_only: boolean, has_poll: boolean, file_ids: Array<string>, emojis: EmojiContext, }
|
|
|
@ -1,3 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
|
|
||||||
export interface NoteByIdReq { context?: boolean, attachments?: boolean, }
|
|
|
@ -1,4 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
import type { PackNoteMaybeAttachments } from "./packed/PackNoteMaybeAttachments";
|
|
||||||
|
|
||||||
export interface NoteDetailExt { parent_note: PackNoteMaybeAttachments | null, renoted_note: PackNoteMaybeAttachments | null, }
|
|
|
@ -1,3 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
|
|
||||||
export interface NoteListFilter { show_renotes: boolean | null, show_replies: boolean | null, show_files_only: boolean | null, uncwed_sensitive: boolean | null, }
|
|
|
@ -1,3 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
|
|
||||||
export interface NoteSelfContextExt { self_renote_count: number | null, }
|
|
|
@ -1,3 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
|
|
||||||
export type NoteVisibility = "Public" | "Home" | "Followers" | "Direct";
|
|
|
@ -1,4 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
import type { NotificationType } from "./NotificationType";
|
|
||||||
|
|
||||||
export interface NotificationSettings { enabled: Array<NotificationType>, }
|
|
|
@ -1,3 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
|
|
||||||
export type NotificationType = "Follow" | "Mention" | "Reply" | "Renote" | "Quote" | "Reaction" | "PollVote" | "PollEnded" | "FollowRequest" | "FollowRequestAccepted" | "App";
|
|
|
@ -1,4 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
import type { PollChoice } from "./PollChoice";
|
|
||||||
|
|
||||||
export interface PollBase { expires_at: string | null, expired: boolean, multiple_choice: boolean, options: Array<PollChoice>, }
|
|
|
@ -1,3 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
|
|
||||||
export interface PollChoice { title: string, votes_count: number, voted: boolean | null, }
|
|
|
@ -1,4 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
import type { MmXml } from "./MmXml";
|
|
||||||
|
|
||||||
export interface ProfileField { name: string, value: string, value_mm: MmXml | null, verified_at: string | null, }
|
|
|
@ -1,3 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
|
|
||||||
export type Reaction = string | { name: string, host: string | null, url: string, } | { raw: string, };
|
|
|
@ -1,4 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
import type { Reaction } from "./Reaction";
|
|
||||||
|
|
||||||
export type ReactionPair = [Reaction, number] | [Reaction, number, boolean];
|
|
|
@ -1,3 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
|
|
||||||
export interface SecurityKeyBase { name: string, last_used_at: string | null, }
|
|
|
@ -1,3 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
|
|
||||||
export type SpeechTransform = "None" | "Cat";
|
|
|
@ -1,3 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
|
|
||||||
export interface UserAuthOverviewExt { has_two_factor_enabled: boolean, has_passwordless_login: boolean, has_security_keys: boolean, }
|
|
|
@ -1,8 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
import type { AvatarDecoration } from "./AvatarDecoration";
|
|
||||||
import type { EmojiContext } from "./EmojiContext";
|
|
||||||
import type { InstanceTicker } from "./InstanceTicker";
|
|
||||||
import type { MmXml } from "./MmXml";
|
|
||||||
import type { SpeechTransform } from "./SpeechTransform";
|
|
||||||
|
|
||||||
export interface UserBase { acct: string, username: string, display_name: string, display_name_mm: MmXml | null, host: string | null, speech_transform: SpeechTransform, created_at: string, avatar_url: string, avatar_blurhash: string | null, avatar_decoration: AvatarDecoration, is_admin: boolean, is_moderator: boolean, is_bot: boolean, emojis: EmojiContext, instance: InstanceTicker | null, }
|
|
|
@ -1,3 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
|
|
||||||
export interface UserByIdReq { profile?: boolean, pins?: boolean, detail?: boolean, relation?: boolean, auth?: boolean, }
|
|
|
@ -1,3 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
|
|
||||||
export interface UserDetailExt { last_fetched_at: string | null, uri: string | null, updated_at: string | null, }
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue