🗑️ Remove embed widgets
This commit is contained in:
parent
f52d9b6052
commit
e89161df53
@ -1,131 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="mt-3 mb-4.5 mx-[2.5ch] flex flex-row gap-4 items-center">
|
||||
<v-avatar :image="attachment.account?.avatar" />
|
||||
<div class="flex flex-col">
|
||||
<span class="text-xs">Uploaded by</span>
|
||||
<span>{{ attachment.account?.nick }} <span class="text-xs">@{{ attachment.account?.name }}</span></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2 class="section-header">Preview</h2>
|
||||
<v-card class="mb-5">
|
||||
<attachment-renderer :item="attachment" />
|
||||
</v-card>
|
||||
|
||||
<h2 class="section-header">Metadata</h2>
|
||||
<v-card class="mb-5">
|
||||
<v-card-text class="flex flex-col gap-4">
|
||||
<div class="flex flex-col" v-if="attachment?.alt">
|
||||
<span class="text-xs font-bold">Alternative</span>
|
||||
<span class="text-truncate">{{ attachment?.alt }}</span>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<span class="text-xs font-bold">Original File Name</span>
|
||||
<span class="text-truncate">{{ attachment?.name }}</span>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<span class="text-xs font-bold">Size</span>
|
||||
<span>{{ formatBytes(attachment?.size) }}</span>
|
||||
</div>
|
||||
<div class="flex flex-col" v-if="attachment?.metadata?.ratio">
|
||||
<span class="text-xs font-bold">Aspect Ratio</span>
|
||||
<span>
|
||||
{{ attachment?.metadata?.width }}x{{ attachment?.metadata?.height }}
|
||||
{{ attachment?.metadata?.ratio.toFixed(2) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="flex flex-col" v-if="attachment?.mimetype">
|
||||
<span class="text-xs font-bold">Mimetype</span>
|
||||
<span>{{ attachment?.mimetype }}</span>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<span class="text-xs font-bold">Raw Data</span>
|
||||
<v-code class="font-mono mt-1">{{ JSON.stringify(attachment.metadata, null, 4) }}</v-code>
|
||||
</div>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
|
||||
<div class="text-xs text-grey flex flex-col mx-[2.5ch]">
|
||||
<span>Solar Network Attachment Web Preview</span>
|
||||
<span>Powered by <a class="underline" target="_blank" href="https://git.solsynth.dev/Hydrogen/Paperclip">Hydrogen.Paperclip</a></span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
definePageMeta({
|
||||
layout: "embed",
|
||||
})
|
||||
|
||||
const route = useRoute()
|
||||
const config = useRuntimeConfig()
|
||||
|
||||
const firstImage = ref<string | null>()
|
||||
const firstVideo = ref<string | null>()
|
||||
|
||||
const { data: attachment } = await useFetch<any>(`${config.public.solarNetworkApi}/cgi/uc/attachments/${route.params.id}/meta`)
|
||||
|
||||
if (!attachment.value) {
|
||||
throw createError({
|
||||
statusCode: 404,
|
||||
statusMessage: "Attachment Not Found",
|
||||
})
|
||||
}
|
||||
|
||||
const title = computed(() => `Attachment from ${attachment.value.account.nick}`)
|
||||
|
||||
watch(attachment, (value) => {
|
||||
if (value.mimetype.split("/")[0] == "image") {
|
||||
firstImage.value = `${config.public.solarNetworkApi}/cgi/uc/attachments/${value.id}`
|
||||
}
|
||||
|
||||
if (value.mimetype.split("/")[0] == "video") {
|
||||
firstVideo.value = `${config.public.solarNetworkApi}/cgi/uc/attachments/${value.id}`
|
||||
}
|
||||
}, { immediate: true, deep: true })
|
||||
|
||||
useHead({
|
||||
title: title.value,
|
||||
titleTemplate: "%s on Solar Network",
|
||||
link: [
|
||||
{ rel: "icon", type: "image/png", href: "/icon-solar-network.png" },
|
||||
{ rel: "apple-touch-icon", type: "image/png", href: "/icon-solar-network.png" },
|
||||
],
|
||||
})
|
||||
|
||||
useSeoMeta({
|
||||
author: attachment.value?.account.nick,
|
||||
title: title,
|
||||
description: attachment.value?.alt,
|
||||
ogTitle: title,
|
||||
ogDescription: attachment.value?.alt,
|
||||
ogUrl: `${useRuntimeConfig().public.siteUrl}${route.fullPath}`,
|
||||
ogImage: firstImage,
|
||||
ogVideo: firstVideo,
|
||||
publisher: "Solar Network",
|
||||
ogSiteName: "Solsynth Capital",
|
||||
})
|
||||
|
||||
function formatBytes(bytes: number, decimals = 2) {
|
||||
if (!+bytes) return "0 Bytes"
|
||||
|
||||
const k = 1024
|
||||
const dm = decimals < 0 ? 0 : decimals
|
||||
const sizes = ["Bytes", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"]
|
||||
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(k))
|
||||
|
||||
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.section-header {
|
||||
margin-left: 2.5ch;
|
||||
margin-right: 2.5ch;
|
||||
margin-bottom: 8px;
|
||||
|
||||
@apply text-lg;
|
||||
}
|
||||
</style>
|
@ -1,58 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="mt-3 mb-6.5 mx-[3.5ch] text-center">
|
||||
<h1 class="text-2xl">{{ t("navGallery") }}</h1>
|
||||
<span>{{ t("navGalleryCaption") }}</span>
|
||||
</div>
|
||||
|
||||
<div class="album">
|
||||
<v-card v-for="item in items" class="album-item mb-3" :to="`/gallery/${item.rid}`">
|
||||
<attachment-renderer :item="item" />
|
||||
</v-card>
|
||||
|
||||
<div class="flex p-5 justify-center items-center">
|
||||
<v-btn variant="outlined" text="Load more" :loading="loading" @click="load" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
definePageMeta({
|
||||
layout: "embed",
|
||||
})
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
useHead({
|
||||
title: t("navGallery"),
|
||||
})
|
||||
|
||||
useSeoMeta({
|
||||
title: t("navGallery"),
|
||||
ogTitle: t("navGallery"),
|
||||
description: t("navGalleryCaption"),
|
||||
ogDescription: t("navGalleryCaption"),
|
||||
ogType: "website",
|
||||
})
|
||||
|
||||
const config = useRuntimeConfig()
|
||||
|
||||
const items = ref<any[]>([])
|
||||
const loading = ref(false)
|
||||
|
||||
async function load() {
|
||||
loading.value = true
|
||||
|
||||
const res = await fetch(`${config.public.solarNetworkApi}/cgi/uc/attachments?take=20&offset=${items.value.length}&original=true`)
|
||||
const result = await res.json()
|
||||
|
||||
items.value.push(...result.data)
|
||||
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
load()
|
||||
})
|
||||
</script>
|
@ -1,152 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="my-3 flex flex-row gap-4">
|
||||
<v-avatar :image="post.author?.avatar" />
|
||||
<div class="flex flex-col">
|
||||
<span>{{ post.author?.nick }} <span class="text-xs">@{{ post.author?.name }}</span></span>
|
||||
<span v-if="post.body?.title" class="text-md">{{ post.body?.title }}</span>
|
||||
<span v-if="post.body?.description" class="text-sm">{{ post.body?.description }}</span>
|
||||
<span v-if="!post.body?.title && !post.body?.description" class="text-sm">{{ post.author?.description }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<v-card v-if="post.body?.thumbnail" class="mb-5">
|
||||
<v-img
|
||||
:src="`${config.public.solarNetworkApi}/cgi/uc/attachments/${post.body?.thumbnail}`"
|
||||
:aspect-ratio="16 / 9"
|
||||
cover
|
||||
/>
|
||||
</v-card>
|
||||
|
||||
<article class="text-base prose xl:text-lg mx-auto max-w-none">
|
||||
<m-d-c :value="post.body?.content"></m-d-c>
|
||||
</article>
|
||||
|
||||
<v-card v-if="post.body?.attachments?.length > 0" class="mb-5">
|
||||
<attachment-carousel :attachments="post.body?.attachments" @update:metadata="args => attachments = args" />
|
||||
</v-card>
|
||||
|
||||
<div class="mb-3 text-sm flex flex-col">
|
||||
<span class="flex flex-row gap-1">
|
||||
<span>
|
||||
{{ post.metric.reply_count }} {{ post.metric.reply_count > 1 ? "replies" : "reply" }},
|
||||
</span>
|
||||
<span>
|
||||
{{ post.metric.reaction_count }} {{ post.metric.reaction_count > 1 ? "reactions" : "reaction" }}
|
||||
</span>
|
||||
</span>
|
||||
<span>
|
||||
{{ post.type.startsWith("a") ? "An" : "A" }} {{ post.type }} posted on
|
||||
{{ new Date(post.published_at).toLocaleString() }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="post.tags?.length > 0"
|
||||
class="text-xs text-grey flex flex-row gap-1 mb-3"
|
||||
>
|
||||
<nuxt-link
|
||||
v-for="tag in post.tags"
|
||||
:to="`/posts/tags/${tag.alias}`"
|
||||
class="hover:underline hover:underline-dotted"
|
||||
@click.stop
|
||||
>
|
||||
#{{ tag.alias }}
|
||||
</nuxt-link>
|
||||
</div>
|
||||
|
||||
<div class="text-xs text-grey flex flex-col mb-5">
|
||||
<span>Solar Network Post Web Preview</span>
|
||||
<span>To get full view of this post, open it on <a class="underline" :href="externalOpenLink">Solian</a></span>
|
||||
</div>
|
||||
|
||||
<div v-if="post.metric.reply_count" class="mb-5">
|
||||
<v-card variant="outlined" :title="t('postReplies')" :subtitle="t('postRepliesCaption')">
|
||||
<post-reply-list class="mt-[-20px] mx-[-1ch] mb-3" :post-id="post.id" />
|
||||
</v-card>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
definePageMeta({
|
||||
layout: "embed",
|
||||
alias: ["/embed/posts/:area/:id"],
|
||||
})
|
||||
|
||||
const route = useRoute()
|
||||
const config = useRuntimeConfig()
|
||||
|
||||
const attachments = ref<any[]>([])
|
||||
const firstImage = ref<string | null>()
|
||||
const firstVideo = ref<string | null>()
|
||||
|
||||
const slug = computed(() => {
|
||||
if (route.params.area) {
|
||||
return `${route.params.area}:${route.params.id}`
|
||||
} else {
|
||||
return route.params.id
|
||||
}
|
||||
})
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
const { data: post } = await useFetch<any>(`${config.public.solarNetworkApi}/cgi/co/posts/${slug.value}`)
|
||||
|
||||
if (!post.value) {
|
||||
const { data: publisher } = await $fetch<any>(`${config.public.solarNetworkApi}/cgi/co/publishers/${route.params.id}`)
|
||||
if (publisher) {
|
||||
navigateTo(`/posts/publishers/${route.params.id}`)
|
||||
}
|
||||
|
||||
throw createError({
|
||||
statusCode: 404,
|
||||
statusMessage: "Post Not Found",
|
||||
})
|
||||
} else if (post.value.alias && !route.params.area) {
|
||||
navigateTo(`/posts/${post.value.area_alias}/${post.value.alias}`)
|
||||
}
|
||||
|
||||
const title = computed(() => post.value.body?.title ? `${post.value.body?.title} from ${post.value.author.nick}` : `Post from ${post.value.author.nick}`)
|
||||
const description = computed(() => post.value.body?.description ?? post.value.body?.content.substring(0, 160).trim())
|
||||
|
||||
watch(attachments, (value) => {
|
||||
if (post.value.body?.thumbnail) {
|
||||
firstImage.value = `${config.public.solarNetworkApi}/cgi/uc/attachments/${post.value.body?.thumbnail}`
|
||||
}
|
||||
if (value.length > 0 && value[0].mimetype.split("/")[0] == "image") {
|
||||
firstImage.value = `${config.public.solarNetworkApi}/cgi/uc/attachments/${attachments.value[0].rid}`
|
||||
}
|
||||
|
||||
if (value.length > 0 && value[0].mimetype.split("/")[0] == "video") {
|
||||
firstVideo.value = `${config.public.solarNetworkApi}/cgi/uc/attachments/${attachments.value[0].rid}`
|
||||
}
|
||||
}, { immediate: true, deep: true })
|
||||
|
||||
useHead({
|
||||
title: title.value,
|
||||
titleTemplate: "%s on Solar Network",
|
||||
link: [
|
||||
{ rel: "icon", type: "image/png", href: "/icon-solar-network.png" },
|
||||
{ rel: "apple-touch-icon", type: "image/png", href: "/icon-solar-network.png" },
|
||||
],
|
||||
})
|
||||
|
||||
useSeoMeta({
|
||||
author: post.value.author.nick,
|
||||
title: title,
|
||||
articlePublishedTime: post.value.publishedAt,
|
||||
description: description,
|
||||
ogTitle: title,
|
||||
ogDescription: description,
|
||||
ogUrl: `${useRuntimeConfig().public.siteUrl}${route.fullPath}`,
|
||||
ogImage: firstImage,
|
||||
ogVideo: firstVideo,
|
||||
ogType: "article",
|
||||
publisher: "Solar Network",
|
||||
ogSiteName: "Solsynth Capital",
|
||||
generator: "Solar Network Open Project · Embed Widget",
|
||||
})
|
||||
|
||||
const externalOpenLink = computed(() => `${config.public.solianUrl}/posts/view/${slug.value}`)
|
||||
</script>
|
@ -1,32 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="my-3" v-if="!route.query['no-title']">
|
||||
<h1 class="text-2xl">{{ route.query["title"] ?? t("navPosts") }}</h1>
|
||||
<span>{{ route.query["caption"] ?? t("navPostsCaptionWithCategory", [`#${route.params.slug}`]) }}</span>
|
||||
</div>
|
||||
|
||||
<post-list class="mx-[-2.5ch]" :category="route.params.slug?.toString()" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
definePageMeta({
|
||||
layout: "embed",
|
||||
})
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
useHead({
|
||||
title: t("navPosts"),
|
||||
})
|
||||
|
||||
useSeoMeta({
|
||||
title: t("navPosts"),
|
||||
ogTitle: t("navPosts"),
|
||||
description: t("navPostsCaption"),
|
||||
ogDescription: t("navPostsCaption"),
|
||||
ogType: "website",
|
||||
})
|
||||
</script>
|
@ -1,32 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="my-3" v-if="!route.query['no-title']">
|
||||
<h1 class="text-2xl">{{ route.query["title"] ?? t("navPosts") }}</h1>
|
||||
<span>{{ route.query["caption"] ?? t("navPostsCaption") }}</span>
|
||||
</div>
|
||||
|
||||
<post-list class="mx-[-2.5ch]" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
definePageMeta({
|
||||
layout: "embed",
|
||||
})
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
useHead({
|
||||
title: t("navPosts"),
|
||||
})
|
||||
|
||||
useSeoMeta({
|
||||
title: t("navPosts"),
|
||||
ogTitle: t("navPosts"),
|
||||
description: t("navPostsCaption"),
|
||||
ogDescription: t("navPostsCaption"),
|
||||
ogType: "website",
|
||||
})
|
||||
</script>
|
@ -1,36 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="my-3" v-if="!route.query['no-title']">
|
||||
<h1 class="text-2xl">{{ route.query["title"] ?? t("navPosts") }}</h1>
|
||||
<span>{{ route.query["caption"] ?? t("navPostsCaptionWithPublisher", [publisher.data.name]) }}</span>
|
||||
</div>
|
||||
|
||||
<post-list v-if="publisher.type == 'realm'" class="mx-[-2.5ch]" :realm="route.params.id?.toString()" />
|
||||
<post-list v-else class="mx-[-2.5ch]" :author="route.params.id?.toString()" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
definePageMeta({
|
||||
layout: "embed",
|
||||
})
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
const route = useRoute()
|
||||
const config = useRuntimeConfig()
|
||||
|
||||
const { data: publisher } = useFetch<any>(`${config.public.solarNetworkApi}/cgi/co/publishers/${route.params.id}`)
|
||||
|
||||
useHead({
|
||||
title: t("navPosts"),
|
||||
})
|
||||
|
||||
useSeoMeta({
|
||||
title: t("navPosts"),
|
||||
ogTitle: t("navPosts"),
|
||||
description: t("navPostsCaption"),
|
||||
ogDescription: t("navPostsCaption"),
|
||||
ogType: "website",
|
||||
})
|
||||
</script>
|
@ -1,32 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="my-3" v-if="!route.query['no-title']">
|
||||
<h1 class="text-2xl">{{ route.query["title"] ?? t("navPosts") }}</h1>
|
||||
<span>{{ route.query["caption"] ?? t("navPostsCaptionWithTag", [route.params.slug?.toString()]) }}</span>
|
||||
</div>
|
||||
|
||||
<post-list class="mx-[-2.5ch]" :tag="route.params.slug?.toString()" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
definePageMeta({
|
||||
layout: "embed",
|
||||
})
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
useHead({
|
||||
title: t("navPosts"),
|
||||
})
|
||||
|
||||
useSeoMeta({
|
||||
title: t("navPosts"),
|
||||
ogTitle: t("navPosts"),
|
||||
description: t("navPostsCaption"),
|
||||
ogDescription: t("navPostsCaption"),
|
||||
ogType: "website",
|
||||
})
|
||||
</script>
|
@ -1,54 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-img v-if="urlOfBanner" :src="urlOfBanner" :aspect-ratio="16 / 5" class="rounded-md mb-3" cover />
|
||||
|
||||
<div class="mx-[2.5ch]">
|
||||
<div class="my-5 flex flex-row gap-4">
|
||||
<v-avatar :image="urlOfAvatar" />
|
||||
<div class="flex flex-col">
|
||||
<span>{{ account?.nick }} <span class="text-xs">@{{ account?.name }}</span></span>
|
||||
<span class="text-sm">{{ account?.description }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-5 text-xs text-grey flex flex-col">
|
||||
<span>Solar Network User Web Preview</span>
|
||||
<span>
|
||||
To get full view of this user's profile, open it on <a class="underline" :href="externalOpenLink">Solian</a>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h1 class="text-xl">{{ t("userActivity") }}</h1>
|
||||
<span>{{ t("userActivityCaption") }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<post-list v-if="account" :author="account.name" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
definePageMeta({
|
||||
layout: "embed",
|
||||
alias: ["/embed/@:name(.*)*"],
|
||||
})
|
||||
|
||||
const { t } = useI18n()
|
||||
const route = useRoute()
|
||||
const config = useRuntimeConfig()
|
||||
|
||||
const { data: account } = await useFetch<any>(`${config.public.solarNetworkApi}/cgi/id/users/${route.params.name}`)
|
||||
|
||||
if (account.value == null) {
|
||||
throw createError({
|
||||
statusCode: 404,
|
||||
statusMessage: "User Not Found",
|
||||
})
|
||||
}
|
||||
|
||||
const urlOfAvatar = computed(() => account.value?.avatar ? `${config.public.solarNetworkApi}/cgi/uc/attachments/${account.value.avatar}` : void 0)
|
||||
const urlOfBanner = computed(() => account.value?.banner ? `${config.public.solarNetworkApi}/cgi/uc/attachments/${account.value.banner}` : void 0)
|
||||
|
||||
const externalOpenLink = computed(() => `${config.public.solianUrl}/accounts/view/${route.params.name}`)
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user