Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust card entity #1851

Merged
merged 1 commit into from
Aug 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions megalodon/src/entities/card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ namespace Entity {
title: string
description: string
type: 'link' | 'photo' | 'video' | 'rich'
image?: string
author_name?: string
author_url?: string
provider_name?: string
provider_url?: string
html?: string
width?: number
height?: number
image: string | null
author_name: string | null
author_url: string | null
provider_name: string | null
provider_url: string | null
html: string | null
width: number | null
height: number | null
embed_url: string | null
blurhash: string | null
}
}
17 changes: 16 additions & 1 deletion megalodon/src/friendica/api_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,22 @@ namespace FriendicaAPI {
return a as MegalodonEntity.AsyncAttachment
}
}
export const card = (c: Entity.Card): MegalodonEntity.Card => c
export const card = (c: Entity.Card): MegalodonEntity.Card => ({
url: c.url,
title: c.title,
description: c.description,
type: c.type,
image: c.image,
author_name: c.author_name,
author_url: c.author_url,
provider_name: c.provider_name,
provider_url: c.provider_url,
html: c.html,
width: c.width,
height: c.height,
embed_url: null,
blurhash: c.blurhash
})
export const context = (c: Entity.Context): MegalodonEntity.Context => ({
ancestors: Array.isArray(c.ancestors) ? c.ancestors.map(a => status(a)) : [],
descendants: Array.isArray(c.descendants) ? c.descendants.map(d => status(d)) : []
Expand Down
17 changes: 9 additions & 8 deletions megalodon/src/friendica/entities/card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ namespace FriendicaEntity {
title: string
description: string
type: 'link' | 'photo' | 'video' | 'rich'
image?: string
author_name?: string
author_url?: string
provider_name?: string
provider_url?: string
html?: string
width?: number
height?: number
image: string | null
author_name: string
author_url: string
provider_name: string
provider_url: string
html: string
width: number
height: number
blurhash: string | null
}
}
18 changes: 10 additions & 8 deletions megalodon/src/mastodon/entities/card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ namespace MastodonEntity {
title: string
description: string
type: 'link' | 'photo' | 'video' | 'rich'
image?: string
author_name?: string
author_url?: string
provider_name?: string
provider_url?: string
html?: string
width?: number
height?: number
image: string | null
author_name: string
author_url: string
provider_name: string
provider_url: string
html: string
width: number
height: number
embed_url: string
blurhash: string | null
}
}
17 changes: 16 additions & 1 deletion megalodon/src/pleroma/api_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,22 @@ namespace PleromaAPI {
return a as MegalodonEntity.AsyncAttachment
}
}
export const card = (c: Entity.Card): MegalodonEntity.Card => c
export const card = (c: Entity.Card): MegalodonEntity.Card => ({
url: c.url,
title: c.title,
description: c.description,
type: c.type,
image: c.image,
author_name: null,
author_url: null,
provider_name: c.provider_name,
provider_url: c.provider_url,
html: null,
width: null,
height: null,
embed_url: null,
blurhash: null
})
export const context = (c: Entity.Context): MegalodonEntity.Context => ({
ancestors: Array.isArray(c.ancestors) ? c.ancestors.map(a => status(a)) : [],
descendants: Array.isArray(c.descendants) ? c.descendants.map(d => status(d)) : []
Expand Down
12 changes: 3 additions & 9 deletions megalodon/src/pleroma/entities/card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,8 @@ namespace PleromaEntity {
title: string
description: string
type: 'link' | 'photo' | 'video' | 'rich'
image?: string
author_name?: string
author_url?: string
provider_name?: string
provider_url?: string
html?: string
width?: number
height?: number
pleroma?: Object
image: string | null
provider_name: string
provider_url: string
}
}