diff --git a/.gitignore b/.gitignore index 0389912..084f476 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,7 @@ .vscode/ .fleet/ *.iml + + +/uploads/* +!uploads/.gitkeep \ No newline at end of file diff --git a/assets/controllers/hello_controller.js b/assets/controllers/hello_controller.js deleted file mode 100644 index e847027..0000000 --- a/assets/controllers/hello_controller.js +++ /dev/null @@ -1,16 +0,0 @@ -import { Controller } from '@hotwired/stimulus'; - -/* - * This is an example Stimulus controller! - * - * Any element with a data-controller="hello" attribute will cause - * this controller to be executed. The name "hello" comes from the filename: - * hello_controller.js -> "hello" - * - * Delete this file or adapt it for your use! - */ -export default class extends Controller { - connect() { - this.element.textContent = 'Hello Stimulus! Edit me in assets/controllers/hello_controller.js'; - } -} diff --git a/assets/styles/app.css b/assets/styles/app.css index dd6181a..b5c61c9 100644 --- a/assets/styles/app.css +++ b/assets/styles/app.css @@ -1,3 +1,3 @@ -body { - background-color: skyblue; -} +@tailwind base; +@tailwind components; +@tailwind utilities; diff --git a/composer.json b/composer.json index 770aaad..9e581eb 100644 --- a/composer.json +++ b/composer.json @@ -11,6 +11,8 @@ "doctrine/doctrine-bundle": "^2.13", "doctrine/doctrine-migrations-bundle": "^3.3", "doctrine/orm": "^3.3", + "league/flysystem": "^3.0", + "oneup/flysystem-bundle": "^4", "phpdocumentor/reflection-docblock": "^5.6", "phpstan/phpdoc-parser": "^2.0", "symfony/asset": "7.2.*", @@ -42,6 +44,7 @@ "symfony/validator": "7.2.*", "symfony/web-link": "7.2.*", "symfony/yaml": "7.2.*", + "symfonycasts/tailwind-bundle": "^0.6.1", "twig/extra-bundle": "^2.12|^3.0", "twig/twig": "^2.12|^3.0" }, diff --git a/composer.lock b/composer.lock index d314cff..65d7b97 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7fe141192d025e96fd12623b527e4e9a", + "content-hash": "c8e8b543137984b211315030412feaf7", "packages": [ { "name": "composer/semver", @@ -1377,6 +1377,194 @@ ], "time": "2024-12-27T00:36:43+00:00" }, + { + "name": "league/flysystem", + "version": "3.29.1", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem.git", + "reference": "edc1bb7c86fab0776c3287dbd19b5fa278347319" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/edc1bb7c86fab0776c3287dbd19b5fa278347319", + "reference": "edc1bb7c86fab0776c3287dbd19b5fa278347319", + "shasum": "" + }, + "require": { + "league/flysystem-local": "^3.0.0", + "league/mime-type-detection": "^1.0.0", + "php": "^8.0.2" + }, + "conflict": { + "async-aws/core": "<1.19.0", + "async-aws/s3": "<1.14.0", + "aws/aws-sdk-php": "3.209.31 || 3.210.0", + "guzzlehttp/guzzle": "<7.0", + "guzzlehttp/ringphp": "<1.1.1", + "phpseclib/phpseclib": "3.0.15", + "symfony/http-client": "<5.2" + }, + "require-dev": { + "async-aws/s3": "^1.5 || ^2.0", + "async-aws/simple-s3": "^1.1 || ^2.0", + "aws/aws-sdk-php": "^3.295.10", + "composer/semver": "^3.0", + "ext-fileinfo": "*", + "ext-ftp": "*", + "ext-mongodb": "^1.3", + "ext-zip": "*", + "friendsofphp/php-cs-fixer": "^3.5", + "google/cloud-storage": "^1.23", + "guzzlehttp/psr7": "^2.6", + "microsoft/azure-storage-blob": "^1.1", + "mongodb/mongodb": "^1.2", + "phpseclib/phpseclib": "^3.0.36", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^9.5.11|^10.0", + "sabre/dav": "^4.6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "League\\Flysystem\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frankdejonge.nl" + } + ], + "description": "File storage abstraction for PHP", + "keywords": [ + "WebDAV", + "aws", + "cloud", + "file", + "files", + "filesystem", + "filesystems", + "ftp", + "s3", + "sftp", + "storage" + ], + "support": { + "issues": "https://github.com/thephpleague/flysystem/issues", + "source": "https://github.com/thephpleague/flysystem/tree/3.29.1" + }, + "time": "2024-10-08T08:58:34+00:00" + }, + { + "name": "league/flysystem-local", + "version": "3.29.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem-local.git", + "reference": "e0e8d52ce4b2ed154148453d321e97c8e931bd27" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/e0e8d52ce4b2ed154148453d321e97c8e931bd27", + "reference": "e0e8d52ce4b2ed154148453d321e97c8e931bd27", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "league/flysystem": "^3.0.0", + "league/mime-type-detection": "^1.0.0", + "php": "^8.0.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "League\\Flysystem\\Local\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frankdejonge.nl" + } + ], + "description": "Local filesystem adapter for Flysystem.", + "keywords": [ + "Flysystem", + "file", + "files", + "filesystem", + "local" + ], + "support": { + "source": "https://github.com/thephpleague/flysystem-local/tree/3.29.0" + }, + "time": "2024-08-09T21:24:39+00:00" + }, + { + "name": "league/mime-type-detection", + "version": "1.16.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/mime-type-detection.git", + "reference": "2d6702ff215bf922936ccc1ad31007edc76451b9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/2d6702ff215bf922936ccc1ad31007edc76451b9", + "reference": "2d6702ff215bf922936ccc1ad31007edc76451b9", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.2", + "phpstan/phpstan": "^0.12.68", + "phpunit/phpunit": "^8.5.8 || ^9.3 || ^10.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "League\\MimeTypeDetection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frankdejonge.nl" + } + ], + "description": "Mime-type detection for Flysystem", + "support": { + "issues": "https://github.com/thephpleague/mime-type-detection/issues", + "source": "https://github.com/thephpleague/mime-type-detection/tree/1.16.0" + }, + "funding": [ + { + "url": "https://github.com/frankdejonge", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/league/flysystem", + "type": "tidelift" + } + ], + "time": "2024-09-21T08:32:55+00:00" + }, { "name": "monolog/monolog", "version": "3.8.1", @@ -1480,6 +1668,95 @@ ], "time": "2024-12-05T17:15:07+00:00" }, + { + "name": "oneup/flysystem-bundle", + "version": "4.12.3", + "source": { + "type": "git", + "url": "https://github.com/1up-lab/OneupFlysystemBundle.git", + "reference": "23d7186524a9c6236662c452891b1175cb193777" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/1up-lab/OneupFlysystemBundle/zipball/23d7186524a9c6236662c452891b1175cb193777", + "reference": "23d7186524a9c6236662c452891b1175cb193777", + "shasum": "" + }, + "require": { + "league/flysystem": "^2.0 || ^3.0", + "php": "^8.1", + "symfony/config": "^5.4 || ^6.0 || ^7.0", + "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", + "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0" + }, + "require-dev": { + "ext-simplexml": "*", + "friendsofphp/php-cs-fixer": "^3.51", + "league/flysystem-async-aws-s3": "^2.0 || ^3.0", + "league/flysystem-aws-s3-v3": "^2.0 || ^3.0", + "league/flysystem-azure-blob-storage": "^3.0", + "league/flysystem-ftp": "^2.0 || ^3.0", + "league/flysystem-google-cloud-storage": "^2.0 || ^3.0", + "league/flysystem-memory": "^2.0 || ^3.0", + "league/flysystem-sftp-v3": "^2.0 || ^3.0", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^9.6.17", + "royvoetman/flysystem-gitlab-storage": "^2.0 || ^3.0", + "symfony/asset": "^5.4 || ^6.0 || ^7.0", + "symfony/browser-kit": "^5.4 || ^6.0 || ^7.0", + "symfony/finder": "^5.4 || ^6.0 || ^7.0", + "symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0", + "symfony/phpunit-bridge": "^7.0", + "symfony/translation": "^5.4 || ^6.0 || ^7.0", + "symfony/yaml": "^5.4 || ^6.0 || ^7.0" + }, + "suggest": { + "ext-fileinfo": "Required for MimeType", + "ext-ftp": "Required for FTP and SFTP", + "league/flysystem-async-aws-s3": "Use flysystem S3 adapter from AsyncAws", + "league/flysystem-aws-s3-v3": "Use S3 storage with AWS SDK v3", + "league/flysystem-google-cloud-storage": "Use Google Cloud Storage Adapter for Flysystem", + "league/flysystem-sftp-v3": "Allows SFTP server storage via phpseclib", + "royvoetman/flysystem-gitlab-storage": "Use Gitlab Storage filesystem for Flysystem" + }, + "type": "symfony-bundle", + "autoload": { + "psr-4": { + "Oneup\\FlysystemBundle\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jim Schmid", + "email": "js@1up.io", + "homepage": "https://1up.io", + "role": "Developer" + }, + { + "name": "David Greminger", + "email": "dg@1up.io", + "homepage": "https://1up.io", + "role": "Developer" + } + ], + "description": "Integrates Flysystem filesystem abstraction library to your Symfony project.", + "homepage": "https://1up.io", + "keywords": [ + "Flysystem", + "abstraction", + "filesystem", + "symfony" + ], + "support": { + "issues": "https://github.com/1up-lab/OneupFlysystemBundle/issues", + "source": "https://github.com/1up-lab/OneupFlysystemBundle/tree/4.12.3" + }, + "time": "2024-10-15T06:27:06+00:00" + }, { "name": "phpdocumentor/reflection-common", "version": "2.2.0", @@ -7355,6 +7632,61 @@ ], "time": "2024-10-23T06:56:12+00:00" }, + { + "name": "symfonycasts/tailwind-bundle", + "version": "v0.6.1", + "source": { + "type": "git", + "url": "https://github.com/SymfonyCasts/tailwind-bundle.git", + "reference": "28db7cfe23758cffc79f25a7c75cdb2fca52e9d9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/SymfonyCasts/tailwind-bundle/zipball/28db7cfe23758cffc79f25a7c75cdb2fca52e9d9", + "reference": "28db7cfe23758cffc79f25a7c75cdb2fca52e9d9", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/asset-mapper": "^6.3|^7.0", + "symfony/cache": "^6.3|^7.0", + "symfony/console": "^5.4|^6.3|^7.0", + "symfony/http-client": "^5.4|^6.3|^7.0", + "symfony/process": "^5.4|^6.3|^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.6", + "symfony/filesystem": "^6.3|^7.0", + "symfony/framework-bundle": "^6.3|^7.0", + "symfony/phpunit-bridge": "^6.3.9|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfonycasts\\TailwindBundle\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ryan Weaver", + "homepage": "https://symfonycasts.com" + } + ], + "description": "Delightful Tailwind Support for Symfony + AssetMapper", + "keywords": [ + "asset-mapper", + "tailwind" + ], + "support": { + "issues": "https://github.com/SymfonyCasts/tailwind-bundle/issues", + "source": "https://github.com/SymfonyCasts/tailwind-bundle/tree/v0.6.1" + }, + "time": "2024-11-06T18:41:22+00:00" + }, { "name": "twig/extra-bundle", "version": "v3.17.0", diff --git a/config/bundles.php b/config/bundles.php index 4e3a560..d9bb288 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -13,4 +13,6 @@ return [ Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], + Symfonycasts\TailwindBundle\SymfonycastsTailwindBundle::class => ['all' => true], + Oneup\FlysystemBundle\OneupFlysystemBundle::class => ['all' => true], ]; diff --git a/config/packages/oneup_flysystem.yaml b/config/packages/oneup_flysystem.yaml new file mode 100644 index 0000000..0550556 --- /dev/null +++ b/config/packages/oneup_flysystem.yaml @@ -0,0 +1,10 @@ +# Read the documentation: https://github.com/1up-lab/OneupFlysystemBundle +oneup_flysystem: + adapters: + default_adapter: + local: + location: "%kernel.project_dir%/uploads" + filesystems: + default_filesystem: + adapter: default_adapter + alias: League\Flysystem\Filesystem diff --git a/src/Controller/DashboardController.php b/src/Controller/DashboardController.php new file mode 100644 index 0000000..b52543f --- /dev/null +++ b/src/Controller/DashboardController.php @@ -0,0 +1,62 @@ +listContents('/', Filesystem::LIST_DEEP); + + $realFiles = []; + + foreach ($files as $key => $file) { + if ($file['type'] === 'file' && !str_starts_with($file['path'], '.')) { + $realFiles[] = [ + 'path' => $file['path'], + 'url' => $this->generateUrl('app_file_proxy', ['filename' => $file['path']], UrlGeneratorInterface::ABSOLUTE_URL), + ]; + } + } + + + return $this->render('dashboard/index.html.twig', [ + 'files' => $realFiles, + ]); + } + + #[Route('/file-proxy', name: 'app_file_proxy')] + public function fileProxy(Filesystem $defaultAdapter, #[MapQueryParameter('filename')]string $filename) + { + $mimetype = $defaultAdapter->mimeType($filename); + if ($mimetype === '') { + $mimetype = 'application/octet-stream'; + } + + $response = new StreamedResponse(static function () use ($filename, $defaultAdapter): void { + $outputStream = fopen('php://output', 'w'); + $fileStream = $defaultAdapter->readStream($filename); + stream_copy_to_stream($fileStream, $outputStream); + }); + + $response->headers->set('Content-Type', $mimetype); + $disposition = HeaderUtils::makeDisposition( + HeaderUtils::DISPOSITION_ATTACHMENT, + basename($filename) + ); + $response->headers->set('Content-Disposition', $disposition); + + return $response; + + } +} diff --git a/symfony.lock b/symfony.lock index 8c53e2a..88c4523 100644 --- a/symfony.lock +++ b/symfony.lock @@ -26,6 +26,18 @@ "migrations/.gitignore" ] }, + "oneup/flysystem-bundle": { + "version": "4.12", + "recipe": { + "repo": "github.com/symfony/recipes-contrib", + "branch": "main", + "version": "4.0", + "ref": "3ae1b83985e89138f5443bbc2d9b8c074b497d49" + }, + "files": [ + "config/packages/oneup_flysystem.yaml" + ] + }, "phpunit/phpunit": { "version": "9.6", "recipe": { @@ -296,6 +308,9 @@ "config/routes/web_profiler.yaml" ] }, + "symfonycasts/tailwind-bundle": { + "version": "v0.6.1" + }, "twig/extra-bundle": { "version": "v3.17.0" } diff --git a/tailwind.config.js b/tailwind.config.js new file mode 100644 index 0000000..bb226fb --- /dev/null +++ b/tailwind.config.js @@ -0,0 +1,11 @@ +/** @type {import('tailwindcss').Config} */ +module.exports = { + content: [ + "./assets/**/*.js", + "./templates/**/*.html.twig", + ], + theme: { + extend: {}, + }, + plugins: [], +} diff --git a/templates/base.html.twig b/templates/base.html.twig index 3cda30f..0523980 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -2,7 +2,7 @@ - {% block title %}Welcome!{% endblock %} + Kumora - {% block title %}Accueil{% endblock %} {% block stylesheets %} {% endblock %} @@ -12,6 +12,7 @@ {% endblock %} + {% include "partials/navbar.html.twig" %} {% block body %}{% endblock %} diff --git a/templates/dashboard/index.html.twig b/templates/dashboard/index.html.twig new file mode 100644 index 0000000..8da9453 --- /dev/null +++ b/templates/dashboard/index.html.twig @@ -0,0 +1,14 @@ +{% extends 'base.html.twig' %} + +{% block title %}Dashboard{% endblock %} + +{% block body %} +
+

Bienvenue sur le dashboard

+ +
+{% endblock %} diff --git a/templates/partials/navbar.html.twig b/templates/partials/navbar.html.twig new file mode 100644 index 0000000..4dbe27d --- /dev/null +++ b/templates/partials/navbar.html.twig @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/uploads/.gitkeep b/uploads/.gitkeep new file mode 100644 index 0000000..e69de29