video embed

This commit is contained in:
Lamp 2022-09-09 15:19:31 -07:00
parent fe200cbcd8
commit 60cd8d93df

@ -110,16 +110,22 @@ function MessageList({messages, user, updateUser}) {
></span>
if (message.file) {
let url = `/file/${message._id}/${message.file.name}`;
let embed = message.file.type?.startsWith("image")
? <img src={url} alt={message.file.name} className="max-h-32" />
let url = (window.location.hostname === "localhost" ? "http://localhost:8535" : "")
+ `/file/${message._id}/${message.file.name}`;
let embed =
message.file.type?.startsWith("image") ?
<img src={url} alt={message.file.name} className="max-h-32 inline-block align-top border" />
: message.file.type?.startsWith("video") ?
<video className='max-h-64 inline-block align-top border' controls>
<source src={url} type={message.file.type} />
</video>
: <span>{message.file.name}</span>
// eslint-disable-next-line react/jsx-no-target-blank
var image = <a href={url} target="_blank" rel="noopener" className='inline-block' style={{color:"revert",textDecoration:"revert"}}>{embed}</a>
var file = <a href={url} target="_blank" rel="noopener" style={{color:"revert",textDecoration:"revert"}}>{embed}</a>;
}
return <li key={message._id}>
{prefix} {content} {image}
{prefix} {content} {file}
</li>
})}