merge: remove Twitter preview

This commit is contained in:
Johann150 2022-08-18 14:25:14 +02:00
commit 5a6b183175
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1
21 changed files with 2 additions and 53 deletions

View file

@ -19,6 +19,7 @@ For older Misskey versions, see [CHANGELOG-OLD.md](./CHANGELOG-OLD.md).
### Removed ### Removed
- Okteto config and Helm chart - Okteto config and Helm chart
- Client: acrylic styling - Client: acrylic styling
- Client: Twitter embeds, the standard URL preview is used instead.
### Fixed ### Fixed
- Server: Blocking remote accounts - Server: Blocking remote accounts

View file

@ -531,7 +531,6 @@ poll: "استطلاع رأي"
useCw: "إخفاء المحتوى" useCw: "إخفاء المحتوى"
enablePlayer: "افتح مشغل الفيديو" enablePlayer: "افتح مشغل الفيديو"
disablePlayer: "أغلق مشغل الفيديو" disablePlayer: "أغلق مشغل الفيديو"
expandTweet: "وسّع التغريدة"
themeEditor: "مصمم القوالب" themeEditor: "مصمم القوالب"
description: "الوصف" description: "الوصف"
describeFile: "أضف تعليقًا توضيحيًا" describeFile: "أضف تعليقًا توضيحيًا"

View file

@ -549,7 +549,6 @@ poll: "জরিপ"
useCw: "কন্টেন্ট লুকান" useCw: "কন্টেন্ট লুকান"
enablePlayer: "ভিডিও প্লেয়ার খুলুন" enablePlayer: "ভিডিও প্লেয়ার খুলুন"
disablePlayer: "ভিডিও প্লেয়ার বন্ধ করুন" disablePlayer: "ভিডিও প্লেয়ার বন্ধ করুন"
expandTweet: "টুইট বিস্তারিত করুন"
themeEditor: "থিম সম্পাদক" themeEditor: "থিম সম্পাদক"
description: "বর্ণনা" description: "বর্ণনা"
describeFile: "ক্যাপশন যোগ করুন" describeFile: "ক্যাপশন যোগ করুন"

View file

@ -550,7 +550,6 @@ poll: "Umfrage"
useCw: "Inhaltswarnung verwenden" useCw: "Inhaltswarnung verwenden"
enablePlayer: "Video-Player öffnen" enablePlayer: "Video-Player öffnen"
disablePlayer: "Video-Player schließen" disablePlayer: "Video-Player schließen"
expandTweet: "Tweet ausklappen"
themeEditor: "Farbschema-Editor" themeEditor: "Farbschema-Editor"
description: "Beschreibung" description: "Beschreibung"
describeFile: "Beschreibung hinzufügen" describeFile: "Beschreibung hinzufügen"

View file

@ -550,7 +550,6 @@ poll: "Poll"
useCw: "Hide content" useCw: "Hide content"
enablePlayer: "Open video player" enablePlayer: "Open video player"
disablePlayer: "Close video player" disablePlayer: "Close video player"
expandTweet: "Expand tweet"
themeEditor: "Theme editor" themeEditor: "Theme editor"
description: "Description" description: "Description"
describeFile: "Add caption" describeFile: "Add caption"

View file

@ -549,7 +549,6 @@ poll: "Encuesta"
useCw: "Esconder contenidos" useCw: "Esconder contenidos"
enablePlayer: "Abrir reproductor" enablePlayer: "Abrir reproductor"
disablePlayer: "Cerrar reproductor" disablePlayer: "Cerrar reproductor"
expandTweet: "Expandir tweet"
themeEditor: "Editor de temas" themeEditor: "Editor de temas"
description: "Descripción" description: "Descripción"
describeFile: "Añade una descripción" describeFile: "Añade una descripción"

View file

@ -546,7 +546,6 @@ poll: "Sondage"
useCw: "Masquer le contenu" useCw: "Masquer le contenu"
enablePlayer: "Ouvrir dans le lecteur vidéo" enablePlayer: "Ouvrir dans le lecteur vidéo"
disablePlayer: "Fermer le lecteur vidéo" disablePlayer: "Fermer le lecteur vidéo"
expandTweet: "Étendre le tweet"
themeEditor: "Éditeur de thèmes" themeEditor: "Éditeur de thèmes"
description: "Description" description: "Description"
describeFile: "Ajouter une description d'image" describeFile: "Ajouter une description d'image"

View file

@ -549,7 +549,6 @@ poll: "Angket"
useCw: "Sembunyikan konten" useCw: "Sembunyikan konten"
enablePlayer: "Buka pemutar video" enablePlayer: "Buka pemutar video"
disablePlayer: "Tutup pemutar video" disablePlayer: "Tutup pemutar video"
expandTweet: "Perluas utas"
themeEditor: "Penyunting tema" themeEditor: "Penyunting tema"
description: "Deskripsi" description: "Deskripsi"
describeFile: "Tambahkan keterangan" describeFile: "Tambahkan keterangan"

View file

