mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Show one-source events' pictures and play their clips in the News panel
A feed card shows its event's picture whatever the number of sources, so a lone Telegram post opening with a video gets its preview; the globe's picture cards still need two. An event picture may carry its post's clip (an HTTPS MP4 or WebM file): the card marks it with a play sign, and opened, it plays with controls and sound, loading nothing before. An expired link drops the clip.
This commit is contained in:
1 parent
f72f79f48b
commit
74d40c4b1a
7 files changed
+171
-12
No files matched your search
@@ -162,11 +162,23 @@ function normalizeGeo(geo) {
|
||||
};
|
||||
}
|
||||
|
||||
/** The event's picture: an HTTPS URL on the publisher's site, and whose it is. */
|
||||
/**
|
||||
* The event's picture: an HTTPS URL on the publisher's site, and whose it is;
|
||||
* with the post's own clip when it has one a browser plays itself (an HTTPS
|
||||
* MP4 or WebM file), the picture then its poster.
|
||||
*/
|
||||
function eventImage(image) {
|
||||
const url = httpUrl(image?.url);
|
||||
if (!url?.startsWith('https://')) return null;
|
||||
return { url, publisher: text(image.publisher, 80) || '' };
|
||||
const video = httpUrl(image.video);
|
||||
const playable =
|
||||
video?.startsWith('https://') &&
|
||||
/\.(?:mp4|m4v|webm)$/i.test(new URL(video).pathname);
|
||||
return {
|
||||
url,
|
||||
publisher: text(image.publisher, 80) || '',
|
||||
...(playable ? { video } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
/** An event summary from `/feed?events=1`: size and one report per side. */
|
||||
|
||||
Reference in new issue
Block a user