From 6e843f1382e760938f44d46fd799f449b46eb58a Mon Sep 17 00:00:00 2001
From: Milos Stojanovic
Date: Tue, 18 Jun 2019 14:27:56 +0200
Subject: [PATCH] Website generation with Couscous
---
configuration/auth.html | 19 +-
configuration/basic.html | 138 ++++++++++++++
configuration/session.html | 23 ++-
configuration/{default.html => storage.html} | 180 ++++++-------------
demo.html | 17 +-
license.html => development.html | 50 +++---
index.html | 17 +-
install.html | 17 +-
8 files changed, 284 insertions(+), 177 deletions(-)
create mode 100644 configuration/basic.html
rename configuration/{default.html => storage.html} (55%)
rename license.html => development.html (76%)
diff --git a/configuration/auth.html b/configuration/auth.html
index 46aa318..6867a4c 100644
--- a/configuration/auth.html
+++ b/configuration/auth.html
@@ -50,13 +50,13 @@
-
- Demo
+
+ Development
-
- License
+
+ Demo
@@ -66,8 +66,8 @@
@@ -86,7 +91,7 @@
- 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:
CREATE TABLE `users` (
diff --git a/configuration/basic.html b/configuration/basic.html
new file mode 100644
index 0000000..b1c4d37
--- /dev/null
+++ b/configuration/basic.html
@@ -0,0 +1,138 @@
+
+
+
+
+
+
+ FileGator
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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;
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/configuration/session.html b/configuration/session.html
index 4eda677..d099ef1 100644
--- a/configuration/session.html
+++ b/configuration/session.html
@@ -50,13 +50,13 @@
-
- Demo
+
+ Development
-
- License
+
+ Demo
@@ -66,8 +66,8 @@
@@ -86,7 +91,7 @@
- Configuring Session service to use database
+ Configuring Session service to use database
First, create a table sessions
with this sql:
CREATE TABLE `sessions` (
`sess_id` varbinary(128) NOT NULL,
@@ -113,8 +118,8 @@
],
Don't forget to enter correct mysql username, password, and database.
-Tweaking session options
-The Underying Symfony session component constructor accepts an array options.
+
Tweaking session options
+The Underying Symfony session component constructor accepts an array of options.
For example you can pass cookie_lifetime
parameter and extend session lifetime like this:
'Filegator\Services\Session\SessionStorageInterface' => [
'handler' => '\Filegator\Services\Session\Adapters\SessionStorage',
diff --git a/configuration/default.html b/configuration/storage.html
similarity index 55%
rename from configuration/default.html
rename to configuration/storage.html
index 2a54026..3a0bcb1 100644
--- a/configuration/default.html
+++ b/configuration/storage.html
@@ -50,13 +50,13 @@
-
- Demo
+
+ Development
-
- License
+
+ Demo
@@ -66,8 +66,8 @@
@@ -86,90 +91,12 @@
- 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' => [
+ Adapters
+Different storage adapters are supported via awesome 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' => '/',
@@ -181,8 +108,20 @@ In this file you can configure all the options, services and their handlers.
__DIR__.'/repository'
);
},
+ ],
+ ],
+ ],
+
+FTP Adapter
+See official documentation
+ 'Filegator\Services\Storage\Filesystem' => [
+ 'handler' => '\Filegator\Services\Storage\Filesystem',
+ 'config' => [
+ 'separator' => '/',
+ 'config' => [],
+ 'filesystem_adapter' => 'ftp',
+ 'adapters' => [
'ftp' => function () {
- // see: https://flysystem.thephpleague.com/docs/adapter/ftp/
return new \League\Flysystem\Adapter\Ftp([
'host' => 'example.com',
'username' => 'demo',
@@ -191,9 +130,21 @@ In this file you can configure all the options, services and their handlers.
'timeout' => 10,
]);
},
+ ],
+ ],
+ ],
+
+SFTP Adapter
+You must require additional library composer require league/flysystem-sftp
.
+See official documentation .
+ 'Filegator\Services\Storage\Filesystem' => [
+ 'handler' => '\Filegator\Services\Storage\Filesystem',
+ 'config' => [
+ 'separator' => '/',
+ 'config' => [],
+ 'filesystem_adapter' => 'sftp',
+ 'adapters' => [
'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,
@@ -202,9 +153,21 @@ In this file you can configure all the options, services and their handlers.
'timeout' => 10,
]);
},
+ ],
+ ],
+ ],
+
+Dropbox Adapter
+You must require additional library composer require spatie/flysystem-dropbox
.
+See official documentation
+ 'Filegator\Services\Storage\Filesystem' => [
+ 'handler' => '\Filegator\Services\Storage\Filesystem',
+ 'config' => [
+ 'separator' => '/',
+ 'config' => [],
+ 'filesystem_adapter' => 'dropbox',
+ 'adapters' => [
'dropbox' => function () {
- // composer require spatie/flysystem-dropbox
- // see: https://flysystem.thephpleague.com/docs/adapter/dropbox/
$authorizationToken = '1234';
$client = new \Spatie\Dropbox\Client($authorizationToken);
@@ -213,32 +176,7 @@ In this file you can configure all the options, services and their handlers.
],
],
],
- '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/demo.html b/demo.html
index 50a4e9c..29de875 100644
--- a/demo.html
+++ b/demo.html
@@ -50,13 +50,13 @@
-
- Demo
+
+ Development
-
- License
+
+ Demo
@@ -66,8 +66,8 @@
diff --git a/license.html b/development.html
similarity index 76%
rename from license.html
rename to development.html
index 7f902c1..7a914cf 100644
--- a/license.html
+++ b/development.html
@@ -50,13 +50,13 @@
-
- Demo
+
+ Development
-
- License
+
+ Demo
@@ -66,8 +66,8 @@
@@ -86,22 +91,23 @@
- 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.
+ 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.
diff --git a/index.html b/index.html
index d285470..db59102 100644
--- a/index.html
+++ b/index.html
@@ -50,13 +50,13 @@
-
- Demo
+
+ Development
-
- License
+
+ Demo
@@ -66,8 +66,8 @@
diff --git a/install.html b/install.html
index b2bbad2..5dabea2 100644
--- a/install.html
+++ b/install.html
@@ -50,13 +50,13 @@
-
- Demo
+
+ Development
-
- License
+
+ Demo
@@ -66,8 +66,8 @@