@ -545,7 +545,6 @@ poll: "Sondaggio"
useCw: "Nascondere media" useCw: "Nascondere media"
enablePlayer: "Apri in lettore video" enablePlayer: "Apri in lettore video"
disablePlayer: "Chiudi lettore video" disablePlayer: "Chiudi lettore video"
expandTweet: "Espandi tweet"
themeEditor: "Editor di temi" themeEditor: "Editor di temi"
description: "Descrizione" description: "Descrizione"
describeFile: "Aggiungi una descrizione d'immagine" describeFile: "Aggiungi una descrizione d'immagine"

View file

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

View file

@ -524,7 +524,6 @@ addedRelays: "追加済みのリレー"
poll: "アンケート" poll: "アンケート"
enablePlayer: "プレイヤーを開く" enablePlayer: "プレイヤーを開く"
disablePlayer: "プレイヤーを閉じる" disablePlayer: "プレイヤーを閉じる"
expandTweet: "ツイートを展開する"
themeEditor: "テーマエディター" themeEditor: "テーマエディター"
description: "説明" description: "説明"
author: "作者" author: "作者"

View file

@ -549,7 +549,6 @@ poll: "투표"
useCw: "내용 숨기기" useCw: "내용 숨기기"
enablePlayer: "플레이어 열기" enablePlayer: "플레이어 열기"
disablePlayer: "플레이어 닫기" disablePlayer: "플레이어 닫기"
expandTweet: "트윗 확장하기"
themeEditor: "테마 에디터" themeEditor: "테마 에디터"
description: "설명" description: "설명"
describeFile: "캡션 추가" describeFile: "캡션 추가"

View file

@ -536,7 +536,6 @@ poll: "Ankieta"
useCw: "Ukryj zawartość" useCw: "Ukryj zawartość"
enablePlayer: "Otwórz odtwarzacz wideo" enablePlayer: "Otwórz odtwarzacz wideo"
disablePlayer: "Zamknij odtwarzacz wideo" disablePlayer: "Zamknij odtwarzacz wideo"
expandTweet: "Rozwiń tweet"
themeEditor: "Edytor motywu" themeEditor: "Edytor motywu"
description: "Opis" description: "Opis"
describeFile: "dodaj podpis" describeFile: "dodaj podpis"

View file

@ -549,7 +549,6 @@ poll: "Sondaj"
useCw: "Ascunde conținutul" useCw: "Ascunde conținutul"
enablePlayer: "Deschide player-ul video" enablePlayer: "Deschide player-ul video"
disablePlayer: "Închide player-ul video" disablePlayer: "Închide player-ul video"
expandTweet: "Expandează tweet"
themeEditor: "Editor de teme" themeEditor: "Editor de teme"
description: "Descriere" description: "Descriere"
describeFile: "Adaugă titrări" describeFile: "Adaugă titrări"

View file

@ -549,7 +549,6 @@ poll: "Опрос"
useCw: "Скрывать содержимое под предупреждением" useCw: "Скрывать содержимое под предупреждением"
enablePlayer: "Включить проигрыватель" enablePlayer: "Включить проигрыватель"
disablePlayer: "Выключить проигрыватель" disablePlayer: "Выключить проигрыватель"
expandTweet: "Развернуть твит"
themeEditor: "Редактор темы оформления" themeEditor: "Редактор темы оформления"
description: "Описание" description: "Описание"
describeFile: "Добавить подпись" describeFile: "Добавить подпись"

View file

@ -549,7 +549,6 @@ poll: "Hlasovanie"
useCw: "Skryť obsah" useCw: "Skryť obsah"
enablePlayer: "Otvoriť video prehrávač" enablePlayer: "Otvoriť video prehrávač"
disablePlayer: "Zavrieť video prehrávač" disablePlayer: "Zavrieť video prehrávač"
expandTweet: "Rozšíriť tweet"
themeEditor: "Editor tém" themeEditor: "Editor tém"
description: "Popis" description: "Popis"
describeFile: "Pridať nadpis" describeFile: "Pridať nadpis"

View file

@ -549,7 +549,6 @@ poll: "Опитування"
useCw: "Приховати вміст" useCw: "Приховати вміст"
enablePlayer: "Відкрити відеоплеєр" enablePlayer: "Відкрити відеоплеєр"
disablePlayer: "Закрити відеоплеєр" disablePlayer: "Закрити відеоплеєр"
expandTweet: "Розгорнути твіт"
themeEditor: "Редактор тем" themeEditor: "Редактор тем"
description: "Опис" description: "Опис"
describeFile: "Додати підпис" describeFile: "Додати підпис"

View file

@ -549,7 +549,6 @@ poll: "Bình chọn"
useCw: "Ẩn nội dung" useCw: "Ẩn nội dung"
enablePlayer: "Mở trình phát video" enablePlayer: "Mở trình phát video"
disablePlayer: "Đóng trình phát video" disablePlayer: "Đóng trình phát video"
expandTweet: "Mở rộng tweet"
themeEditor: "Công cụ thiết kế theme" themeEditor: "Công cụ thiết kế theme"
description: "Mô tả" description: "Mô tả"
describeFile: "Thêm mô tả" describeFile: "Thêm mô tả"

