1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-19 18:29:23 +00:00

[video thumbnail] display the thumbnails for some pages.

- when 'video thumbnail' feature is enabled, display the thumbnails
  for 'dir view', 'starred(favorites)', 'file view', 'shared dir view'
  pages.
This commit is contained in:
llj
2021-07-19 14:46:17 +08:00
parent 4388bca9ce
commit 6bfd8cce96
12 changed files with 29 additions and 11 deletions

View File

@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import classnames from 'classnames';
import { Nav, NavItem, NavLink, TabContent, TabPane } from 'reactstrap';
import DetailCommentList from './detail-comments-list';
import { siteRoot } from '../../utils/constants';
import { siteRoot, enableVideoThumbnail } from '../../utils/constants';
import { seafileAPI } from '../../utils/seafile-api';
import { Utils } from '../../utils/utils';
import toaster from '../toast';
@@ -225,7 +225,8 @@ class DirentDetail extends React.Component {
let smallIconUrl = dirent ? Utils.getDirentIcon(dirent) : Utils.getDirentIcon(folderDirent);
let bigIconUrl = dirent ? Utils.getDirentIcon(dirent, true) : Utils.getDirentIcon(folderDirent, true);
const isImg = dirent ? Utils.imageCheck(dirent.name) : Utils.imageCheck(folderDirent.name);
if (isImg) {
const isVideo = dirent ? Utils.videoCheck(dirent.name) : Utils.videoCheck(folderDirent.name);
if (isImg || (enableVideoThumbnail && isVideo)) {
bigIconUrl = `${siteRoot}thumbnail/${repoID}/1024` + Utils.encodePath(`${path === '/' ? '' : path}/${dirent.name}`);
}
let direntName = dirent ? dirent.name : folderDirent.name;

View File

@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import moment from 'moment';
import { siteRoot, gettext } from '../../utils/constants';
import { siteRoot, gettext, enableVideoThumbnail } from '../../utils/constants';
import { seafileAPI } from '../../utils/seafile-api';
import { Utils } from '../../utils/utils';
import toaster from '../toast';
@@ -110,7 +110,8 @@ class FileDetails extends React.Component {
const smallIconUrl = Utils.getFileIconUrl(dirent.name);
let bigIconUrl = Utils.getFileIconUrl(dirent.name, 192);
const isImg = Utils.imageCheck(dirent.name);
if (isImg) {
const isVideo = Utils.videoCheck(dirent.name);
if (isImg || (enableVideoThumbnail && isVideo)) {
bigIconUrl = `${siteRoot}thumbnail/${repoID}/1024` + Utils.encodePath(`${path === '/' ? '' : path}/${dirent.name}`);
}
return (