Website generation with Couscous

This commit is contained in:
Milos Stojanovic
2019-06-18 14:27:56 +02:00
parent 6c708b6a47
commit 6e843f1382
8 changed files with 284 additions and 177 deletions

View File

@@ -50,13 +50,13 @@
</a>
</li>
<li class="">
<a href="demo.html">
Demo
<a href="https://docs.filegator.io/development.html">
Development
</a>
</li>
<li class="">
<a href="license.html">
License
<a href="https://docs.filegator.io/demo.html">
Demo
</a>
</li>
</ul>
@@ -66,8 +66,8 @@
<ul class="nav nav-pills nav-stacked">
<li class="">
<a href="https://docs.filegator.io/configuration/default.html">
Options
<a href="https://docs.filegator.io/configuration/basic.html">
Basic
</a>
</li>
<li class="">
@@ -79,6 +79,11 @@
<a href="https://docs.filegator.io/configuration/session.html">
Session
</a>
</li>
<li class="">
<a href="https://docs.filegator.io/configuration/storage.html">
Storage
</a>
</li>
</ul>
@@ -86,7 +91,7 @@
<section class="col-sm-offset-3 col-lg-offset-2 col-sm-9 col-lg-10">
<h3 id="configuring-auth-service-to-use-database">Configuring Auth service to use database</h3>
<h2 id="configuring-auth-service-to-use-database">Configuring Auth service to use database</h2>
<p>You can store your users inside mysql database (default is json file).</p>
<p>First, create a table <code>users</code> with this sql:</p>
<pre><code>CREATE TABLE `users` (

138
configuration/basic.html Normal file
View File

@@ -0,0 +1,138 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>FileGator</title>
<link rel="stylesheet" href="https://docs.filegator.io/css/bootstrap.min.css">
<link rel="stylesheet" href="https://docs.filegator.io/css/font-awesome.min.css">
<link rel="stylesheet" href="https://docs.filegator.io/css/highlight.tomorrow-night.css">
<link rel="stylesheet" href="https://docs.filegator.io/css/main.css">
</head>
<body>
<header class="navbar navbar-default navbar-fixed-top">
<a class="navbar-brand" href="https://docs.filegator.io/">
FileGator
<small class="hidden-xs hidden-sm">
Documentation
</small>
</a>
<a href="https://github.com/filegator/filegator">
<img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png">
</a>
</header>
<main class="container-fluid">
<div class="row">
<nav id="sidebar" class="col-sm-3 col-lg-2" role="navigation">
<p class="text-muted">
Getting Started
</p>
<ul class="nav nav-pills nav-stacked">
<li class="">
<a href="https://docs.filegator.io/index.html">
What is FileGator
</a>
</li>
<li class="">
<a href="https://docs.filegator.io/install.html">
Installation
</a>
</li>
<li class="">
<a href="https://docs.filegator.io/development.html">
Development
</a>
</li>
<li class="">
<a href="https://docs.filegator.io/demo.html">
Demo
</a>
</li>
</ul>
<p class="text-muted">
Configuration
</p>
<ul class="nav nav-pills nav-stacked">
<li class="">
<a href="https://docs.filegator.io/configuration/basic.html">
Basic
</a>
</li>
<li class="">
<a href="https://docs.filegator.io/configuration/auth.html">
Auth
</a>
</li>
<li class="">
<a href="https://docs.filegator.io/configuration/session.html">
Session
</a>
</li>
<li class="">
<a href="https://docs.filegator.io/configuration/storage.html">
Storage
</a>
</li>
</ul>
</nav>
<section class="col-sm-offset-3 col-lg-offset-2 col-sm-9 col-lg-10">
<h2 id="basic">Basic</h2>
<p>Edit <code>configuration.php</code> file to change basic things like logo, title, language and upload restrictions.</p>
<h2 id="frontend-tweaks">Frontend tweaks</h2>
<p>You can change default color scheme and other options in <code>/frontend/App.vue</code> and recompile.</p>
<pre><code>// 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;</code></pre>
</section>
</div>
</main>
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<script src="//yandex.st/highlightjs/7.5/highlight.min.js"></script>
<script>
$(function() {
$("section>h1").wrap('<div class="page-header" />');
// Syntax highlighting
hljs.initHighlightingOnLoad();
});
</script>
</body>
</html>

View File

@@ -50,13 +50,13 @@
</a>
</li>
<li class="">
<a href="demo.html">
Demo
<a href="https://docs.filegator.io/development.html">
Development
</a>
</li>
<li class="">
<a href="license.html">
License
<a href="https://docs.filegator.io/demo.html">
Demo
</a>
</li>
</ul>
@@ -66,8 +66,8 @@
<ul class="nav nav-pills nav-stacked">
<li class="">
<a href="https://docs.filegator.io/configuration/default.html">
Options
<a href="https://docs.filegator.io/configuration/basic.html">
Basic
</a>
</li>
<li class="">
@@ -79,6 +79,11 @@
<a href="https://docs.filegator.io/configuration/session.html">
Session
</a>
</li>
<li class="">
<a href="https://docs.filegator.io/configuration/storage.html">
Storage
</a>
</li>
</ul>
@@ -86,7 +91,7 @@
<section class="col-sm-offset-3 col-lg-offset-2 col-sm-9 col-lg-10">
<h3 id="configuring-session-service-to-use-database">Configuring Session service to use database</h3>
<h2 id="configuring-session-service-to-use-database">Configuring Session service to use database</h2>
<p>First, create a table <code>sessions</code> with this sql:</p>
<pre><code>CREATE TABLE `sessions` (
`sess_id` varbinary(128) NOT NULL,
@@ -113,8 +118,8 @@
],
</code></pre>
<p>Don't forget to enter correct mysql username, password, and database.</p>
<h3 id="tweaking-session-options">Tweaking session options</h3>
<p>The Underying Symfony session <a href="https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php">component</a> constructor accepts an array options.
<h2 id="tweaking-session-options">Tweaking session options</h2>
<p>The Underying Symfony session <a href="https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php">component</a> constructor accepts an array of options.
For example you can pass <code>cookie_lifetime</code> parameter and extend session lifetime like this:</p>
<pre><code> 'Filegator\Services\Session\SessionStorageInterface' =&gt; [
'handler' =&gt; '\Filegator\Services\Session\Adapters\SessionStorage',

View File

@@ -50,13 +50,13 @@
</a>
</li>
<li class="">
<a href="demo.html">
Demo
<a href="https://docs.filegator.io/development.html">
Development
</a>
</li>
<li class="">
<a href="license.html">
License
<a href="https://docs.filegator.io/demo.html">
Demo
</a>
</li>
</ul>
@@ -66,8 +66,8 @@
<ul class="nav nav-pills nav-stacked">
<li class="">
<a href="https://docs.filegator.io/configuration/default.html">
Options
<a href="https://docs.filegator.io/configuration/basic.html">
Basic
</a>
</li>
<li class="">
@@ -79,6 +79,11 @@
<a href="https://docs.filegator.io/configuration/session.html">
Session
</a>
</li>
<li class="">
<a href="https://docs.filegator.io/configuration/storage.html">
Storage
</a>
</li>
</ul>
@@ -86,90 +91,12 @@
<section class="col-sm-offset-3 col-lg-offset-2 col-sm-9 col-lg-10">
<h3 id="configuring-filegator">Configuring FileGator</h3>
<p>All configuration options are stored inside <code>configuration.php</code> file.
In this file you can configure all the options, services and their handlers.</p>
<h3 id="default-configuration-options">Default Configuration options</h3>
<pre><code> 'public_path' =&gt; APP_PUBLIC_PATH,
'public_dir' =&gt; APP_PUBLIC_DIR,
'frontend_config' =&gt; [
'app_name' =&gt; 'FileGator',
'app_version' =&gt; APP_VERSION,
'language' =&gt; 'english',
'logo' =&gt; 'https://raw.githubusercontent.com/filegator/filegator/master/dist/img/logo.png',
'upload_max_size' =&gt; 100 * 1024 * 1024, // 100MB
'upload_chunk_size' =&gt; 1 * 1024 * 1024, // 1MB
'upload_simultaneous' =&gt; 3,
'default_archive_name' =&gt; 'archive.zip',
],
'services' =&gt; [
'Filegator\Services\Logger\LoggerInterface' =&gt; [
'handler' =&gt; '\Filegator\Services\Logger\Adapters\MonoLogger',
'config' =&gt; [
'monolog_handlers' =&gt; [
function () {
return new \Monolog\Handler\StreamHandler(
__DIR__.'/private/logs/app.log',
\Monolog\Logger::DEBUG
);
},
],
],
],
'Filegator\Services\Session\SessionStorageInterface' =&gt; [
'handler' =&gt; '\Filegator\Services\Session\Adapters\SessionStorage',
'config' =&gt; [
'session_handler' =&gt; 'filesession',
'available' =&gt; [
'filesession' =&gt; 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' =&gt; 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' =&gt; [
'handler' =&gt; '\Filegator\Services\Cors\Cors',
'config' =&gt; [
'enabled' =&gt; APP_ENV == 'production' ? false : true,
],
],
'Filegator\Services\Tmpfs\TmpfsInterface' =&gt; [
'handler' =&gt; '\Filegator\Services\Tmpfs\Adapters\Tmpfs',
'config' =&gt; [
'path' =&gt; __DIR__.'/private/tmp/',
'gc_probability_perc' =&gt; 10,
'gc_older_than' =&gt; 60 * 60 * 24 * 2, // 2 days
],
],
'Filegator\Services\Security\Security' =&gt; [
'handler' =&gt; '\Filegator\Services\Security\Security',
'config' =&gt; [
'csrf_protection' =&gt; true,
'ip_whitelist' =&gt; [],
'ip_blacklist' =&gt; [],
],
],
'Filegator\Services\View\ViewInterface' =&gt; [
'handler' =&gt; '\Filegator\Services\View\Adapters\Vuejs',
'config' =&gt; [
'add_to_head' =&gt; '',
'add_to_body' =&gt; '',
],
],
'Filegator\Services\Storage\Filesystem' =&gt; [
<h2 id="adapters">Adapters</h2>
<p>Different storage adapters are supported via awesome <a href="https://github.com/thephpleague/flysystem">Flysystem</a> library.</p>
<p>You can use local filesystem (default), FTP, S3, Dropbox and many others. Please check Flysystem for exact setup for each adapter.</p>
<h2 id="default-local-disk-adapter">Default Local Disk Adapter</h2>
<p>With default adapter you just need to configure where is you <code>repository</code> folder which will serve as root for everything else.</p>
<pre><code> 'Filegator\Services\Storage\Filesystem' =&gt; [
'handler' =&gt; '\Filegator\Services\Storage\Filesystem',
'config' =&gt; [
'separator' =&gt; '/',
@@ -181,8 +108,20 @@ In this file you can configure all the options, services and their handlers.</p>
__DIR__.'/repository'
);
},
],
],
],
</code></pre>
<h2 id="ftp-adapter">FTP Adapter</h2>
<p>See official <a href="https://flysystem.thephpleague.com/docs/adapter/ftp/">documentation</a></p>
<pre><code> 'Filegator\Services\Storage\Filesystem' =&gt; [
'handler' =&gt; '\Filegator\Services\Storage\Filesystem',
'config' =&gt; [
'separator' =&gt; '/',
'config' =&gt; [],
'filesystem_adapter' =&gt; 'ftp',
'adapters' =&gt; [
'ftp' =&gt; function () {
// see: https://flysystem.thephpleague.com/docs/adapter/ftp/
return new \League\Flysystem\Adapter\Ftp([
'host' =&gt; 'example.com',
'username' =&gt; 'demo',
@@ -191,9 +130,21 @@ In this file you can configure all the options, services and their handlers.</p>
'timeout' =&gt; 10,
]);
},
],
],
],
</code></pre>
<h2 id="sftp-adapter">SFTP Adapter</h2>
<p>You must require additional library <code>composer require league/flysystem-sftp</code>.
See official <a href="https://flysystem.thephpleague.com/docs/adapter/sftp/">documentation</a>.</p>
<pre><code> 'Filegator\Services\Storage\Filesystem' =&gt; [
'handler' =&gt; '\Filegator\Services\Storage\Filesystem',
'config' =&gt; [
'separator' =&gt; '/',
'config' =&gt; [],
'filesystem_adapter' =&gt; 'sftp',
'adapters' =&gt; [
'sftp' =&gt; function () {
// composer require league/flysystem-sftp
// see: https://flysystem.thephpleague.com/docs/adapter/sftp/
return new \League\Flysystem\Sftp\SftpAdapter([
'host' =&gt; 'example.com',
'port' =&gt; 22,
@@ -202,9 +153,21 @@ In this file you can configure all the options, services and their handlers.</p>
'timeout' =&gt; 10,
]);
},
],
],
],
</code></pre>
<h2 id="dropbox-adapter">Dropbox Adapter</h2>
<p>You must require additional library <code>composer require spatie/flysystem-dropbox</code>.
See official <a href="https://flysystem.thephpleague.com/docs/adapter/dropbox/">documentation</a></p>
<pre><code> 'Filegator\Services\Storage\Filesystem' =&gt; [
'handler' =&gt; '\Filegator\Services\Storage\Filesystem',
'config' =&gt; [
'separator' =&gt; '/',
'config' =&gt; [],
'filesystem_adapter' =&gt; 'dropbox',
'adapters' =&gt; [
'dropbox' =&gt; 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.</p>
],
],
],
'Filegator\Services\Archiver\ArchiverInterface' =&gt; [
'handler' =&gt; '\Filegator\Services\Archiver\Adapters\ZipArchiver',
'config' =&gt; [],
],
'Filegator\Services\Auth\AuthInterface' =&gt; [
'handler' =&gt; '\Filegator\Services\Auth\Adapters\JsonFile',
'config' =&gt; [
'file' =&gt; __DIR__.'/private/users.json',
],
//'handler' =&gt; '\Filegator\Services\Auth\Adapters\Database',
//'config' =&gt; [
// 'driver' =&gt; 'mysqli',
// 'host' =&gt; 'localhost',
// 'username' =&gt; 'root',
// 'password' =&gt; 'password',
// 'database' =&gt; 'filegator',
//],
],
'Filegator\Services\Router\Router' =&gt; [
'handler' =&gt; '\Filegator\Services\Router\Router',
'config' =&gt; [
'query_param' =&gt; 'r',
'routes_file' =&gt; __DIR__.'/backend/Controllers/routes.php',
],
],
],</code></pre>
</code></pre>
</section>
</div>

View File

@@ -50,13 +50,13 @@
</a>
</li>
<li class="">
<a href="demo.html">
Demo
<a href="https://docs.filegator.io/development.html">
Development
</a>
</li>
<li class="">
<a href="license.html">
License
<a href="https://docs.filegator.io/demo.html">
Demo
</a>
</li>
</ul>
@@ -66,8 +66,8 @@
<ul class="nav nav-pills nav-stacked">
<li class="">
<a href="https://docs.filegator.io/configuration/default.html">
Options
<a href="https://docs.filegator.io/configuration/basic.html">
Basic
</a>
</li>
<li class="">
@@ -79,6 +79,11 @@
<a href="https://docs.filegator.io/configuration/session.html">
Session
</a>
</li>
<li class="">
<a href="https://docs.filegator.io/configuration/storage.html">
Storage
</a>
</li>
</ul>

View File

@@ -50,13 +50,13 @@
</a>
</li>
<li class="">
<a href="demo.html">
Demo
<a href="https://docs.filegator.io/development.html">
Development
</a>
</li>
<li class="">
<a href="license.html">
License
<a href="https://docs.filegator.io/demo.html">
Demo
</a>
</li>
</ul>
@@ -66,8 +66,8 @@
<ul class="nav nav-pills nav-stacked">
<li class="">
<a href="https://docs.filegator.io/configuration/default.html">
Options
<a href="https://docs.filegator.io/configuration/basic.html">
Basic
</a>
</li>
<li class="">
@@ -79,6 +79,11 @@
<a href="https://docs.filegator.io/configuration/session.html">
Session
</a>
</li>
<li class="">
<a href="https://docs.filegator.io/configuration/storage.html">
Storage
</a>
</li>
</ul>
@@ -86,22 +91,23 @@
<section class="col-sm-offset-3 col-lg-offset-2 col-sm-9 col-lg-10">
<p>Copyright (c) 2012-2019 Milos Stojanovic</p>
<p>Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the &quot;Software&quot;), 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:</p>
<p>The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.</p>
<p>THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, 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.</p>
<h2 id="project-setup-for-development">Project setup for development</h2>
<pre><code>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</code></pre>
<h2 id="compiles-and-hot-reloads-backend-and-frontend-on-ports-8081-and-8080">Compiles and hot-reloads (backend and frontend on ports 8081 and 8080)</h2>
<pre><code>npm run serve</code></pre>
<p>Once everything is ready visit: <code>http://localhost:8080</code></p>
<h2 id="run-tests-amp-static-analysis">Run tests &amp; static analysis</h2>
<pre><code>vendor/bin/phpunit
vendor/bin/phpstan analyse ./backend</code></pre>
<h2 id="deployment">Deployment</h2>
<p>Set the website document root to <code>/dist</code> directory.</p>
</section>
</div>

View File

@@ -50,13 +50,13 @@
</a>
</li>
<li class="">
<a href="demo.html">
Demo
<a href="https://docs.filegator.io/development.html">
Development
</a>
</li>
<li class="">
<a href="license.html">
License
<a href="https://docs.filegator.io/demo.html">
Demo
</a>
</li>
</ul>
@@ -66,8 +66,8 @@
<ul class="nav nav-pills nav-stacked">
<li class="">
<a href="https://docs.filegator.io/configuration/default.html">
Options
<a href="https://docs.filegator.io/configuration/basic.html">
Basic
</a>
</li>
<li class="">
@@ -79,6 +79,11 @@
<a href="https://docs.filegator.io/configuration/session.html">
Session
</a>
</li>
<li class="">
<a href="https://docs.filegator.io/configuration/storage.html">
Storage
</a>
</li>
</ul>

View File

@@ -50,13 +50,13 @@
</a>
</li>
<li class="">
<a href="demo.html">
Demo
<a href="https://docs.filegator.io/development.html">
Development
</a>
</li>
<li class="">
<a href="license.html">
License
<a href="https://docs.filegator.io/demo.html">
Demo
</a>
</li>
</ul>
@@ -66,8 +66,8 @@
<ul class="nav nav-pills nav-stacked">
<li class="">
<a href="https://docs.filegator.io/configuration/default.html">
Options
<a href="https://docs.filegator.io/configuration/basic.html">
Basic
</a>
</li>
<li class="">
@@ -79,6 +79,11 @@
<a href="https://docs.filegator.io/configuration/session.html">
Session
</a>
</li>
<li class="">
<a href="https://docs.filegator.io/configuration/storage.html">
Storage
</a>
</li>
</ul>