View file

@ -549,7 +549,6 @@ poll: "调查问卷"
useCw: "隐藏内容" useCw: "隐藏内容"
enablePlayer: "打开播放器" enablePlayer: "打开播放器"
disablePlayer: "关闭播放器" disablePlayer: "关闭播放器"
expandTweet: "展开帖子"
themeEditor: "主题编辑器" themeEditor: "主题编辑器"
description: "描述" description: "描述"
describeFile: "添加标题" describeFile: "添加标题"

View file

@ -549,7 +549,6 @@ poll: "投票"
useCw: "隱藏內容" useCw: "隱藏內容"
enablePlayer: "打開播放器" enablePlayer: "打開播放器"
disablePlayer: "關閉播放器" disablePlayer: "關閉播放器"
expandTweet: "展開推文"
themeEditor: "主題編輯器" themeEditor: "主題編輯器"
description: "描述" description: "描述"
describeFile: "添加標題 " describeFile: "添加標題 "

View file

@ -3,9 +3,6 @@
<button class="disablePlayer" :title="i18n.ts.disablePlayer" @click="playerEnabled = false"><i class="fas fa-times"></i></button> <button class="disablePlayer" :title="i18n.ts.disablePlayer" @click="playerEnabled = false"><i class="fas fa-times"></i></button>
<iframe :src="player.url + (player.url.match(/\?/) ? '&autoplay=1&auto_play=1' : '?autoplay=1&auto_play=1')" :width="player.width || '100%'" :heigth="player.height || 250" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen/> <iframe :src="player.url + (player.url.match(/\?/) ? '&autoplay=1&auto_play=1' : '?autoplay=1&auto_play=1')" :width="player.width || '100%'" :heigth="player.height || 250" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen/>
</div> </div>
<div v-else-if="tweetId && tweetExpanded" ref="twitter" class="twitter">
<iframe ref="tweet" scrolling="no" frameborder="no" :style="{ position: 'relative', width: '100%', height: `${tweetHeight}px` }" :src="`https://platform.twitter.com/embed/index.html?embedId=${embedId}&amp;hideCard=false&amp;hideThread=false&amp;lang=en&amp;theme=${$store.state.darkMode ? 'dark' : 'light'}&amp;id=${tweetId}`"></iframe>
</div>
<div v-else v-size="{ max: [400, 350] }" class="mk-url-preview"> <div v-else v-size="{ max: [400, 350] }" class="mk-url-preview">
<transition :name="$store.state.animation ? 'zoom' : ''" mode="out-in"> <transition :name="$store.state.animation ? 'zoom' : ''" mode="out-in">
<component :is="self ? 'MkA' : 'a'" v-if="!fetching" :class="{ compact }" :[attr]="self ? url.substr(local.length) : url" rel="nofollow noopener" :target="target" :title="url"> <component :is="self ? 'MkA' : 'a'" v-if="!fetching" :class="{ compact }" :[attr]="self ? url.substr(local.length) : url" rel="nofollow noopener" :target="target" :title="url">
@ -24,16 +21,10 @@
</article> </article>
</component> </component>
</transition> </transition>
<div v-if="tweetId" class="expandTweet">
<a @click="tweetExpanded = true">
<i class="fab fa-twitter"></i> {{ i18n.ts.expandTweet }}
</a>
</div>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onUnmounted } from 'vue';
import { url as local, lang } from '@/config'; import { url as local, lang } from '@/config';
import { i18n } from '@/i18n'; import { i18n } from '@/i18n';
@ -61,23 +52,14 @@ let player = $ref({
height: null, height: null,
}); });
let playerEnabled = $ref(false); let playerEnabled = $ref(false);
let tweetId = $ref<string | null>(null);
let tweetExpanded = $ref(props.detail);
const embedId = `embed${Math.random().toString().replace(/\D/,'')}`;
let tweetHeight = $ref(150);
const requestUrl = new URL(props.url); const requestUrl = new URL(props.url);
if (requestUrl.hostname === 'twitter.com') {
const m = requestUrl.pathname.match(/^\/.+\/status(?:es)?\/(\d+)/);
if (m) tweetId = m[1];
}
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';
} }
const requestLang = (lang || 'ja-JP').replace('ja-KS', 'ja-JP'); const requestLang = lang || 'en-US';
requestUrl.hash = ''; requestUrl.hash = '';
@ -93,21 +75,6 @@ fetch(`/url?url=${encodeURIComponent(requestUrl.href)}&lang=${requestLang}`).the
player = info.player; player = info.player;
}); });
}); });
function adjustTweetHeight(message: any) {
if (message.origin !== 'https://platform.twitter.com') return;
const embed = message.data?.['twttr.embed'];
if (embed?.method !== 'twttr.private.resize') return;
if (embed?.id !== embedId) return;
const height = embed?.params[0]?.height;
if (height) tweetHeight = height;
}
(window as any).addEventListener('message', adjustTweetHeight);
onUnmounted(() => {
(window as any).removeEventListener('message', adjustTweetHeight);
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>