mirror of
https://github.com/filegator/filegator.git
synced 2025-04-22 07:42:09 +02:00
docs upd
This commit is contained in:
parent
7f3e111d49
commit
f8940c8713
@ -39,13 +39,6 @@ return [
|
||||
//$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);
|
||||
},
|
||||
],
|
||||
@ -92,35 +85,6 @@ return [
|
||||
__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);
|
||||
},
|
||||
],
|
||||
],
|
||||
],
|
||||
@ -133,14 +97,6 @@ return [
|
||||
'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',
|
||||
|
15
couscous.yml
15
couscous.yml
@ -28,21 +28,24 @@ menu:
|
||||
install:
|
||||
text: Installation
|
||||
relativeUrl: install.html
|
||||
development:
|
||||
text: Development
|
||||
relativeUrl: development.html
|
||||
demo:
|
||||
text: Demo
|
||||
absoluteUrl: demo.html
|
||||
license:
|
||||
text: License
|
||||
absoluteUrl: license.html
|
||||
relativeUrl: demo.html
|
||||
config:
|
||||
name: Configuration
|
||||
items:
|
||||
basic:
|
||||
text: Options
|
||||
relativeUrl: configuration/default.html
|
||||
text: Basic
|
||||
relativeUrl: configuration/basic.html
|
||||
auth:
|
||||
text: Auth
|
||||
relativeUrl: configuration/auth.html
|
||||
sessions:
|
||||
text: Session
|
||||
relativeUrl: configuration/session.html
|
||||
storate:
|
||||
text: Storage
|
||||
relativeUrl: configuration/storage.html
|
||||
|
@ -1,5 +1,4 @@
|
||||
|
||||
### Configuring Auth service to use database
|
||||
## Configuring Auth service to use database
|
||||
You can store your users inside mysql database (default is json file).
|
||||
|
||||
First, create a table ```users``` with this sql:
|
||||
|
32
docs/configuration/basic.md
Normal file
32
docs/configuration/basic.md
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
## Basic
|
||||
Edit ```configuration.php``` file to change basic things like logo, title, language and upload restrictions.
|
||||
|
||||
## Frontend tweaks
|
||||
You can change default color scheme and other options in ```/frontend/App.vue``` and recompile.
|
||||
|
||||
```
|
||||
// Primary color
|
||||
$primary: #34B891;
|
||||
$primary-invert: findColorInvert($primary);
|
||||
|
||||
$colors: (
|
||||
"primary": ($primary, $primary-invert),
|
||||
"info": ($info, $info-invert),
|
||||
"success": ($success, $success-invert),
|
||||
"warning": ($warning, $warning-invert),
|
||||
"danger": ($danger, $danger-invert),
|
||||
);
|
||||
|
||||
// Links
|
||||
$link: $primary;
|
||||
$link-invert: $primary-invert;
|
||||
$link-focus-border: $primary;
|
||||
|
||||
// Disable the widescreen breakpoint
|
||||
$widescreen-enabled: false;
|
||||
|
||||
// Disable the fullhd breakpoint
|
||||
$fullhd-enabled: false;
|
||||
```
|
||||
|
@ -1,159 +0,0 @@
|
||||
### Configuring FileGator
|
||||
All configuration options are stored inside ```configuration.php``` file.
|
||||
In this file you can configure all the options, services and their handlers.
|
||||
|
||||
|
||||
### Default 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',
|
||||
],
|
||||
],
|
||||
],
|
||||
```
|
@ -1,5 +1,5 @@
|
||||
|
||||
### Configuring Session service to use database
|
||||
## Configuring Session service to use database
|
||||
|
||||
First, create a table ```sessions``` with this sql:
|
||||
```
|
||||
@ -35,9 +35,9 @@ Then, open ```configuration.php``` and update Auth handler under section ```serv
|
||||
Don't forget to enter correct mysql username, password, and database.
|
||||
|
||||
|
||||
### Tweaking session options
|
||||
## Tweaking session options
|
||||
|
||||
The Underying Symfony session [component](https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php) constructor accepts an array options.
|
||||
The Underying Symfony session [component](https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php) constructor accepts an array of options.
|
||||
For example you can pass ```cookie_lifetime``` parameter and extend session lifetime like this:
|
||||
```
|
||||
'Filegator\Services\Session\SessionStorageInterface' => [
|
||||
|
102
docs/configuration/storage.md
Normal file
102
docs/configuration/storage.md
Normal file
@ -0,0 +1,102 @@
|
||||
## Adapters
|
||||
Different storage adapters are supported via awesome [Flysystem](https://github.com/thephpleague/flysystem) library.
|
||||
|
||||
You can use local filesystem (default), FTP, S3, Dropbox and many others. Please check Flysystem for exact setup for each adapter.
|
||||
|
||||
## Default Local Disk Adapter
|
||||
With default adapter you just need to configure where is you ```repository``` folder which will serve as root for everything else.
|
||||
|
||||
```
|
||||
'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 Adapter
|
||||
See official [documentation](https://flysystem.thephpleague.com/docs/adapter/ftp/)
|
||||
|
||||
```
|
||||
'Filegator\Services\Storage\Filesystem' => [
|
||||
'handler' => '\Filegator\Services\Storage\Filesystem',
|
||||
'config' => [
|
||||
'separator' => '/',
|
||||
'config' => [],
|
||||
'filesystem_adapter' => 'ftp',
|
||||
'adapters' => [
|
||||
'ftp' => function () {
|
||||
return new \League\Flysystem\Adapter\Ftp([
|
||||
'host' => 'example.com',
|
||||
'username' => 'demo',
|
||||
'password' => 'password',
|
||||
'port' => 21,
|
||||
'timeout' => 10,
|
||||
]);
|
||||
},
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
```
|
||||
|
||||
## SFTP Adapter
|
||||
You must require additional library ```composer require league/flysystem-sftp```.
|
||||
See official [documentation](https://flysystem.thephpleague.com/docs/adapter/sftp/).
|
||||
|
||||
```
|
||||
'Filegator\Services\Storage\Filesystem' => [
|
||||
'handler' => '\Filegator\Services\Storage\Filesystem',
|
||||
'config' => [
|
||||
'separator' => '/',
|
||||
'config' => [],
|
||||
'filesystem_adapter' => 'sftp',
|
||||
'adapters' => [
|
||||
'sftp' => function () {
|
||||
return new \League\Flysystem\Sftp\SftpAdapter([
|
||||
'host' => 'example.com',
|
||||
'port' => 22,
|
||||
'username' => 'demo',
|
||||
'password' => 'password',
|
||||
'timeout' => 10,
|
||||
]);
|
||||
},
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
```
|
||||
## Dropbox Adapter
|
||||
You must require additional library ```composer require spatie/flysystem-dropbox```.
|
||||
See official [documentation](https://flysystem.thephpleague.com/docs/adapter/dropbox/)
|
||||
|
||||
```
|
||||
'Filegator\Services\Storage\Filesystem' => [
|
||||
'handler' => '\Filegator\Services\Storage\Filesystem',
|
||||
'config' => [
|
||||
'separator' => '/',
|
||||
'config' => [],
|
||||
'filesystem_adapter' => 'dropbox',
|
||||
'adapters' => [
|
||||
'dropbox' => function () {
|
||||
$authorizationToken = '1234';
|
||||
$client = new \Spatie\Dropbox\Client($authorizationToken);
|
||||
|
||||
return new \Spatie\FlysystemDropbox\DropboxAdapter($client);
|
||||
},
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
```
|
32
docs/development.md
Normal file
32
docs/development.md
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
## Project setup for development
|
||||
|
||||
```
|
||||
git clone git@github.com:filegator/filegator.git
|
||||
cd filegator
|
||||
cp configuration_sample.php configuration.php
|
||||
sudo chmod -R 777 private/
|
||||
sudo chmod -R 777 repository/
|
||||
composer install
|
||||
npm install
|
||||
npm run build
|
||||
```
|
||||
|
||||
## Compiles and hot-reloads (backend and frontend on ports 8081 and 8080)
|
||||
|
||||
```
|
||||
npm run serve
|
||||
```
|
||||
Once everything is ready visit: ```http://localhost:8080```
|
||||
|
||||
## Run tests & static analysis
|
||||
|
||||
```
|
||||
vendor/bin/phpunit
|
||||
vendor/bin/phpstan analyse ./backend
|
||||
```
|
||||
|
||||
## Deployment
|
||||
|
||||
Set the website document root to ```/dist``` directory.
|
||||
|
@ -1,20 +0,0 @@
|
||||
|
||||
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.
|
Loading…
x
Reference in New Issue
Block a user