Compare commits

...

15 Commits

Author SHA1 Message Date
かっこかり 8831b7b56a
Merge 662bfd64bb into 4603ab67bb 2024-11-21 02:02:09 +09:00
鴇峰 朔華 4603ab67bb
feat: 絵文字のポップアップメニューに編集を追加 (#15004)
* Mod: 絵文字のポップアップメニューに編集を追加

* fix: code styleの修正

* fix: code styleの修正

* fix
2024-11-20 20:08:26 +09:00
かっこかり 662bfd64bb
Merge branch 'develop' into feat-14931 2024-11-19 10:42:39 +09:00
kakkokari-gtyih 36199b6532 Merge branch 'feat-14931' of https://github.com/kakkokari-gtyih/misskey into feat-14931 2024-11-19 09:09:18 +09:00
kakkokari-gtyih 23610e8c32 unify postHeight 2024-11-19 09:09:15 +09:00
かっこかり 5fbe273998
Merge branch 'develop' into feat-14931 2024-11-18 22:47:27 +09:00
かっこかり eaaeeb1018
Update MkUrlPreview.vue 2024-11-18 20:31:48 +09:00
kakkokari-gtyih 6df2a74747 fix 2024-11-17 11:54:27 +09:00
kakkokari-gtyih 438cb63303 unify *postExpanded 2024-11-17 10:44:59 +09:00
Kagami Sascha Rosylight 8e01cc12b5
Merge branch 'develop' into feat-14931 2024-11-16 19:23:03 +01:00
かっこかり a132b9831d
Merge branch 'develop' into feat-14931 2024-11-15 21:01:44 +09:00
かっこかり 558b62ef76
Merge branch 'develop' into feat-14931 2024-11-13 11:55:12 +09:00
かっこかり 161e212aee
Merge branch 'develop' into feat-14931 2024-11-11 17:26:05 +09:00
kakkokari-gtyih 9bd7af57e3 Update Changelog 2024-11-10 16:28:00 +09:00
kakkokari-gtyih 2ebe003b93 enhance(frontend): blueskyの投稿埋め込み表示に対応 2024-11-10 16:27:36 +09:00
7 changed files with 139 additions and 26 deletions

View File

@ -30,6 +30,7 @@
(Based on https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/663) (Based on https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/663)
- Enhance: サイドバーを簡単に展開・折りたたみできるように ( #14981 ) - Enhance: サイドバーを簡単に展開・折りたたみできるように ( #14981 )
- Enhance: リノートメニューに「リノートの詳細」を追加 - Enhance: リノートメニューに「リノートの詳細」を追加
- Enhance: Blueskyの投稿埋め込みプレビューに対応
- Fix: 通知の範囲指定の設定項目が必要ない通知設定でも範囲指定の設定がでている問題を修正 - Fix: 通知の範囲指定の設定項目が必要ない通知設定でも範囲指定の設定がでている問題を修正
- Fix: Turnstileが失敗・期限切れした際にも成功扱いとなってしまう問題を修正 - Fix: Turnstileが失敗・期限切れした際にも成功扱いとなってしまう問題を修正
(Cherry-picked from https://github.com/MisskeyIO/misskey/pull/768) (Cherry-picked from https://github.com/MisskeyIO/misskey/pull/768)

2
locales/index.d.ts vendored
View File

@ -2585,7 +2585,7 @@ export interface Locale extends ILocale {
/** /**
* *
*/ */
"expandTweet": string; "expandPost": string;
/** /**
* *
*/ */

View File

@ -641,7 +641,7 @@ poll: "アンケート"
useCw: "内容を隠す" useCw: "内容を隠す"
enablePlayer: "プレイヤーを開く" enablePlayer: "プレイヤーを開く"
disablePlayer: "プレイヤーを閉じる" disablePlayer: "プレイヤーを閉じる"
expandTweet: "ポストを展開する" expandPost: "ポストを展開する"
themeEditor: "テーマエディター" themeEditor: "テーマエディター"
description: "説明" description: "説明"
describeFile: "キャプションを付ける" describeFile: "キャプションを付ける"

View File

@ -26,14 +26,13 @@ SPDX-License-Identifier: AGPL-3.0-only
</MkButton> </MkButton>
</div> </div>
</template> </template>
<template v-else-if="tweetId && tweetExpanded"> <template v-else-if="tweetId && postExpanded">
<div ref="twitter"> <div>
<iframe <iframe
ref="tweet"
allow="fullscreen;web-share" allow="fullscreen;web-share"
sandbox="allow-popups allow-popups-to-escape-sandbox allow-scripts allow-same-origin" sandbox="allow-popups allow-popups-to-escape-sandbox allow-scripts allow-same-origin"
scrolling="no" scrolling="no"
:style="{ position: 'relative', width: '100%', height: `${tweetHeight}px`, border: 0 }" :style="{ position: 'relative', width: '100%', height: `${postHeight}px`, border: 0 }"
:src="`https://platform.twitter.com/embed/index.html?embedId=${embedId}&amp;hideCard=false&amp;hideThread=false&amp;lang=en&amp;theme=${defaultStore.state.darkMode ? 'dark' : 'light'}&amp;id=${tweetId}`" :src="`https://platform.twitter.com/embed/index.html?embedId=${embedId}&amp;hideCard=false&amp;hideThread=false&amp;lang=en&amp;theme=${defaultStore.state.darkMode ? 'dark' : 'light'}&amp;id=${tweetId}`"
></iframe> ></iframe>
</div> </div>
@ -43,6 +42,22 @@ SPDX-License-Identifier: AGPL-3.0-only
</MkButton> </MkButton>
</div> </div>
</template> </template>
<template v-else-if="bskyDid && bskyPostRecordKey && postExpanded">
<div>
<iframe
allow="fullscreen;web-share"
sandbox="allow-popups allow-popups-to-escape-sandbox allow-scripts allow-same-origin"
scrolling="no"
:style="{ position: 'relative', width: '100%', height: `${postHeight}px`, border: 0 }"
:src="`https://embed.bsky.app/embed/${bskyDid}/app.bsky.feed.post/${bskyPostRecordKey}?id=${embedId}`"
></iframe>
</div>
<div :class="$style.action">
<MkButton :small="true" inline @click="postExpanded = false">
<i class="ti ti-x"></i> {{ i18n.ts.close }}
</MkButton>
</div>
</template>
<div v-else> <div v-else>
<component :is="self ? 'MkA' : 'a'" :class="[$style.link, { [$style.compact]: compact }]" :[attr]="self ? url.substring(local.length) : url" rel="nofollow noopener" :target="target" :title="url"> <component :is="self ? 'MkA' : 'a'" :class="[$style.link, { [$style.compact]: compact }]" :[attr]="self ? url.substring(local.length) : url" rel="nofollow noopener" :target="target" :title="url">
<div v-if="thumbnail && !sensitive" :class="$style.thumbnail" :style="defaultStore.state.dataSaver.urlPreview ? '' : `background-image: url('${thumbnail}')`"> <div v-if="thumbnail && !sensitive" :class="$style.thumbnail" :style="defaultStore.state.dataSaver.urlPreview ? '' : `background-image: url('${thumbnail}')`">
@ -66,8 +81,13 @@ SPDX-License-Identifier: AGPL-3.0-only
</component> </component>
<template v-if="showActions"> <template v-if="showActions">
<div v-if="tweetId" :class="$style.action"> <div v-if="tweetId" :class="$style.action">
<MkButton :small="true" inline @click="tweetExpanded = true"> <MkButton :small="true" inline @click="postExpanded = true">
<i class="ti ti-brand-x"></i> {{ i18n.ts.expandTweet }} <i class="ti ti-brand-x"></i> {{ i18n.ts.expandPost }}
</MkButton>
</div>
<div v-if="bskyPostRecordKey" :class="$style.action">
<MkButton :small="true" inline @click="openBskyEmbed">
<i class="ti ti-brand-bluesky"></i> {{ i18n.ts.expandPost }}
</MkButton> </MkButton>
</div> </div>
<div v-if="!playerEnabled && player.url" :class="$style.action"> <div v-if="!playerEnabled && player.url" :class="$style.action">
@ -126,10 +146,17 @@ const player = ref({
height: null, height: null,
} as SummalyResult['player']); } as SummalyResult['player']);
const playerEnabled = ref(false); const playerEnabled = ref(false);
const tweetId = ref<string | null>(null);
const tweetExpanded = ref(props.detail);
const embedId = `embed${Math.random().toString().replace(/\D/, '')}`; const embedId = `embed${Math.random().toString().replace(/\D/, '')}`;
const tweetHeight = ref(150); const postExpanded = ref(props.detail);
const postHeight = ref(150);
const tweetId = ref<string | null>(null);
const bskyHandleOrDid = ref<string | null>(null);
const bskyDid = ref<string | null>(null);
const bskyPostRecordKey = ref<string | null>(null);
const unknownUrl = ref(false); const unknownUrl = ref(false);
onDeactivated(() => { onDeactivated(() => {
@ -144,6 +171,19 @@ if (requestUrl.hostname === 'twitter.com' || requestUrl.hostname === 'mobile.twi
if (m) tweetId.value = m[1]; if (m) tweetId.value = m[1];
} }
if (requestUrl.hostname === 'bsky.app') {
const bskyPostPageUrl = requestUrl.pathname.slice(1).split('/');
if (bskyPostPageUrl[0] === 'profile' && bskyPostPageUrl[1] && bskyPostPageUrl[2] === 'post' && bskyPostPageUrl[3]) {
bskyHandleOrDid.value = bskyPostPageUrl[1];
bskyPostRecordKey.value = bskyPostPageUrl[3];
if (postExpanded.value) {
openBskyEmbed();
}
}
}
if (requestUrl.hostname === 'music.youtube.com' && requestUrl.pathname.match('^/(?:watch|channel)')) { if (requestUrl.hostname === 'music.youtube.com' && requestUrl.pathname.match('^/(?:watch|channel)')) {
requestUrl.hostname = 'www.youtube.com'; requestUrl.hostname = 'www.youtube.com';
} }
@ -180,13 +220,23 @@ window.fetch(`/url?url=${encodeURIComponent(requestUrl.href)}&lang=${versatileLa
sensitive.value = info.sensitive ?? false; sensitive.value = info.sensitive ?? false;
}); });
function adjustTweetHeight(message: MessageEvent) { async function openBskyEmbed() {
if (message.origin !== 'https://platform.twitter.com') return; if (bskyHandleOrDid.value == null || bskyPostRecordKey.value == null) return;
const embed = message.data?.['twttr.embed'];
if (embed?.method !== 'twttr.private.resize') return; if (bskyDid.value == null) {
if (embed?.id !== embedId) return; if (bskyHandleOrDid.value.startsWith('did:')) {
const height = embed?.params[0]?.height; bskyDid.value = bskyHandleOrDid.value;
if (height) tweetHeight.value = height; } else {
// handledid
const bskyApiRes = await window.fetch(`https://public.api.bsky.app/xrpc/com.atproto.identity.resolveHandle?handle=${bskyHandleOrDid.value}`);
if (bskyApiRes.ok) {
const bskyApiData = await bskyApiRes.json() as { did: string };
bskyDid.value = bskyApiData.did;
}
}
}
postExpanded.value = true;
} }
function openPlayer(): void { function openPlayer(): void {
@ -199,10 +249,25 @@ function openPlayer(): void {
}); });
} }
window.addEventListener('message', adjustTweetHeight); function adjustSocialsEmbedHeight(message: MessageEvent) {
if (message.origin === 'https://platform.twitter.com') {
const embed = message.data?.['twttr.embed'];
if (embed?.method === 'twttr.private.resize' && embed?.id === embedId) {
const height = embed?.params[0]?.height;
if (height) postHeight.value = height;
}
} else if (message.origin === 'https://embed.bsky.app') {
if (message.data?.id === embedId) {
const height = message.data?.height;
if (height) postHeight.value = height;
}
}
}
window.addEventListener('message', adjustSocialsEmbedHeight);
onUnmounted(() => { onUnmounted(() => {
window.removeEventListener('message', adjustTweetHeight); window.removeEventListener('message', adjustSocialsEmbedHeight);
}); });
</script> </script>

View File

@ -25,17 +25,18 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, inject, ref } from 'vue'; import { computed, defineAsyncComponent, inject, ref } from 'vue';
import type { MenuItem } from '@/types/menu.js';
import { getProxiedImageUrl, getStaticImageUrl } from '@/scripts/media-proxy.js'; import { getProxiedImageUrl, getStaticImageUrl } from '@/scripts/media-proxy.js';
import { defaultStore } from '@/store.js'; import { defaultStore } from '@/store.js';
import { customEmojisMap } from '@/custom-emojis.js'; import { customEmojisMap } from '@/custom-emojis.js';
import * as os from '@/os.js'; import * as os from '@/os.js';
import { misskeyApiGet } from '@/scripts/misskey-api.js'; import { misskeyApi, misskeyApiGet } from '@/scripts/misskey-api.js';
import { copyToClipboard } from '@/scripts/copy-to-clipboard.js'; import { copyToClipboard } from '@/scripts/copy-to-clipboard.js';
import * as sound from '@/scripts/sound.js'; import * as sound from '@/scripts/sound.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import MkCustomEmojiDetailedDialog from '@/components/MkCustomEmojiDetailedDialog.vue'; import MkCustomEmojiDetailedDialog from '@/components/MkCustomEmojiDetailedDialog.vue';
import type { MenuItem } from '@/types/menu.js'; import { $i } from '@/account.js';
const props = defineProps<{ const props = defineProps<{
name: string; name: string;
@ -125,9 +126,31 @@ function onClick(ev: MouseEvent) {
}, },
}); });
if ($i?.isModerator ?? $i?.isAdmin) {
menuItems.push({
text: i18n.ts.edit,
icon: 'ti ti-pencil',
action: async () => {
await edit(props.name);
},
});
}
os.popupMenu(menuItems, ev.currentTarget ?? ev.target); os.popupMenu(menuItems, ev.currentTarget ?? ev.target);
} }
} }
async function edit(name: string) {
const emoji = await misskeyApi('emoji', {
name: name,
});
const { dispose } = os.popup(defineAsyncComponent(() => import('@/pages/emoji-edit-dialog.vue')), {
emoji: emoji,
}, {
closed: () => dispose(),
});
}
</script> </script>
<style lang="scss" module> <style lang="scss" module>

