diff --git a/.gitignore b/.gitignore index 2128a6a..b8b5b42 100644 --- a/.gitignore +++ b/.gitignore @@ -18,7 +18,7 @@ yarn-error.log* # Cache files .*.cache -.couscous +.couscous/ # Editor directories and files .DS_Store diff --git a/couscous.yml b/couscous.yml new file mode 100644 index 0000000..a8d2684 --- /dev/null +++ b/couscous.yml @@ -0,0 +1,49 @@ +include: + - docs + +exclude: + - private + - backend + - database + - dist + - tests + - frontend + - repository + - tests + # This special entry will ask Couscous to read the excluded directories from your ".gitignore" file + - %gitignore% + +cname: docs.filegator.io + +branch: gh-pages + +title: FileGator +subTitle: Documentation + +baseUrl: http://docs.filegator.io/filegator + +template: + url: https://github.com/CouscousPHP/Template-Light + +github: + user: filegator + repo: filegator + +# The left menu bar +menu: + items: + home: + text: What is FileGator + relativeUrl: index.html + install: + text: Installation + relativeUrl: install.html + config: + text: Configuration + relativeUrl: configuration.html + demo: + text: Demo + absoluteUrl: demo.html + license: + text: License + absoluteUrl: license.html diff --git a/docs/README.md b/docs/README.md index edb613f..5c4023a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1 +1,27 @@ ## FileGator + +FileGator is PHP script for managing online files and folders. + +You can manage files inside your local repository folder (on your server's hard drive) or connect to other storage adaptes (see below). + +FileGator has multi-user support so you can have admins and other users managing files with different access permissions, roles and home folders. + +All basic file operations are supported: copy, move, rename, create, delete, zip, unzip, download, upload. + +If allowed, users can download multiple files or folders at once. + + +File upload supports drag&drop, progress bar, pause and resume. Upload is chunked so you should be able to upload large files regardless of your server configuration. + + +## Features & Goals +- Multiple storage adapters (Local, FTP, S3, Dropbox and many others via [Flysystem](https://github.com/thephpleague/flysystem)) +- Multiple auth adapters with roles and permissions (Store users in json file or database) +- Multiple session adapters (Native File, Pdo, MongoDB, Memcached and others via [Symfony](https://github.com/symfony/symfony/tree/master/src/Symfony/Component/HttpFoundation/Session/Storage/Handler)) +- Single page front-end (built with [Vuejs](https://github.com/vuejs/vue), [Bulma](https://github.com/jgthms/bulma) and [Buefy](https://github.com/buefy/buefy)) +- Chunked uploads (built with [Resumable.js](https://github.com/23/resumable.js)) +- Zip and bulk download support +- Highly extensible, decoupled and tested code +- No database required +- Framework free [™](https://www.youtube.com/watch?v=L5jI9I03q8E) + diff --git a/docs/configuration.md b/docs/configuration.md new file mode 100644 index 0000000..0b8c3ae --- /dev/null +++ b/docs/configuration.md @@ -0,0 +1,153 @@ +### Configuration options: + +``` + 'public_path' => APP_PUBLIC_PATH, + 'public_dir' => APP_PUBLIC_DIR, + + 'frontend_config' => [ + 'app_name' => 'FileGator', + 'app_version' => APP_VERSION, + 'language' => 'english', + 'logo' => 'https://raw.githubusercontent.com/filegator/filegator/master/dist/img/logo.png', + 'upload_max_size' => 100 * 1024 * 1024, // 100MB + 'upload_chunk_size' => 1 * 1024 * 1024, // 1MB + 'upload_simultaneous' => 3, + 'default_archive_name' => 'archive.zip', + ], + + 'services' => [ + 'Filegator\Services\Logger\LoggerInterface' => [ + 'handler' => '\Filegator\Services\Logger\Adapters\MonoLogger', + 'config' => [ + 'monolog_handlers' => [ + function () { + return new \Monolog\Handler\StreamHandler( + __DIR__.'/private/logs/app.log', + \Monolog\Logger::DEBUG + ); + }, + ], + ], + ], + 'Filegator\Services\Session\SessionStorageInterface' => [ + 'handler' => '\Filegator\Services\Session\Adapters\SessionStorage', + 'config' => [ + 'session_handler' => 'filesession', + 'available' => [ + 'filesession' => function () { + $save_path = null; // use default system path + //$save_path = __DIR__.'/private/sessions'; + $handler = new \Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler($save_path); + + return new \Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage([], $handler); + }, + 'database' => function () { + $handler = new \Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler( + 'mysql://root:password@localhost:3360/filegator' + ); + + return new \Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage([], $handler); + }, + ], + ], + ], + 'Filegator\Services\Cors\Cors' => [ + 'handler' => '\Filegator\Services\Cors\Cors', + 'config' => [ + 'enabled' => APP_ENV == 'production' ? false : true, + ], + ], + 'Filegator\Services\Tmpfs\TmpfsInterface' => [ + 'handler' => '\Filegator\Services\Tmpfs\Adapters\Tmpfs', + 'config' => [ + 'path' => __DIR__.'/private/tmp/', + 'gc_probability_perc' => 10, + 'gc_older_than' => 60 * 60 * 24 * 2, // 2 days + ], + ], + 'Filegator\Services\Security\Security' => [ + 'handler' => '\Filegator\Services\Security\Security', + 'config' => [ + 'csrf_protection' => true, + 'ip_whitelist' => [], + 'ip_blacklist' => [], + ], + ], + 'Filegator\Services\View\ViewInterface' => [ + 'handler' => '\Filegator\Services\View\Adapters\Vuejs', + 'config' => [ + 'add_to_head' => '', + 'add_to_body' => '', + ], + ], + 'Filegator\Services\Storage\Filesystem' => [ + 'handler' => '\Filegator\Services\Storage\Filesystem', + 'config' => [ + 'separator' => '/', + 'config' => [], + 'filesystem_adapter' => 'localfilesystem', + 'adapters' => [ + 'localfilesystem' => function () { + return new \League\Flysystem\Adapter\Local( + __DIR__.'/repository' + ); + }, + 'ftp' => function () { + // see: https://flysystem.thephpleague.com/docs/adapter/ftp/ + return new \League\Flysystem\Adapter\Ftp([ + 'host' => 'example.com', + 'username' => 'demo', + 'password' => 'password', + 'port' => 21, + 'timeout' => 10, + ]); + }, + 'sftp' => function () { + // composer require league/flysystem-sftp + // see: https://flysystem.thephpleague.com/docs/adapter/sftp/ + return new \League\Flysystem\Sftp\SftpAdapter([ + 'host' => 'example.com', + 'port' => 22, + 'username' => 'demo', + 'password' => 'password', + 'timeout' => 10, + ]); + }, + 'dropbox' => function () { + // composer require spatie/flysystem-dropbox + // see: https://flysystem.thephpleague.com/docs/adapter/dropbox/ + $authorizationToken = '1234'; + $client = new \Spatie\Dropbox\Client($authorizationToken); + + return new \Spatie\FlysystemDropbox\DropboxAdapter($client); + }, + ], + ], + ], + 'Filegator\Services\Archiver\ArchiverInterface' => [ + 'handler' => '\Filegator\Services\Archiver\Adapters\ZipArchiver', + 'config' => [], + ], + 'Filegator\Services\Auth\AuthInterface' => [ + 'handler' => '\Filegator\Services\Auth\Adapters\JsonFile', + 'config' => [ + 'file' => __DIR__.'/private/users.json', + ], + //'handler' => '\Filegator\Services\Auth\Adapters\Database', + //'config' => [ + // 'driver' => 'mysqli', + // 'host' => 'localhost', + // 'username' => 'root', + // 'password' => 'password', + // 'database' => 'filegator', + //], + ], + 'Filegator\Services\Router\Router' => [ + 'handler' => '\Filegator\Services\Router\Router', + 'config' => [ + 'query_param' => 'r', + 'routes_file' => __DIR__.'/backend/Controllers/routes.php', + ], + ], + ], +``` diff --git a/docs/demo.md b/docs/demo.md new file mode 100644 index 0000000..db733a5 --- /dev/null +++ b/docs/demo.md @@ -0,0 +1,5 @@ +## Demo +[https://demo.filegator.io](https://demo.filegator.io) + +This is read-only demo with guest account enabled. +You can also log in with john/john to see John's private files. diff --git a/docs/install.md b/docs/install.md new file mode 100644 index 0000000..007823d --- /dev/null +++ b/docs/install.md @@ -0,0 +1,14 @@ + +## Requirements +- PHP 7.1.3+ + + +## Download precompiled build +- Latest: [v7.0.0-RC2](https://github.com/filegator/static/raw/master/builds/filegator_v7.0.0-RC2.zip) +- Unzip files and upload them to your PHP server +- Make sure you webserver can read and write to ```/storage``` and ```/private``` folders +- Set the website document root to ```/dist``` directory +- Visit web page, if something goes wrong check ```/private/logs/app.log``` +- Login with default credentials ```admin/admin123``` +- Change default admin's password +- Adjust ```configuration.php``` file diff --git a/docs/license.md b/docs/license.md new file mode 100644 index 0000000..22cba4e --- /dev/null +++ b/docs/license.md @@ -0,0 +1,19 @@ +Copyright (c) 2012-2019 Milos Stojanovic + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE.