fix comic-book content-type detection

always show viewer: fix #4141

minor improvements for loading indicator
This commit is contained in:
btzr-io 2020-05-08 22:24:02 -05:00 committed by Sean Yesmunt
parent 036cf734c6
commit c19d04f83e
4 changed files with 14 additions and 5 deletions

View file

@ -50,12 +50,12 @@ const ComicBookViewer = (props: Props) => {
}; };
const { error, loading, content } = finalSource; const { error, loading, content } = finalSource;
const ready = content !== null && !loading; const ready = content !== null && !loading && !error;
const errorMessage = __("Sorry, looks like we can't load the archive."); const errorMessage = __("Sorry, looks like we can't load the archive.");
return ( return (
<div className="file-render__viewer file-render__viewer--comic"> <div className="file-render__viewer file-render__viewer--comic">
{loading && <LoadingScreen status={__('Loading')} />} {loading && <LoadingScreen status={__('Loading')} isDocument />}
{ready && ( {ready && (
<Villain source={finalSource.content} className={'comic-viewer'} options={opts} workerUrl={workerUrl} /> <Villain source={finalSource.content} className={'comic-viewer'} options={opts} workerUrl={workerUrl} />
)} )}

View file

@ -22,3 +22,12 @@ export const FORCE_CONTENT_TYPE_PLAYER = [
'application/x-ext-ogg', 'application/x-ext-ogg',
'application/x-ext-m4a', 'application/x-ext-m4a',
]; ];
export const FORCE_CONTENT_TYPE_COMIC = [
'application/vnd.comicbook+zip',
'application/vnd.comicbook-rar',
'application/x-cbr',
'application/x-cbt',
'application/x-cbz',
'application/x-cb7',
];

View file

@ -27,7 +27,6 @@ export const APPLICATION = 'application';
export const UNSUPPORTED = 'unsupported'; export const UNSUPPORTED = 'unsupported';
// PDFs disabled on desktop until we update Electron: https://github.com/electron/electron/issues/12337 // PDFs disabled on desktop until we update Electron: https://github.com/electron/electron/issues/12337
// Comics disabled because nothing is actually reporting as a comic type
export const UNSUPPORTED_IN_THIS_APP = IS_WEB ? [CAD, COMIC, APPLICATION] : [APPLICATION, PDF]; export const UNSUPPORTED_IN_THIS_APP = IS_WEB ? [CAD, COMIC, APPLICATION] : [APPLICATION, PDF];
export const UNRENDERABLE_MODES = Array.from( export const UNRENDERABLE_MODES = Array.from(

View file

@ -20,7 +20,7 @@ import { selectAllCostInfoByUri, makeSelectCostInfoForUri } from 'lbryinc';
import { selectShowMatureContent } from 'redux/selectors/settings'; import { selectShowMatureContent } from 'redux/selectors/settings';
import * as RENDER_MODES from 'constants/file_render_modes'; import * as RENDER_MODES from 'constants/file_render_modes';
import path from 'path'; import path from 'path';
import { FORCE_CONTENT_TYPE_PLAYER } from 'constants/claim'; import { FORCE_CONTENT_TYPE_PLAYER, FORCE_CONTENT_TYPE_COMIC } from 'constants/claim';
// @if TARGET='web' // @if TARGET='web'
import { generateStreamUrl } from 'util/lbrytv'; import { generateStreamUrl } from 'util/lbrytv';
// @endif // @endif
@ -212,7 +212,8 @@ export const makeSelectFileRenderModeForUri = (uri: string) =>
if (['3D-file', 'model'].includes(mediaType)) { if (['3D-file', 'model'].includes(mediaType)) {
return RENDER_MODES.CAD; return RENDER_MODES.CAD;
} }
if (mediaType === 'comic-book') { // Force content type for fallback support of older claims
if (mediaType === 'comic-book' || FORCE_CONTENT_TYPE_COMIC.includes(contentType)) {
return RENDER_MODES.COMIC; return RENDER_MODES.COMIC;
} }
if ( if (