epubs: allows epub upload

This commit is contained in:
jimmylee 2020-08-10 03:10:44 -07:00
parent 2132af84ff
commit 9806f30942
4 changed files with 24 additions and 26 deletions

View File

@ -74,6 +74,10 @@ export const isFileTypeAllowed = (type = "") => {
return true;
}
if (type.startsWith("application/epub")) {
return true;
}
if (type.startsWith("audio/")) {
return true;
}

View File

@ -50,15 +50,17 @@ const STYLES_IMAGE = css`
export default class MediaObject extends React.Component {
render() {
const name = `${this.props.data.name}`;
const url = this.props.data.url
? this.props.data.url
: `https://hub.textile.io${this.props.data.ipfs}`;
const url = this.props.data.url ? this.props.data.url : `https://hub.textile.io${this.props.data.ipfs}`;
const type = this.props.data.type ? this.props.data.type : "LEGACY_NO_TYPE";
if (type.startsWith("application/pdf")) {
return <object css={STYLES_OBJECT} data={url} type={type} />;
}
if (type.startsWith("application/epub")) {
return <div css={STYLES_FAILURE}>No Preview</div>;
}
if (type.startsWith("video/")) {
return (
<video autoPlay controls name="media" css={STYLES_OBJECT}>
@ -77,7 +79,7 @@ export default class MediaObject extends React.Component {
);
}
if (type.startsWith("image/") || this.props.useImageFallback) {
if (type.startsWith("image/")) {
return (
<div css={STYLES_ASSET}>
<img css={STYLES_IMAGE} src={url} />

View File

@ -54,6 +54,16 @@ export default class SlateMediaObjectPreview extends React.Component {
);
}
if (this.props.type && this.props.type.startsWith("application/epub")) {
return (
<span css={STYLES_ITEM}>
<div css={STYLES_PDF} onClick={this.props.onClick}>
EPub
</div>
</span>
);
}
if (this.props.type && this.props.type.startsWith("application/pdf")) {
return (
<span css={STYLES_ITEM}>

View File

@ -26,30 +26,12 @@ export default class WebsitePrototypeWrapper extends React.Component {
<meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:url" content={this.props.url} />
<meta property="twitter:title" content={this.props.title} />
<meta
property="twitter:description"
content={this.props.description}
/>
<meta property="twitter:description" content={this.props.description} />
<meta property="twitter:image" content={this.props.image} />
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/static/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="96x96"
href="/static/favicon-96x96.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="/static/favicon-16x16.png"
/>
<link rel="icon" type="image/png" sizes="32x32" href="/static/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="96x96" href="/static/favicon-96x96.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/static/favicon-16x16.png" />
<link rel="shortcut icon" href="/static/favicon.ico" />
<GoogleScript id="UA-52930282-7" />