mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-18 19:23:40 +00:00
Add support for videos
This commit is contained in:
parent
51781a4743
commit
a0cef2b13e
@ -29,6 +29,7 @@ module.exports = {
|
||||
"no-unused-vars": ["error", {args: "none"}],
|
||||
"no-async-promise-executor": "off",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"no-useless-escape": "off",
|
||||
},
|
||||
ignorePatterns: ["*.svg"],
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ export const mergeParents = (notes: Array<DisplayEvent>) => {
|
||||
const notesById = createMap('id', notes)
|
||||
const childIds = []
|
||||
|
||||
for (const note of notes) {
|
||||
for (const note of Object.values(notesById)) {
|
||||
const parentId = findReplyId(note)
|
||||
|
||||
if (parentId) {
|
||||
|
@ -9,6 +9,11 @@
|
||||
let preview
|
||||
|
||||
onMount(async () => {
|
||||
if (url.match('\.(jpg|jpeg|png|gif)')) {
|
||||
preview = {image: url}
|
||||
} else if (url.match('\.(mov|mp4)')) {
|
||||
preview = {video: url}
|
||||
} else {
|
||||
try {
|
||||
const res = await fetch(endpoint, {
|
||||
method: 'POST',
|
||||
@ -26,19 +31,23 @@
|
||||
} catch (e) {
|
||||
return
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
{#if preview}
|
||||
<div in:slide class="max-w-sm">
|
||||
<div in:slide>
|
||||
<Anchor
|
||||
external
|
||||
href={url}
|
||||
class="rounded border border-solid border-medium flex flex-col bg-white overflow-hidden">
|
||||
class="rounded border border-solid border-medium flex flex-col bg-medium overflow-hidden">
|
||||
{#if preview.image}
|
||||
<img alt="Link preview" src={preview.image} />
|
||||
<div class="h-px bg-medium" />
|
||||
<img alt="Link preview" src={preview.image} class="object-center max-h-96 object-contain" />
|
||||
{/if}
|
||||
{#if preview.video}
|
||||
<video controls src={preview.video} class="object-center max-h-96 object-contain" />
|
||||
{/if}
|
||||
<div class="h-px bg-medium" />
|
||||
{#if preview.title}
|
||||
<div class="px-4 py-2 text-black flex flex-col bg-white">
|
||||
<strong class="whitespace-nowrap text-ellipsis overflow-hidden">{preview.title}</strong>
|
||||
|
@ -38,6 +38,8 @@
|
||||
$: following = find(t => t[1] === pubkey, $user?.petnames || [])
|
||||
|
||||
onMount(async () => {
|
||||
console.log('Person', npub, person)
|
||||
|
||||
// Add all the relays we know the person uses
|
||||
relays = relays.concat(getPubkeyRelays(pubkey))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user