Coder Social home page Coder Social logo

dgtl-one / kirby-chunky Goto Github PK

View Code? Open in Web Editor NEW
41.0 2.0 3.0 1.72 MB

Using Kirby Chunky, you can easily bypass the upload limits of your server or proxy and provide fast, secure, and resumable uploads using the tus protocol.

License: MIT License

PHP 66.05% Vue 31.08% JavaScript 2.88%
kirby-cms kirby3-plugin kirby-panel kirby3

kirby-chunky's Introduction

Chunky Logo

Chunky – Large and resumable file uploads for Kirby CMS

Packagist Version Kirby Version Packagist PHP Version Packagist License

Chunky is a plugin for Kirby CMS that allows users to easily upload and manage very large files. With support for uploading files ranging from a few MB to multiple TB, Chunky provides a fast and secure way to transfer files of any size without the need to modify server settings or work around file upload limits imposed by hosting providers, proxies (like Cloudflare), firewalls, or CDNs.

One of the key features of Chunky is its support for resumable uploads, which allows users to resume an upload from anywhere inside the panel at a later time. This is particularly useful for transferring large files over slow or unreliable internet connections.

Chunky also extends all files sections automatically and fits seamlessly into the Kirby UI, making it easy for panel users to work with large files without any additional setup or configuration.

Under the hood, Chunky uses the tus protocol v1 and the official tus-js-library, ensuring compatibility with a wide range of web servers and hosting providers including NGINX, Apache, and Caddy. Chunky is compatible with PHP 7.2.5 and higher, and provides the option to configure your own chunk size inside your site's config.

Features:

■ Upload very large files from inside the Kirby Panel, ranging from a few MB to multiple TB in size.
■ Resumable uploads can be initiated at any point from within the Kirby Panel.
■ The file upload limits set by PHP.ini, proxy (like Cloudflare), firewall, or hosting provider can be bypassed.
■ Fast and secure uploads of any size are possible without modifying server settings.
■ The maximum available chunk size on the server is calculated automatically.
■ A custom chunk size can be configured within the site's config.
■ All file sections are automatically extended without the need to modify blueprints.
■ Deep integration of custom file-related hooks and compatibility with other file-related plugins.
■ Compatible with any web server and hosting provider, including NGINX, Apache, and Caddy.
■ Works seamlessly for Panel users and fits perfectly with the known Kirby Upload UI.

Browser support:

The Chunky plugin is built on top of the tus-js-client, which has been tested and is known to be compatible with a variety of web browsers. While it is likely that Chunky will also work in other browsers, this has not yet been confirmed. However, since the tus client only relies on Web Storage, XMLHttpRequest2, the File API, and the Blob API, it is expected that users who can access the Kirby Panel should also be able to use Chunky without issue.

■ Microsoft Edge 12+
■ Mozilla Firefox 14+
■ Google Chrome 20+
■ Safari 6+
■ Opera 12.1+
■ iOS 6.0+
■ Android 5.0+

How to use Chunky

Installing Chunky is a breeze. Simply add it to your Kirby CMS plugin folder using your preferred method, and you're all set. Chunky automatically enhances all upload functions in the Kirby Panel, without the need for any additional configurations in the blueprints. And if you decide you no longer want to use Chunky, just remove it from your plugin folder and everything will return to normal.

Installation

Download

Download and copy this repository to /site/plugins/chunky.

Git submodule

git submodule add https://github.com/dgtl-one/kirby-chunky.git site/plugins/chunky

Composer

composer require dgtl-one/kirby-chunky

Config Options

You can also define your own chunk size inside your config.php, however, this will be overridden if the value exceeds the limits defined in the PHP.ini or the limit of a proxy such as Cloudflare (100 MB). If possible, Chunky will automatically set the chunk size to 5 MB.

return [
    'dgtlone.kirby-chunky.chunk_size' => '5M', // shortcuts 'K', 'M', 'G' are supported
];

The ideal chunk size for resumable tus uploads will depend on a variety of factors, including the size of the file being uploaded, the bandwidth and latency of the network connection, and the capabilities of the server receiving the upload.

In general, it is a good idea to start with a chunk size of around 5 MB and then adjust based on the performance of the upload. Larger chunk sizes may be faster, but may also be more prone to errors if the connection is unstable. Smaller chunk sizes may be slower, but may be more reliable and allow for easier recovery if an error occurs.

Overall, the best chunk size will depend on the specific needs of the average file size of your site and the characteristics of the network environment in which it is being used.

Changelog

v1.0.1

  • Fixed an issue with files having templates (#1)
  • Updated dependencies

v1.0.0

  • Initial commit

What is TUS?

The TUS protocol (short for "The Upload Server Protocol") is a reliable and popular method for uploading large files over the internet. It works by allowing the client to send multiple small chunks of data to the server, rather than sending the entire file in one go. This makes it possible to resume an interrupted upload from where it left off, as well as to perform other features such as file concatenation, modification, and deletion. TUS is an open protocol, meaning that it is freely available for anyone. It is widely used in a variety of applications, including file sharing platforms and online backup services.

Get more information at tus.io.

License

Chunky is released under the MIT License.

kirby-chunky's People

Contributors

foddy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

kirby-chunky's Issues

Limit the usage of chunky to some specific files

It will be helpful to have a config option to limit the usage of Chunky to only a reduced type of files. Chunky doesn‘t cover some of the default uploader functions like use the "Replace" file function. So having an option to set to only use Chunky uploader if the file is a specific template will be great.

File not selected after upload

After uploading one or multiple images, this is what I see:

Bildschirmfoto 2023-11-16 um 12 20 17

The field is not blank but the file(s) are not selected. I have to go through the button on the right to replace this "empty" file with the one(s) I just uploaded.

Plugin ignores "uploads: parent:" query

I have several fields where I have a custom destination for the uploaded file, such as:

fields:
   sponsor_logo:
      type: files
      query: site.find('sponsors')
      uploads:
         parent: site.find('sponsors')

The first query is correctly targeted. However, uploads don't land in the specified parent folder. When I remove the plugin, the files are uploaded in the correct folder again, so the issue is with the plugin.

It doesn’t work when files have templates

When uploading a file to a file section that uses a specific template, the file is uploaded but the template name is not written on the corrensponding metadata .txt file

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.