Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add thumbnail support for archive files #780

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Commits on Jan 24, 2021

  1. Remove redundant variable assignment

    Keep the default assignment in case there are more types.
    glubsy committed Jan 24, 2021
    Configuration menu
    Copy the full SHA
    e77958d View commit details
    Browse the repository at this point in the history
  2. Fix generation of thumbnails for video files under 10 seconds

    * Use ffprobe/avprobe to get the total duration of each video file first.
    * Compute a desired optimal timestamp of 15% of the total duration to seek for and get the thumbnail from.
    * Fix capture of ffmpeg's output (from stderr) in exec_cmdv() by using an optional redirection to stdout.
    * Capture of sub-process output is optional (possible slight performance gain).
    glubsy committed Jan 24, 2021
    Configuration menu
    Copy the full SHA
    03fd6dc View commit details
    Browse the repository at this point in the history
  3. Fix updated files not updating thumbnail as well

    Overwrite already existing thumbnails if the source file's mtime is more recent
    glubsy committed Jan 24, 2021
    Configuration menu
    Copy the full SHA
    9ac1417 View commit details
    Browse the repository at this point in the history
  4. Fix getting output from subprocess

    * Return stdout as expected from ffprobe to get duration.
    * Avoid throwing an exception in favour of a default value for potential
    malformed total duration got from ffprobe.
    glubsy committed Jan 24, 2021
    Configuration menu
    Copy the full SHA
    a5ea2d0 View commit details
    Browse the repository at this point in the history
  5. Remove obsolete argument check

    * Conflict with the newly added boolean arguments if they are
    explicitely passed by the caller.
    * cmdv has to be an array.
    glubsy committed Jan 24, 2021
    Configuration menu
    Copy the full SHA
    7cf18b6 View commit details
    Browse the repository at this point in the history
  6. Add seek-in value option for video thumbnails

    * Allows users to specify which percentage of the total video duration
    to seek in instead of hardcoding 15%.
    * Now defaults to 50%.
    glubsy committed Jan 24, 2021
    Configuration menu
    Copy the full SHA
    5a0c630 View commit details
    Browse the repository at this point in the history
  7. Limit thumbnail generation

    * This fixes a denial-of-service exploit that would allow the client to
    generate an infinite number of thumbnails and fill up the storage completely.
    Since the client had control over the requested thumbnail sizes, it could make arbitrary requests for thumbnails, and every time the backend did not find an already generated thumbnail with the specified sizes, it would happily generate a new one.
    * Remove the ability of the client to decide thumbnail dimensions and
    only let the back-end do this by reading the configuration.
    * Limit the number of generated thumbnails per file to only one, with
    "landscape" dimensions (4/3).
    * Use CSS "object-fit" property to adjust displaying of landscape thumbnails into squares. Ref: https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit
    glubsy committed Jan 24, 2021
    Configuration menu
    Copy the full SHA
    8ac7f6a View commit details
    Browse the repository at this point in the history
  8. Fix thumbnail generation for mis-detected file types

    * Generate thumbnail despite wrong detected filetype
    
    When a file has the wrong extension, fall back to other types
    available until one works.
    For unsupported files, get the mime type to determine if we truly cannot
    support thumbnail generation.
    Cache the type detected for further requests with different sizes.
    
    * Test whether server has Fileinfo extension active
    
    Only check mime types with fileinfo extension if it is active.
    If not, avoid brute forcing type detection by rolling over the various
    thumbnail generation methods and simply return no thumbnail.
    
    * Keep capture file in memory instead of writing to disk
    
    Keep the capture data in the Image class if the capture data is valid,
    otherwise destroy the Image object.
    Image doesn't read files from disk directly anymore.
    glubsy committed Jan 24, 2021
    Configuration menu
    Copy the full SHA
    40ff56e View commit details
    Browse the repository at this point in the history

Commits on Jan 25, 2021

  1. Limit thumbnail generation

    * This fixes a denial-of-service exploit that would allow the client to
    generate an infinite number of thumbnails and fill up the storage completely.
    Since the client had control over the requested thumbnail sizes, it could make arbitrary requests for thumbnails, and every time the backend did not find an already generated thumbnail with the specified sizes, it would happily generate a new one.
    * Remove the ability of the client to decide thumbnail dimensions and
    only let the back-end do this by reading the configuration.
    * Limit the number of generated thumbnails per file to only one, with
    "landscape" dimensions (4/3).
    * Use CSS "object-fit" property to adjust displaying of landscape thumbnails into squares. Ref: https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit
    glubsy committed Jan 25, 2021
    Configuration menu
    Copy the full SHA
    2582d22 View commit details
    Browse the repository at this point in the history
  2. Remove redundant request for square thumb

    * We now use only one thumbnail file src for both square and rational
    thumbnails so remove superfluous requests.
    * Set the same src for both square and landscape dom classes.
    glubsy committed Jan 25, 2021
    Configuration menu
    Copy the full SHA
    a2d21cf View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    8f5410c View commit details
    Browse the repository at this point in the history
  4. Rename variable

    The href is converted to path.
    glubsy committed Jan 25, 2021
    Configuration menu
    Copy the full SHA
    db110d2 View commit details
    Browse the repository at this point in the history
  5. Reduce superfluous computations

    Only compute thumbnail configured dimensions on thumbnail API requests.
    glubsy committed Jan 25, 2021
    Configuration menu
    Copy the full SHA
    e876184 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    0d93996 View commit details
    Browse the repository at this point in the history

Commits on Jan 26, 2021

  1. Fix typo.

    glubsy committed Jan 26, 2021
    Configuration menu
    Copy the full SHA
    ba6b01a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    39f75b8 View commit details
    Browse the repository at this point in the history

Commits on Feb 8, 2021

  1. Add thumbnail support for archive files

    * Separate 7z from regular zip archive because PHP ZipArchive doesn't
    handle them.
    * Support RAR archives with PHP "rar" extension.
    * Use sqlite3 database for caching errors from failures to process archive files.
    * Add blocklist for more explicit filtering.
    When a value is removed from a default array of strings in the
    options, the removed value should be considered explicitly blocked by
    the user: thumbnails should not be generated, actual underlying file type should
    not be checked for. Thus the blocklist should be updated with the
    missing string.
    * Notify client if detected type is incorrect after checking the
    database.
    Check in database if we have cached the result of our server-side file
    detection, return the cached file type if present.
    * Return to client the same kind of type it uses in order to update the
    previewer if the file type was wrongly detected.
    * Remove client-side sample request for img as it is both superfulous and a security issue.
    Down-sampling should be requested by the backend only. This can be implemented again on the
    back-end if necessary.
    * Fix double previewer bug:
    Remove any previous callback on click event, as both previous and new previewers were triggered successively.
    * Remove swf and flv file from handled video preview since these formats
    are deprecated and should be handled by the browser directly.
    * Display detected type in info panel.
    glubsy committed Feb 8, 2021
    Configuration menu
    Copy the full SHA
    fc5650a View commit details
    Browse the repository at this point in the history

Commits on Feb 9, 2021

  1. Update version

    glubsy committed Feb 9, 2021
    Configuration menu
    Copy the full SHA
    fd89f49 View commit details
    Browse the repository at this point in the history