Website generation with Couscous

This commit is contained in:
Milos Stojanovic
2019-06-18 13:44:29 +02:00
parent 13ade60e94
commit 6c708b6a47
12 changed files with 622 additions and 366 deletions

137
configuration/auth.html Normal file
View File

@@ -0,0 +1,137 @@
<!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="demo.html">
Demo
</a>
</li>
<li class="">
<a href="license.html">
License
</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/default.html">
Options
</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>
</ul>
</nav>
<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>
<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` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`username` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL,
`role` varchar(20) NOT NULL,
`permissions` varchar(200) NOT NULL,
`homedir` varchar(2000) NOT NULL,
`password` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
KEY `username` (`username`)
) CHARSET=utf8 COLLATE=utf8_bin;</code></pre>
<p>Then, import default users with this query:</p>
<pre><code>INSERT INTO `users` (`username`, `name`, `role`, `permissions`, `homedir`, `password`)
VALUES
('guest', 'Guest', 'guest', '', '/', ''),
('admin', 'Admin', 'admin', 'read|write|upload|download|batchdownload|zip', '/', '$2y$10$Nu35w4pteLfc7BDCIkDPkecjw8wsH8Y2GMfIewUbXLT7zzW6WOxwq');</code></pre>
<p>Ath the end, open <code>configuration.php</code> and update Auth handler under section <code>services</code> to something like this:</p>
<pre><code> 'Filegator\Services\Auth\AuthInterface' =&gt; [
'handler' =&gt; '\Filegator\Services\Auth\Adapters\Database',
'config' =&gt; [
'driver' =&gt; 'mysqli',
'host' =&gt; 'localhost',
'username' =&gt; 'root',
'password' =&gt; 'password',
'database' =&gt; 'filegator',
],
],</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>

260
configuration/default.html Normal file
View File

@@ -0,0 +1,260 @@
<!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="demo.html">
Demo
</a>
</li>
<li class="">
<a href="license.html">
License
</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/default.html">
Options
</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>
</ul>
</nav>
<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; [
'handler' =&gt; '\Filegator\Services\Storage\Filesystem',
'config' =&gt; [
'separator' =&gt; '/',
'config' =&gt; [],
'filesystem_adapter' =&gt; 'localfilesystem',
'adapters' =&gt; [
'localfilesystem' =&gt; function () {
return new \League\Flysystem\Adapter\Local(
__DIR__.'/repository'
);
},
'ftp' =&gt; function () {
// see: https://flysystem.thephpleague.com/docs/adapter/ftp/
return new \League\Flysystem\Adapter\Ftp([
'host' =&gt; 'example.com',
'username' =&gt; 'demo',
'password' =&gt; 'password',
'port' =&gt; 21,
'timeout' =&gt; 10,
]);
},
'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,
'username' =&gt; 'demo',
'password' =&gt; 'password',
'timeout' =&gt; 10,
]);
},
'dropbox' =&gt; 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' =&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>
</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>

155
configuration/session.html Normal file
View File

@@ -0,0 +1,155 @@
<!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="demo.html">
Demo
</a>
</li>
<li class="">
<a href="license.html">
License
</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/default.html">
Options
</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>
</ul>
</nav>
<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>
<p>First, create a table <code>sessions</code> with this sql:</p>
<pre><code>CREATE TABLE `sessions` (
`sess_id` varbinary(128) NOT NULL,
`sess_data` blob NOT NULL,
`sess_lifetime` mediumint(9) NOT NULL,
`sess_time` int(10) unsigned NOT NULL,
PRIMARY KEY (`sess_id`)
) CHARSET=utf8 COLLATE=utf8_bin;</code></pre>
<p>Then, open <code>configuration.php</code> and update Auth handler under section <code>services</code> to something like this:</p>
<pre><code> 'Filegator\Services\Session\SessionStorageInterface' =&gt; [
'handler' =&gt; '\Filegator\Services\Session\Adapters\SessionStorage',
'config' =&gt; [
'session_handler' =&gt; 'database',
'available' =&gt; [
'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);
},
],
],
],
</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.
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',
'config' =&gt; [
'session_handler' =&gt; 'database',
'available' =&gt; [
'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([
'cookie_lifetime' =&gt; 365 * 24 * 60 * 60, // one year
], $handler);
},
],
],
],
</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>