disable video thumbnail edits; remove console logs

This commit is contained in:
Travis Eden 2018-11-08 14:05:06 -05:00
parent e970bb9e0d
commit 0fa9bc831e
5 changed files with 58 additions and 66 deletions

View file

@ -12,7 +12,6 @@ class PublishPreview extends React.Component {
componentDidMount () {
const { isUpdate, sourceUrl, file } = this.props;
if (isUpdate && sourceUrl) {
console.log('setting sourceUrl:', sourceUrl);
this.setState({ imgSource: sourceUrl });
} else {
this.setPreviewImageSource(file);

View file

@ -85,63 +85,66 @@ class Dropzone extends React.Component {
const { file, thumbnail, fileError, isUpdate, sourceUrl, fileExt } = this.props;
return (
<div>
{isUpdate && fileExt === 'mp4' && (<p>Video thumbnail:</p>)}
<div className='dropzone-wrapper'>
<form>
<input
className='input-file'
type='file'
id='file_input'
name='file_input'
accept='video/*,image/*'
onChange={this.handleFileInput}
encType='multipart/form-data'
/>
</form>
<div
className={'dropzone' + (dragOver ? ' dropzone--drag-over' : '')}
onDrop={this.handleDrop}
onDragOver={this.handleDragOver}
onDragEnd={this.handleDragEnd}
onDragEnter={this.handleDragEnter}
onDragLeave={this.handleDragLeave}
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave}
onClick={this.handleClick}>
{file || isUpdate ? (
<div className={'dropzone-preview-wrapper'}>
{file ? (
<DropzonePreviewImage
dimPreview={dimPreview}
file={file}
thumbnail={thumbnail}
/>
) : (
<DropzonePreviewImage
dimPreview
isUpdate
sourceUrl={sourceUrl}
/>
)}
<div className={'dropzone-preview-overlay'}>
{ dragOver ? <DropzoneDropItDisplay /> : null }
{ mouseOver ? (
<DropzoneInstructionsDisplay
fileError={fileError}
message={fileExt === 'mp4' ? 'Drag & drop new thumbnail' : null}
{isUpdate && fileExt === 'mp4' ? (
<p>Video updates are currently disabled. This feature will be available soon. You can edit metadata.</p>
) : (
<div className='dropzone-wrapper'>
<form>
<input
className='input-file'
type='file'
id='file_input'
name='file_input'
accept='video/*,image/*'
onChange={this.handleFileInput}
encType='multipart/form-data'
/>
</form>
<div
className={'dropzone' + (dragOver ? ' dropzone--drag-over' : '')}
onDrop={this.handleDrop}
onDragOver={this.handleDragOver}
onDragEnd={this.handleDragEnd}
onDragEnter={this.handleDragEnter}
onDragLeave={this.handleDragLeave}
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave}
onClick={this.handleClick}>
{file || isUpdate ? (
<div className={'dropzone-preview-wrapper'}>
{file ? (
<DropzonePreviewImage
dimPreview={dimPreview}
file={file}
thumbnail={thumbnail}
/>
) : null }
) : (
<DropzonePreviewImage
dimPreview
isUpdate
sourceUrl={sourceUrl}
/>
)}
<div className={'dropzone-preview-overlay'}>
{ dragOver ? <DropzoneDropItDisplay /> : null }
{ mouseOver ? (
<DropzoneInstructionsDisplay
fileError={fileError}
message={fileExt === 'mp4' ? 'Drag & drop new thumbnail' : null}
/>
) : null }
</div>
</div>
</div>
) : (
dragOver ? <DropzoneDropItDisplay /> : (
<DropzoneInstructionsDisplay
fileError={fileError}
/>
)
)}
) : (
dragOver ? <DropzoneDropItDisplay /> : (
<DropzoneInstructionsDisplay
fileError={fileError}
/>
)
)}
</div>
</div>
</div>
)}
</div>
);
}

View file

@ -40,10 +40,6 @@ const publish = async (publishParams, fileName, fileType) => {
fileRecord = await db.File.findOne({where: {claimId}}).then(result => result.dataValues);
}
logger.info('fileRecord:', fileRecord);
logger.info('claimRecord:', claimRecord);
logger.info('upsertCriteria:', upsertCriteria);
const [file, claim] = await Promise.all([
db.upsert(db.File, fileRecord, upsertCriteria, 'File'),
db.upsert(db.Claim, claimRecord, upsertCriteria, 'Claim'),

View file

@ -96,7 +96,6 @@ const claimUpdate = ({ body, files, headers, ip, originalUrl, user, tor }, res)
if (claimRecord.content_type === 'video/mp4' && files.file) {
thumbnailUpdate = true;
}
logger.info('claimRecord:', claimRecord);
if (!files.file || thumbnailUpdate) {
return Promise.all([
@ -132,7 +131,6 @@ const claimUpdate = ({ body, files, headers, ip, originalUrl, user, tor }, res)
const newThumbnailName = `${name}-${rando()}`;
const newThumbnailParams = createThumbnailPublishParams(filePath, newThumbnailName, license, nsfw);
newThumbnailParams['file_path'] = filePath;
logger.info('newThumbnailParams:', newThumbnailParams);
publish(newThumbnailParams, fileName, fileType);
publishParams['sources'] = resolution.claim.value.stream.source;

View file

@ -47,7 +47,7 @@ async function createFileRecordDataAfterPublish (fileName, fileType, publishPara
width: fileWidth,
} = await getMediaDimensions(fileType, filePath);
const obj = {
return {
name,
claimId,
outpoint: `${txid}:${nout}`,
@ -57,10 +57,6 @@ async function createFileRecordDataAfterPublish (fileName, fileType, publishPara
filePath,
fileType,
};
console.log('createFileRecordDataAfterPublish return:', obj);
return obj;
}
module.exports = {