Support `language` param with L tags

This commit is contained in:
Alex Gleason 2024-06-07 10:01:08 -05:00
parent 4361c340b0
commit 45dee96219
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
2 changed files with 6 additions and 1 deletions

View File

@ -104,6 +104,11 @@ const createStatusController: AppController = async (c) => {
tags.push(['subject', data.spoiler_text]); tags.push(['subject', data.spoiler_text]);
} }
if (data.language) {
tags.push(['L', 'ISO-639-1']);
tags.push(['l', data.language, 'ISO-639-1']);
}
const media = data.media_ids?.length ? await getUnattachedMediaByIds(kysely, data.media_ids) : []; const media = data.media_ids?.length ? await getUnattachedMediaByIds(kysely, data.media_ids) : [];
const imeta: string[][] = media.map(({ data }) => { const imeta: string[][] = media.map(({ data }) => {

View File

@ -100,7 +100,7 @@ async function renderStatus(event: DittoEvent, opts: RenderStatusOpts): Promise<
sensitive: !!cw, sensitive: !!cw,
spoiler_text: (cw ? cw[1] : subject?.[1]) || '', spoiler_text: (cw ? cw[1] : subject?.[1]) || '',
visibility: 'public', visibility: 'public',
language: event.tags.find((tag) => tag[0] === 'lang')?.[1] || null, language: event.tags.find((tag) => tag[0] === 'l' && tag[2] === 'ISO-639-1')?.[1] || null,
replies_count: event.event_stats?.replies_count ?? 0, replies_count: event.event_stats?.replies_count ?? 0,
reblogs_count: event.event_stats?.reposts_count ?? 0, reblogs_count: event.event_stats?.reposts_count ?? 0,
favourites_count: event.event_stats?.reactions['+'] ?? 0, favourites_count: event.event_stats?.reactions['+'] ?? 0,