View File

@ -22,7 +22,7 @@
style-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline';
img-src 'self' data: blob: www.google.com xn--931a.moe localhost:3000 localhost:5173 127.0.0.1:5173 127.0.0.1:3000; img-src 'self' data: blob: www.google.com xn--931a.moe localhost:3000 localhost:5173 127.0.0.1:5173 127.0.0.1:3000;
media-src 'self' localhost:3000 localhost:5173 127.0.0.1:5173 127.0.0.1:3000; media-src 'self' localhost:3000 localhost:5173 127.0.0.1:5173 127.0.0.1:3000;
connect-src 'self' localhost:3000 localhost:5173 127.0.0.1:5173 127.0.0.1:3000 https://newassets.hcaptcha.com; connect-src 'self' localhost:3000 localhost:5173 127.0.0.1:5173 127.0.0.1:3000 https://newassets.hcaptcha.com https://public.api.bsky.app;
frame-src *;" frame-src *;"
/> />
<meta property="og:site_name" content="[DEV BUILD] Misskey" /> <meta property="og:site_name" content="[DEV BUILD] Misskey" />

View File

@ -15,18 +15,22 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import { defineAsyncComponent } from 'vue';
import type { MenuItem } from '@/types/menu.js';
import * as os from '@/os.js'; import * as os from '@/os.js';
import { misskeyApiGet } from '@/scripts/misskey-api.js'; import { misskeyApiGet } from '@/scripts/misskey-api.js';
import { copyToClipboard } from '@/scripts/copy-to-clipboard.js'; import { copyToClipboard } from '@/scripts/copy-to-clipboard.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import MkCustomEmojiDetailedDialog from '@/components/MkCustomEmojiDetailedDialog.vue'; import MkCustomEmojiDetailedDialog from '@/components/MkCustomEmojiDetailedDialog.vue';
import { $i } from '@/account.js';
const props = defineProps<{ const props = defineProps<{
emoji: Misskey.entities.EmojiSimple; emoji: Misskey.entities.EmojiSimple;
}>(); }>();
function menu(ev) { function menu(ev) {
os.popupMenu([{ const menuItems: MenuItem[] = [];
menuItems.push({
type: 'label', type: 'label',
text: ':' + props.emoji.name + ':', text: ':' + props.emoji.name + ':',
}, { }, {
@ -48,8 +52,28 @@ function menu(ev) {
closed: () => dispose(), closed: () => dispose(),
}); });
}, },
}], ev.currentTarget ?? ev.target); });
if ($i?.isModerator ?? $i?.isAdmin) {
menuItems.push({
text: i18n.ts.edit,
icon: 'ti ti-pencil',
action: () => {
edit(props.emoji);
},
});
}
os.popupMenu(menuItems, ev.currentTarget ?? ev.target);
} }
const edit = async (emoji) => {
const { dispose } = os.popup(defineAsyncComponent(() => import('@/pages/emoji-edit-dialog.vue')), {
emoji: emoji,
}, {
closed: () => dispose(),
});
};
</script> </script>
<style lang="scss" module> <style lang="scss" module>