mirror of
https://github.com/axeloz/filesharing.git
synced 2025-06-27 17:32:25 +02:00
Version 2 of File Sharing
This commit is contained in:
commit
484f6c2cb3
104 changed files with 13807 additions and 0 deletions
18
.editorconfig
Normal file
18
.editorconfig
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 4
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
|
[*.{yml,yaml}]
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[docker-compose.yml]
|
||||||
|
indent_size = 4
|
21
.env.example
Normal file
21
.env.example
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
APP_NAME="File Sharing"
|
||||||
|
APP_ENV=production
|
||||||
|
APP_KEY=
|
||||||
|
APP_DEBUG=false
|
||||||
|
APP_URL=
|
||||||
|
APP_TIMEZONE=Europe/Paris
|
||||||
|
APP_LOCALE=en
|
||||||
|
|
||||||
|
UPLOAD_MAX_FILESIZE=1G
|
||||||
|
UPLOAD_MAX_FILES=1000
|
||||||
|
UPLOAD_LIMIT_IPS=127.0.0.1
|
||||||
|
|
||||||
|
FILESYSTEM_DISK=local
|
||||||
|
SESSION_DRIVER=file
|
||||||
|
SESSION_LIFETIME=120
|
||||||
|
|
||||||
|
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||||
|
VITE_PUSHER_HOST="${PUSHER_HOST}"
|
||||||
|
VITE_PUSHER_PORT="${PUSHER_PORT}"
|
||||||
|
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
|
||||||
|
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
11
.gitattributes
vendored
Normal file
11
.gitattributes
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
* text=auto eol=lf
|
||||||
|
|
||||||
|
*.blade.php diff=html
|
||||||
|
*.css diff=css
|
||||||
|
*.html diff=html
|
||||||
|
*.md diff=markdown
|
||||||
|
*.php diff=php
|
||||||
|
|
||||||
|
/.github export-ignore
|
||||||
|
CHANGELOG.md export-ignore
|
||||||
|
.styleci.yml export-ignore
|
19
.gitignore
vendored
Normal file
19
.gitignore
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
/.phpunit.cache
|
||||||
|
/node_modules
|
||||||
|
/public/build
|
||||||
|
/public/hot
|
||||||
|
/public/storage
|
||||||
|
/storage/*.key
|
||||||
|
/vendor
|
||||||
|
.env
|
||||||
|
.env.backup
|
||||||
|
.env.production
|
||||||
|
.phpunit.result.cache
|
||||||
|
Homestead.json
|
||||||
|
Homestead.yaml
|
||||||
|
auth.json
|
||||||
|
npm-debug.log
|
||||||
|
yarn-error.log
|
||||||
|
/.fleet
|
||||||
|
/.idea
|
||||||
|
/.vscode
|
90
app/Console/Commands/PurgeFiles.php
Normal file
90
app/Console/Commands/PurgeFiles.php
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\Console\Commands;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
|
class PurgeFiles extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'storage:purge-expired';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'Purge expired uploaded files from the storage disk';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new command instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
try {
|
||||||
|
$bundles = Storage::disk('uploads')->directories('.');
|
||||||
|
if (count($bundles) > 0) {
|
||||||
|
foreach ($bundles as $b) {
|
||||||
|
$this->line(' ');
|
||||||
|
$this->line('Found bundle: '.$b);
|
||||||
|
|
||||||
|
if (Storage::disk('uploads')->exists($b.'/bundle.json')) {
|
||||||
|
$this->line('-> found bundle.json file in folder');
|
||||||
|
|
||||||
|
$content = Storage::disk('uploads')->get($b.'/bundle.json');
|
||||||
|
if (! $metadata = json_decode($content, true)) {
|
||||||
|
$this->error('-> unable to decode JSON');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($metadata['expires_at'])) {
|
||||||
|
if ($metadata['expires_at'] >= time()) {
|
||||||
|
$this->info('-> bundle is still valid (expiration date: '.date('Y-m-d H:i:s', $metadata['expires_at']).')');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->comment('-> bundle has expired, must be removed');
|
||||||
|
|
||||||
|
if (Storage::disk('uploads')->deleteDirectory($b)) {
|
||||||
|
$this->info('-> bundle was properly deleted');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->error('-> bundle could not be deleted');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->comment('-> bundle has no expiring date, skipping');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->line('No bundle was found');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception $e) {
|
||||||
|
$this->error($e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
27
app/Console/Kernel.php
Normal file
27
app/Console/Kernel.php
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console;
|
||||||
|
|
||||||
|
use Illuminate\Console\Scheduling\Schedule;
|
||||||
|
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||||
|
|
||||||
|
class Kernel extends ConsoleKernel
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Define the application's command schedule.
|
||||||
|
*/
|
||||||
|
protected function schedule(Schedule $schedule): void
|
||||||
|
{
|
||||||
|
// $schedule->command('inspire')->hourly();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the commands for the application.
|
||||||
|
*/
|
||||||
|
protected function commands(): void
|
||||||
|
{
|
||||||
|
$this->load(__DIR__.'/Commands');
|
||||||
|
|
||||||
|
require base_path('routes/console.php');
|
||||||
|
}
|
||||||
|
}
|
30
app/Exceptions/Handler.php
Normal file
30
app/Exceptions/Handler.php
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Exceptions;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
class Handler extends ExceptionHandler
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The list of the inputs that are never flashed to the session on validation exceptions.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $dontFlash = [
|
||||||
|
'current_password',
|
||||||
|
'password',
|
||||||
|
'password_confirmation',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the exception handling callbacks for the application.
|
||||||
|
*/
|
||||||
|
public function register(): void
|
||||||
|
{
|
||||||
|
$this->reportable(function (Throwable $e) {
|
||||||
|
//
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
229
app/Helpers/Upload.php
Normal file
229
app/Helpers/Upload.php
Normal file
|
@ -0,0 +1,229 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Helpers;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
|
class Upload {
|
||||||
|
|
||||||
|
public static function getMetadata(string $bundleId) {
|
||||||
|
// Making sure the metadata file exists
|
||||||
|
if (! Storage::disk('uploads')->exists($bundleId.'/bundle.json')) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getting metadata file contents
|
||||||
|
$metadata = Storage::disk('uploads')->get($bundleId.'/bundle.json');
|
||||||
|
|
||||||
|
// Json decoding the metadata
|
||||||
|
if ($json = json_decode($metadata, true)) {
|
||||||
|
return $json;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function setMetadata(string $bundleId, array $metadata = []) {
|
||||||
|
$origin = self::getMetadata($bundleId);
|
||||||
|
$updated = array_merge($origin, $metadata);
|
||||||
|
|
||||||
|
if (! Storage::disk('uploads')->put($bundleId.'/bundle.json', json_encode($updated))) {
|
||||||
|
throw new Exception('Cannot store metadata');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $updated;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function addFileMetaData(string $bundleId, array $file) {
|
||||||
|
$metadata = self::getMetadata($bundleId);
|
||||||
|
|
||||||
|
if (empty($metadata)) {
|
||||||
|
$metadata = [
|
||||||
|
'files' => []
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
array_push($metadata['files'], $file);
|
||||||
|
|
||||||
|
if (! Storage::disk('uploads')->put($bundleId.'/bundle.json', json_encode($metadata))) {
|
||||||
|
throw new Exception('Cannot store metadata');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $metadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function deleteFile(string $bundleId, string $uuid) {
|
||||||
|
$metadata = self::getMetadata($bundleId);
|
||||||
|
|
||||||
|
if (! empty($metadata['files'])) {
|
||||||
|
foreach ($metadata['files'] as $key => $file) {
|
||||||
|
if ($file['uuid'] == $uuid) {
|
||||||
|
if (! Storage::disk('uploads')->delete($file['fullpath'])) {
|
||||||
|
throw new Exception('Cannot delete file from disk');
|
||||||
|
}
|
||||||
|
unset($metadata['files'][$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! Storage::disk('uploads')->put($bundleId.'/bundle.json', json_encode($metadata))) {
|
||||||
|
throw new Exception('Cannot store metadata');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $metadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function humanFilesize($size, $precision = 2)
|
||||||
|
{
|
||||||
|
if ($size > 0) {
|
||||||
|
$size = (int) $size;
|
||||||
|
$base = log($size) / log(1024);
|
||||||
|
$suffixes = array(' bytes', ' KB', ' MB', ' GB', ' TB');
|
||||||
|
|
||||||
|
return round(pow(1024, $base - floor($base)), $precision) . $suffixes[floor($base)];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return $size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fileMaxSize($human = false) {
|
||||||
|
$values = [
|
||||||
|
'post' => ini_get('post_max_size'),
|
||||||
|
'upload' => ini_get('upload_max_filesize'),
|
||||||
|
'memory' => ini_get('memory_limit'),
|
||||||
|
'config' => config('sharing.max_filesize')
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($values as $k => $v) {
|
||||||
|
$unit = preg_replace('/[^bkmgtpezy]/i', '', $v);
|
||||||
|
$size = preg_replace('/[^0-9\.]/', '', $v);
|
||||||
|
if ($unit) {
|
||||||
|
// Find the position of the unit in the ordered string which is the power of magnitude to multiply a kilobyte by.
|
||||||
|
$values[$k] = round($size * pow(1024, stripos('bkmgtpezy', $unit[0])), 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$min = min($values);
|
||||||
|
if ($human === true) {
|
||||||
|
return self::humanFilesize($min);
|
||||||
|
}
|
||||||
|
return $min;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function canUpload($current_ip) {
|
||||||
|
|
||||||
|
// Getting the IP limit configuration
|
||||||
|
$ips = config('sharing.upload_ip_limit');
|
||||||
|
|
||||||
|
if (empty($ips)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$ips = explode(',', $ips);
|
||||||
|
|
||||||
|
// If set and not empty, checking client's IP
|
||||||
|
if (! empty($ips) && count($ips) > 0) {
|
||||||
|
$valid = false;
|
||||||
|
|
||||||
|
foreach ($ips as $ip) {
|
||||||
|
$ip = trim($ip);
|
||||||
|
|
||||||
|
// Client's IP appears in the whitelist
|
||||||
|
if (self::isValidIp($current_ip, $ip)) {
|
||||||
|
$valid = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Client's IP is not allowed
|
||||||
|
if ($valid === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function isValidIp($ip, $range) {
|
||||||
|
|
||||||
|
// Range is in CIDR format
|
||||||
|
if (strpos($range, '/') !== false) {
|
||||||
|
list($range, $netmask) = explode('/', $range, 2);
|
||||||
|
|
||||||
|
// Netmask is a 255.255.0.0 format
|
||||||
|
if (strpos($netmask, '.') !== false) {
|
||||||
|
$netmask = str_replace('*', '0', $netmask);
|
||||||
|
$netmask_dec = ip2long($netmask);
|
||||||
|
return ( (ip2long($ip) & $netmask_dec) == (ip2long($range) & $netmask_dec) );
|
||||||
|
}
|
||||||
|
// Netmask is a CIDR size block
|
||||||
|
else {
|
||||||
|
// fix the range argument
|
||||||
|
$x = explode('.', $range);
|
||||||
|
|
||||||
|
while(count($x) < 4) {
|
||||||
|
$x[] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
list($a, $b, $c, $d) = $x;
|
||||||
|
$range = sprintf("%u.%u.%u.%u", empty($a)?'0':$a, empty($b)?'0':$b,empty($c)?'0':$c,empty($d)?'0':$d);
|
||||||
|
$range_dec = ip2long($range);
|
||||||
|
$ip_dec = ip2long($ip);
|
||||||
|
|
||||||
|
$wildcard_dec = pow(2, (32-$netmask)) - 1;
|
||||||
|
$netmask_dec = ~ $wildcard_dec;
|
||||||
|
|
||||||
|
return (($ip_dec & $netmask_dec) == ($range_dec & $netmask_dec));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Range might be 255.255.*.* or 1.2.3.0-1.2.3.255
|
||||||
|
elseif (strpos($range, '*') !== false || strpos($range, '-') !== false) {
|
||||||
|
|
||||||
|
// a.b.*.* format
|
||||||
|
if (strpos($range, '*') !== false) {
|
||||||
|
// Just convert to A-B format by setting * to 0 for A and 255 for B
|
||||||
|
$lower = str_replace('*', '0', $range);
|
||||||
|
$upper = str_replace('*', '255', $range);
|
||||||
|
$range = "$lower-$upper";
|
||||||
|
}
|
||||||
|
|
||||||
|
// A-B format
|
||||||
|
if (strpos($range, '-') !== false) {
|
||||||
|
list($lower, $upper) = explode('-', $range, 2);
|
||||||
|
$lower_dec = (float)sprintf("%u", ip2long($lower));
|
||||||
|
$upper_dec = (float)sprintf("%u", ip2long($upper));
|
||||||
|
$ip_dec = (float)sprintf("%u", ip2long($ip));
|
||||||
|
return ( ($ip_dec >= $lower_dec) && ($ip_dec <= $upper_dec) );
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Full IP format 192.168.10.10
|
||||||
|
else {
|
||||||
|
return ($ip == $range);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getExpirySeconds($expiry) {
|
||||||
|
$unit_multipliers = [
|
||||||
|
'h' => 3600,
|
||||||
|
'd' => 86400,
|
||||||
|
'w' => 604800,
|
||||||
|
'm' => 2592000
|
||||||
|
];
|
||||||
|
|
||||||
|
$unit = strtolower(substr(trim($expiry), -1));
|
||||||
|
$value = (int)substr($expiry, 0, -1);
|
||||||
|
|
||||||
|
if (empty($unit_multipliers[$unit]) || $value <= 0) {
|
||||||
|
// 24h by default
|
||||||
|
return $unit_multipliers['d'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return ($value * $unit_multipliers[$unit]);
|
||||||
|
}
|
||||||
|
}
|
103
app/Http/Controllers/BundleController.php
Normal file
103
app/Http/Controllers/BundleController.php
Normal file
|
@ -0,0 +1,103 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use ZipArchive;
|
||||||
|
use Exception;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use App\Helpers\Upload;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
|
||||||
|
class BundleController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
// The bundle content preview
|
||||||
|
public function previewBundle(Request $request, $bundleId) {
|
||||||
|
|
||||||
|
// Getting bundle metadata
|
||||||
|
abort_if(! $metadata = Upload::getMetadata($bundleId), 404);
|
||||||
|
|
||||||
|
// Handling dates as Carbon
|
||||||
|
Carbon::setLocale(config('app.locale'));
|
||||||
|
$metadata['created_at_carbon'] = Carbon::createFromTimestamp($metadata['created_at']);
|
||||||
|
$metadata['expires_at_carbon'] = Carbon::createFromTimestamp($metadata['expires_at']);
|
||||||
|
|
||||||
|
return view('download', [
|
||||||
|
'bundleId' => $bundleId,
|
||||||
|
'metadata' => $metadata,
|
||||||
|
'auth' => $metadata['preview_token']
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// The download method
|
||||||
|
// - the bundle
|
||||||
|
// - or just one file
|
||||||
|
public function downloadZip(Request $request, $bundleId) {
|
||||||
|
|
||||||
|
// Getting bundle metadata
|
||||||
|
abort_if(! $metadata = Upload::getMetadata($bundleId), 404);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Download of the full bundle
|
||||||
|
// We must create a Zip archive
|
||||||
|
Upload::setMetadata($bundleId, [
|
||||||
|
'downloads' => $metadata['downloads'] + 1
|
||||||
|
]);
|
||||||
|
|
||||||
|
$filename = config('filesystems.disks.uploads.root').'/'.$metadata['bundle_id'].'/bundle.zip';
|
||||||
|
if (1 == 1 || ! file_exists($filename)) {
|
||||||
|
// Timestamped filename
|
||||||
|
$bundlezip = fopen($filename, 'w');
|
||||||
|
//chmod($filename, 0600);
|
||||||
|
|
||||||
|
// Creating the archive
|
||||||
|
$zip = new ZipArchive;
|
||||||
|
if (! @$zip->open($filename, ZipArchive::CREATE)) {
|
||||||
|
throw new Exception('Cannot initialize Zip archive');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setting password when required
|
||||||
|
if (! empty($metadata['password'])) {
|
||||||
|
$zip->setPassword($metadata['password']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adding the files into the Zip with their real names
|
||||||
|
foreach ($metadata['files'] as $k => $file) {
|
||||||
|
if (file_exists(config('filesystems.disks.uploads.root').'/'.$file['fullpath'])) {
|
||||||
|
$zip->addFile(config('filesystems.disks.uploads.root').'/'.$file['fullpath'], $file['original']);
|
||||||
|
|
||||||
|
if (! empty($metadata['password'])) {
|
||||||
|
$zip->setEncryptionIndex($k, ZipArchive::EM_AES_256);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! @$zip->close()) {
|
||||||
|
throw new Exception('Cannot close Zip archive');
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($bundlezip);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Let's download now
|
||||||
|
header('Content-Type: application/octet-stream');
|
||||||
|
header('Content-Disposition: attachment; filename="'.Str::slug($metadata['title']).'-'.time().'.zip'.'"');
|
||||||
|
header('Cache-Control: no-cache, must-revalidate');
|
||||||
|
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
|
||||||
|
//TODO : fix this header('Content-Length: '.filesize($bundlezip));
|
||||||
|
readfile($filename);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Could not find the metadata file
|
||||||
|
catch (Exception $e) {
|
||||||
|
abort(500, $e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
12
app/Http/Controllers/Controller.php
Normal file
12
app/Http/Controllers/Controller.php
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||||
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||||
|
use Illuminate\Routing\Controller as BaseController;
|
||||||
|
|
||||||
|
class Controller extends BaseController
|
||||||
|
{
|
||||||
|
use AuthorizesRequests, ValidatesRequests;
|
||||||
|
}
|
183
app/Http/Controllers/UploadController.php
Normal file
183
app/Http/Controllers/UploadController.php
Normal file
|
@ -0,0 +1,183 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
use App\Helpers\Upload;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Session;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
class UploadController extends Controller
|
||||||
|
{
|
||||||
|
public function createBundle(Request $request, String $bundleId = null) {
|
||||||
|
$metadata = Upload::getMetadata($bundleId);
|
||||||
|
|
||||||
|
abort_if(empty($metadata), 404);
|
||||||
|
|
||||||
|
return view('upload', [
|
||||||
|
'metadata' => $metadata ?? null,
|
||||||
|
'baseUrl' => config('app.url')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMetadata(Request $request, String $bundleId) {
|
||||||
|
return response()->json(Upload::getMetadata($bundleId));
|
||||||
|
}
|
||||||
|
|
||||||
|
// The upload form
|
||||||
|
public function storeBundle(Request $request, String $bundleId) {
|
||||||
|
|
||||||
|
$original = Upload::getMetadata($bundleId);
|
||||||
|
|
||||||
|
$metadata = [
|
||||||
|
'expiry' => $request->expiry ?? null,
|
||||||
|
'password' => $request->password ?? null,
|
||||||
|
'title' => $request->title ?? null,
|
||||||
|
'description' => $request->description ?? null,
|
||||||
|
'max_downloads' => $request->max_downloads ?? 0
|
||||||
|
];
|
||||||
|
|
||||||
|
$metadata = Upload::setMetaData($bundleId, $metadata);
|
||||||
|
|
||||||
|
// Creating the bundle folder
|
||||||
|
Storage::disk('uploads')->makeDirectory($bundleId);
|
||||||
|
|
||||||
|
return response()->json($metadata);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function uploadFile(Request $request, String $bundleId) {
|
||||||
|
|
||||||
|
// Getting metadata
|
||||||
|
$metadata = Upload::getMetadata($bundleId);
|
||||||
|
|
||||||
|
// Validating file
|
||||||
|
abort_if(! $request->hasFile('file'), 401);
|
||||||
|
abort_if(! $request->file('file')->isValid(), 401);
|
||||||
|
|
||||||
|
$this->validate($request, [
|
||||||
|
'file' => 'required|file|max:'.(Upload::fileMaxSize() / 1000)
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Generating the file name
|
||||||
|
$original = $request->file->getClientOriginalName();
|
||||||
|
$filename = substr(sha1($original.time()), 0, rand(20, 30));
|
||||||
|
|
||||||
|
// Moving file to final destination
|
||||||
|
try {
|
||||||
|
$fullpath = $request->file('file')->storeAs(
|
||||||
|
$bundleId, $filename, 'uploads'
|
||||||
|
);
|
||||||
|
|
||||||
|
// Generating file metadata
|
||||||
|
$file = [
|
||||||
|
'uuid' => Str::uuid(),
|
||||||
|
'original' => $original,
|
||||||
|
'filesize' => Storage::disk('uploads')->size($fullpath),
|
||||||
|
'fullpath' => $fullpath,
|
||||||
|
'filename' => $filename,
|
||||||
|
'created_at' => time(),
|
||||||
|
'status' => true
|
||||||
|
];
|
||||||
|
|
||||||
|
$metadata = Upload::addFileMetaData($bundleId, $file);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'result' => true
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
catch (Exception $e) {
|
||||||
|
return response()->json([
|
||||||
|
'result' => false,
|
||||||
|
'error' => $e->getMessage(),
|
||||||
|
'file' => $e->getFile(),
|
||||||
|
'line' => $e->getLine()
|
||||||
|
], 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteFile(Request $request, String $bundleId) {
|
||||||
|
|
||||||
|
$metadata = Upload::getMetadata($bundleId);
|
||||||
|
|
||||||
|
abort_if(empty($request->file), 401);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$metadata = Upload::deleteFile($bundleId, $request->file);
|
||||||
|
return response()->json($metadata);
|
||||||
|
}
|
||||||
|
catch (Exception $e) {
|
||||||
|
return response()->json([
|
||||||
|
'result' => false,
|
||||||
|
'error' => $e->getMessage(),
|
||||||
|
'file' => $e->getFile(),
|
||||||
|
'line' => $e->getLine()
|
||||||
|
], 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function completeBundle(Request $request, String $bundleId) {
|
||||||
|
|
||||||
|
$metadata = Upload::getMetadata($bundleId);
|
||||||
|
|
||||||
|
// Processing size
|
||||||
|
if (! empty($metadata['files'])) {
|
||||||
|
$size = 0;
|
||||||
|
foreach ($metadata['files'] as $f) {
|
||||||
|
$size += $f['filesize'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Saving metadata
|
||||||
|
try {
|
||||||
|
$preview_token = substr(sha1(uniqid('dbdl', true)), 0, rand(10, 15));
|
||||||
|
|
||||||
|
$metadata = Upload::setMetadata($bundleId, [
|
||||||
|
'completed' => true,
|
||||||
|
'expires_at' => time()+$metadata['expiry'],
|
||||||
|
'fullsize' => $size,
|
||||||
|
'preview_token' => $preview_token,
|
||||||
|
'preview_link' => route('bundle.preview', ['bundle' => $bundleId, 'auth' => $preview_token]),
|
||||||
|
'download_link' => route('bundle.zip.download', ['bundle' => $bundleId, 'auth' => $preview_token]),
|
||||||
|
'deletion_link' => route('upload.bundle.delete', ['bundle' => $bundleId])
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json($metadata);
|
||||||
|
}
|
||||||
|
catch (\Exception $e) {
|
||||||
|
return response()->json([
|
||||||
|
'result' => false,
|
||||||
|
'error' => $e->getMessage()
|
||||||
|
], 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* In this method, we do not delete files
|
||||||
|
* physically to spare some time and ressources.
|
||||||
|
* We invalidate the expiry date and let the CRON
|
||||||
|
* task do the hard work
|
||||||
|
*/
|
||||||
|
public function deleteBundle(Request $request, $bundleId) {
|
||||||
|
|
||||||
|
// Tries to get the metadata file
|
||||||
|
$metadata = Upload::getMetadata($bundleId);
|
||||||
|
|
||||||
|
// Forcing file to expire
|
||||||
|
$metadata['expires_at'] = time() - 1000;
|
||||||
|
|
||||||
|
// Rewriting the metadata file
|
||||||
|
try {
|
||||||
|
$metadata = Upload::setMetadata($bundleId, $metadata);
|
||||||
|
return response()->json($metadata);
|
||||||
|
}
|
||||||
|
catch (Exception $e) {
|
||||||
|
return response()->json([
|
||||||
|
'success' => false
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
48
app/Http/Controllers/WebController.php
Normal file
48
app/Http/Controllers/WebController.php
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
use App\Helpers\Upload;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class WebController extends Controller
|
||||||
|
{
|
||||||
|
function homepage(Request $request)
|
||||||
|
{
|
||||||
|
return view('homepage');
|
||||||
|
}
|
||||||
|
|
||||||
|
function newBundle(Request $request) {
|
||||||
|
// Aborting if request is not AJAX
|
||||||
|
abort_if(! $request->ajax(), 401);
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'bundle_id' => 'required',
|
||||||
|
'owner_token' => 'required'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$metadata = [
|
||||||
|
'created_at' => time(),
|
||||||
|
'completed' => false,
|
||||||
|
'expiry' => config('sharing.default-expiry', 86400),
|
||||||
|
'expires_at' => null,
|
||||||
|
'password' => null,
|
||||||
|
'bundle_id' => $request->bundle_id,
|
||||||
|
'owner_token' => $request->owner_token,
|
||||||
|
'preview_token' => null,
|
||||||
|
'fullsize' => 0,
|
||||||
|
'files' => [],
|
||||||
|
'title' => null,
|
||||||
|
'description' => null,
|
||||||
|
'max_downloads' => 0,
|
||||||
|
'downloads' => 0
|
||||||
|
];
|
||||||
|
|
||||||
|
if (Upload::setMetadata($metadata['bundle_id'], $metadata)) {
|
||||||
|
return response()->json($metadata);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
abort(500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
70
app/Http/Kernel.php
Normal file
70
app/Http/Kernel.php
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||||
|
|
||||||
|
class Kernel extends HttpKernel
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The application's global HTTP middleware stack.
|
||||||
|
*
|
||||||
|
* These middleware are run during every request to your application.
|
||||||
|
*
|
||||||
|
* @var array<int, class-string|string>
|
||||||
|
*/
|
||||||
|
protected $middleware = [
|
||||||
|
// \App\Http\Middleware\TrustHosts::class,
|
||||||
|
\App\Http\Middleware\TrustProxies::class,
|
||||||
|
\Illuminate\Http\Middleware\HandleCors::class,
|
||||||
|
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
||||||
|
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||||
|
\App\Http\Middleware\TrimStrings::class,
|
||||||
|
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The application's route middleware groups.
|
||||||
|
*
|
||||||
|
* @var array<string, array<int, class-string|string>>
|
||||||
|
*/
|
||||||
|
protected $middlewareGroups = [
|
||||||
|
'web' => [
|
||||||
|
\App\Http\Middleware\EncryptCookies::class,
|
||||||
|
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||||
|
\Illuminate\Session\Middleware\StartSession::class,
|
||||||
|
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||||
|
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||||
|
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||||
|
],
|
||||||
|
|
||||||
|
'api' => [
|
||||||
|
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||||
|
\Illuminate\Routing\Middleware\ThrottleRequests::class.':api',
|
||||||
|
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The application's middleware aliases.
|
||||||
|
*
|
||||||
|
* Aliases may be used instead of class names to conveniently assign middleware to routes and groups.
|
||||||
|
*
|
||||||
|
* @var array<string, class-string|string>
|
||||||
|
*/
|
||||||
|
protected $middlewareAliases = [
|
||||||
|
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||||
|
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||||
|
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||||
|
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||||
|
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||||
|
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||||
|
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||||
|
'signed' => \App\Http\Middleware\ValidateSignature::class,
|
||||||
|
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||||
|
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||||
|
'upload' => \App\Http\Middleware\UploadAccess::class,
|
||||||
|
'access.owner' => \App\Http\Middleware\OwnerAccess::class,
|
||||||
|
'access.guest' => \App\Http\Middleware\GuestAccess::class
|
||||||
|
];
|
||||||
|
}
|
17
app/Http/Middleware/Authenticate.php
Normal file
17
app/Http/Middleware/Authenticate.php
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class Authenticate extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the path the user should be redirected to when they are not authenticated.
|
||||||
|
*/
|
||||||
|
protected function redirectTo(Request $request): ?string
|
||||||
|
{
|
||||||
|
return $request->expectsJson() ? null : route('login');
|
||||||
|
}
|
||||||
|
}
|
17
app/Http/Middleware/EncryptCookies.php
Normal file
17
app/Http/Middleware/EncryptCookies.php
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
|
||||||
|
|
||||||
|
class EncryptCookies extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The names of the cookies that should not be encrypted.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $except = [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
43
app/Http/Middleware/GuestAccess.php
Normal file
43
app/Http/Middleware/GuestAccess.php
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use App\Helpers\Upload;
|
||||||
|
|
||||||
|
class GuestAccess
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||||
|
*/
|
||||||
|
public function handle(Request $request, Closure $next): Response
|
||||||
|
{
|
||||||
|
// Aborting if Bundle ID is not present
|
||||||
|
abort_if(empty($request->route()->parameter('bundle')), 401);
|
||||||
|
|
||||||
|
abort_if(empty($request->auth), 401);
|
||||||
|
|
||||||
|
// Getting metadata
|
||||||
|
$metadata = Upload::getMetadata($request->route()->parameter('bundle'));
|
||||||
|
|
||||||
|
// Aborting if metadata are empty
|
||||||
|
abort_if(empty($metadata), 404);
|
||||||
|
|
||||||
|
// Aborting if auth_token is different from URL param
|
||||||
|
abort_if($metadata['preview_token'] !== $request->auth, 401);
|
||||||
|
|
||||||
|
// Checking bundle expiration
|
||||||
|
abort_if($metadata['expires_at'] < time(), 404);
|
||||||
|
|
||||||
|
// If there is no file into the bundle (should never happen but ...)
|
||||||
|
abort_if(count($metadata['files']) == 0, 404);
|
||||||
|
|
||||||
|
abort_if(($metadata['max_downloads'] ?? 0) > 0 && $metadata['downloads'] >= $metadata['max_downloads'], 404);
|
||||||
|
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
46
app/Http/Middleware/OwnerAccess.php
Normal file
46
app/Http/Middleware/OwnerAccess.php
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use App\Helpers\Upload;
|
||||||
|
|
||||||
|
class OwnerAccess
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||||
|
*/
|
||||||
|
public function handle(Request $request, Closure $next): Response
|
||||||
|
{
|
||||||
|
// Aborting if request is not AJAX
|
||||||
|
abort_if(! $request->ajax(), 401);
|
||||||
|
|
||||||
|
// Aborting if Bundle ID is not present
|
||||||
|
abort_if(empty($request->route()->parameter('bundle')), 401);
|
||||||
|
|
||||||
|
// Aborting if auth is not present
|
||||||
|
$auth = null;
|
||||||
|
if (! empty($request->header('X-Upload-Auth'))) {
|
||||||
|
$auth = $request->header('X-Upload-Auth');
|
||||||
|
}
|
||||||
|
else if (! empty($request->auth)) {
|
||||||
|
$auth = $request->auth;
|
||||||
|
}
|
||||||
|
abort_if(empty($auth), 401);
|
||||||
|
|
||||||
|
// Getting metadata
|
||||||
|
$metadata = Upload::getMetadata($request->route()->parameter('bundle'));
|
||||||
|
|
||||||
|
// Aborting if metadata are empty
|
||||||
|
abort_if(empty($metadata), 404);
|
||||||
|
|
||||||
|
// Aborting if auth_token is different from URL param
|
||||||
|
abort_if($metadata['owner_token'] !== $auth, 401);
|
||||||
|
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
17
app/Http/Middleware/PreventRequestsDuringMaintenance.php
Normal file
17
app/Http/Middleware/PreventRequestsDuringMaintenance.php
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
|
||||||
|
|
||||||
|
class PreventRequestsDuringMaintenance extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The URIs that should be reachable while maintenance mode is enabled.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $except = [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
30
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
30
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use App\Providers\RouteServiceProvider;
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
|
class RedirectIfAuthenticated
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||||
|
*/
|
||||||
|
public function handle(Request $request, Closure $next, string ...$guards): Response
|
||||||
|
{
|
||||||
|
$guards = empty($guards) ? [null] : $guards;
|
||||||
|
|
||||||
|
foreach ($guards as $guard) {
|
||||||
|
if (Auth::guard($guard)->check()) {
|
||||||
|
return redirect(RouteServiceProvider::HOME);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
19
app/Http/Middleware/TrimStrings.php
Normal file
19
app/Http/Middleware/TrimStrings.php
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
|
||||||
|
|
||||||
|
class TrimStrings extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The names of the attributes that should not be trimmed.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $except = [
|
||||||
|
'current_password',
|
||||||
|
'password',
|
||||||
|
'password_confirmation',
|
||||||
|
];
|
||||||
|
}
|
20
app/Http/Middleware/TrustHosts.php
Normal file
20
app/Http/Middleware/TrustHosts.php
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Http\Middleware\TrustHosts as Middleware;
|
||||||
|
|
||||||
|
class TrustHosts extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the host patterns that should be trusted.
|
||||||
|
*
|
||||||
|
* @return array<int, string|null>
|
||||||
|
*/
|
||||||
|
public function hosts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->allSubdomainsOfApplicationUrl(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
28
app/Http/Middleware/TrustProxies.php
Normal file
28
app/Http/Middleware/TrustProxies.php
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Http\Middleware\TrustProxies as Middleware;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class TrustProxies extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The trusted proxies for this application.
|
||||||
|
*
|
||||||
|
* @var array<int, string>|string|null
|
||||||
|
*/
|
||||||
|
protected $proxies;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The headers that should be used to detect proxies.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $headers =
|
||||||
|
Request::HEADER_X_FORWARDED_FOR |
|
||||||
|
Request::HEADER_X_FORWARDED_HOST |
|
||||||
|
Request::HEADER_X_FORWARDED_PORT |
|
||||||
|
Request::HEADER_X_FORWARDED_PROTO |
|
||||||
|
Request::HEADER_X_FORWARDED_AWS_ELB;
|
||||||
|
}
|
27
app/Http/Middleware/UploadAccess.php
Normal file
27
app/Http/Middleware/UploadAccess.php
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use App\Helpers\Upload;
|
||||||
|
|
||||||
|
class UploadAccess
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \Closure $next
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle(Request $request, Closure $next): Response
|
||||||
|
{
|
||||||
|
if (Upload::canUpload($request->ip()) !== true) {
|
||||||
|
abort(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
22
app/Http/Middleware/ValidateSignature.php
Normal file
22
app/Http/Middleware/ValidateSignature.php
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Routing\Middleware\ValidateSignature as Middleware;
|
||||||
|
|
||||||
|
class ValidateSignature extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The names of the query string parameters that should be ignored.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $except = [
|
||||||
|
// 'fbclid',
|
||||||
|
// 'utm_campaign',
|
||||||
|
// 'utm_content',
|
||||||
|
// 'utm_medium',
|
||||||
|
// 'utm_source',
|
||||||
|
// 'utm_term',
|
||||||
|
];
|
||||||
|
}
|
18
app/Http/Middleware/VerifyCsrfToken.php
Normal file
18
app/Http/Middleware/VerifyCsrfToken.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
|
||||||
|
|
||||||
|
class VerifyCsrfToken extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The URIs that should be excluded from CSRF verification.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $except = [
|
||||||
|
//
|
||||||
|
'/upload/*'
|
||||||
|
];
|
||||||
|
}
|
44
app/Models/User.php
Normal file
44
app/Models/User.php
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
|
use Illuminate\Notifications\Notifiable;
|
||||||
|
use Laravel\Sanctum\HasApiTokens;
|
||||||
|
|
||||||
|
class User extends Authenticatable
|
||||||
|
{
|
||||||
|
use HasApiTokens, HasFactory, Notifiable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'name',
|
||||||
|
'email',
|
||||||
|
'password',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be hidden for serialization.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $hidden = [
|
||||||
|
'password',
|
||||||
|
'remember_token',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be cast.
|
||||||
|
*
|
||||||
|
* @var array<string, string>
|
||||||
|
*/
|
||||||
|
protected $casts = [
|
||||||
|
'email_verified_at' => 'datetime',
|
||||||
|
];
|
||||||
|
}
|
24
app/Providers/AppServiceProvider.php
Normal file
24
app/Providers/AppServiceProvider.php
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
|
class AppServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Register any application services.
|
||||||
|
*/
|
||||||
|
public function register(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bootstrap any application services.
|
||||||
|
*/
|
||||||
|
public function boot(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
26
app/Providers/AuthServiceProvider.php
Normal file
26
app/Providers/AuthServiceProvider.php
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
// use Illuminate\Support\Facades\Gate;
|
||||||
|
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||||
|
|
||||||
|
class AuthServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The model to policy mappings for the application.
|
||||||
|
*
|
||||||
|
* @var array<class-string, class-string>
|
||||||
|
*/
|
||||||
|
protected $policies = [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register any authentication / authorization services.
|
||||||
|
*/
|
||||||
|
public function boot(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
19
app/Providers/BroadcastServiceProvider.php
Normal file
19
app/Providers/BroadcastServiceProvider.php
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Broadcast;
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
|
class BroadcastServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Bootstrap any application services.
|
||||||
|
*/
|
||||||
|
public function boot(): void
|
||||||
|
{
|
||||||
|
Broadcast::routes();
|
||||||
|
|
||||||
|
require base_path('routes/channels.php');
|
||||||
|
}
|
||||||
|
}
|
38
app/Providers/EventServiceProvider.php
Normal file
38
app/Providers/EventServiceProvider.php
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Auth\Events\Registered;
|
||||||
|
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
||||||
|
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||||
|
use Illuminate\Support\Facades\Event;
|
||||||
|
|
||||||
|
class EventServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The event to listener mappings for the application.
|
||||||
|
*
|
||||||
|
* @var array<class-string, array<int, class-string>>
|
||||||
|
*/
|
||||||
|
protected $listen = [
|
||||||
|
Registered::class => [
|
||||||
|
SendEmailVerificationNotification::class,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register any events for your application.
|
||||||
|
*/
|
||||||
|
public function boot(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if events and listeners should be automatically discovered.
|
||||||
|
*/
|
||||||
|
public function shouldDiscoverEvents(): bool
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
40
app/Providers/RouteServiceProvider.php
Normal file
40
app/Providers/RouteServiceProvider.php
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Cache\RateLimiting\Limit;
|
||||||
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\RateLimiter;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
|
class RouteServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The path to your application's "home" route.
|
||||||
|
*
|
||||||
|
* Typically, users are redirected here after authentication.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public const HOME = '/home';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define your route model bindings, pattern filters, and other route configuration.
|
||||||
|
*/
|
||||||
|
public function boot(): void
|
||||||
|
{
|
||||||
|
RateLimiter::for('api', function (Request $request) {
|
||||||
|
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
|
||||||
|
});
|
||||||
|
|
||||||
|
$this->routes(function () {
|
||||||
|
Route::middleware('api')
|
||||||
|
->prefix('api')
|
||||||
|
->group(base_path('routes/api.php'));
|
||||||
|
|
||||||
|
Route::middleware('web')
|
||||||
|
->group(base_path('routes/web.php'));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
53
artisan
Executable file
53
artisan
Executable file
|
@ -0,0 +1,53 @@
|
||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
define('LARAVEL_START', microtime(true));
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Register The Auto Loader
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Composer provides a convenient, automatically generated class loader
|
||||||
|
| for our application. We just need to utilize it! We'll require it
|
||||||
|
| into the script here so that we do not have to worry about the
|
||||||
|
| loading of any of our classes manually. It's great to relax.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
require __DIR__.'/vendor/autoload.php';
|
||||||
|
|
||||||
|
$app = require_once __DIR__.'/bootstrap/app.php';
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Run The Artisan Application
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When we run the console application, the current CLI command will be
|
||||||
|
| executed in this console and the response sent back to a terminal
|
||||||
|
| or another output device for the developers. Here goes nothing!
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||||
|
|
||||||
|
$status = $kernel->handle(
|
||||||
|
$input = new Symfony\Component\Console\Input\ArgvInput,
|
||||||
|
new Symfony\Component\Console\Output\ConsoleOutput
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Shutdown The Application
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Once Artisan has finished running, we will fire off the shutdown events
|
||||||
|
| so that any final work may be done by the application before we shut
|
||||||
|
| down the process. This is the last thing to happen to the request.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$kernel->terminate($input, $status);
|
||||||
|
|
||||||
|
exit($status);
|
55
bootstrap/app.php
Normal file
55
bootstrap/app.php
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Create The Application
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The first thing we will do is create a new Laravel application instance
|
||||||
|
| which serves as the "glue" for all the components of Laravel, and is
|
||||||
|
| the IoC container for the system binding all of the various parts.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$app = new Illuminate\Foundation\Application(
|
||||||
|
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Bind Important Interfaces
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Next, we need to bind some important interfaces into the container so
|
||||||
|
| we will be able to resolve them when needed. The kernels serve the
|
||||||
|
| incoming requests to this application from both the web and CLI.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$app->singleton(
|
||||||
|
Illuminate\Contracts\Http\Kernel::class,
|
||||||
|
App\Http\Kernel::class
|
||||||
|
);
|
||||||
|
|
||||||
|
$app->singleton(
|
||||||
|
Illuminate\Contracts\Console\Kernel::class,
|
||||||
|
App\Console\Kernel::class
|
||||||
|
);
|
||||||
|
|
||||||
|
$app->singleton(
|
||||||
|
Illuminate\Contracts\Debug\ExceptionHandler::class,
|
||||||
|
App\Exceptions\Handler::class
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Return The Application
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This script returns the application instance. The instance is given to
|
||||||
|
| the calling script so we can separate the building of the instances
|
||||||
|
| from the actual running of the application and sending responses.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
return $app;
|
2
bootstrap/cache/.gitignore
vendored
Normal file
2
bootstrap/cache/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
*
|
||||||
|
!.gitignore
|
69
composer.json
Normal file
69
composer.json
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
{
|
||||||
|
"name": "laravel/laravel",
|
||||||
|
"type": "project",
|
||||||
|
"description": "The Laravel Framework.",
|
||||||
|
"keywords": ["framework", "laravel"],
|
||||||
|
"license": "MIT",
|
||||||
|
"require": {
|
||||||
|
"php": "^8.1",
|
||||||
|
"guzzlehttp/guzzle": "^7.2",
|
||||||
|
"laravel/framework": "^10.8",
|
||||||
|
"laravel/sanctum": "^3.2",
|
||||||
|
"laravel/tinker": "^2.8"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"fakerphp/faker": "^1.9.1",
|
||||||
|
"laravel/pint": "^1.0",
|
||||||
|
"laravel/sail": "^1.18",
|
||||||
|
"mockery/mockery": "^1.4.4",
|
||||||
|
"nunomaduro/collision": "^7.0",
|
||||||
|
"phpunit/phpunit": "^10.1",
|
||||||
|
"spatie/laravel-ignition": "^2.0"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"app/Helpers/Upload.php"
|
||||||
|
],
|
||||||
|
"psr-4": {
|
||||||
|
"App\\": "app/",
|
||||||
|
"Database\\Factories\\": "database/factories/",
|
||||||
|
"Database\\Seeders\\": "database/seeders/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"Tests\\": "tests/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"post-autoload-dump": [
|
||||||
|
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||||
|
"@php artisan package:discover --ansi"
|
||||||
|
],
|
||||||
|
"post-update-cmd": [
|
||||||
|
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
|
||||||
|
],
|
||||||
|
"post-root-package-install": [
|
||||||
|
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||||
|
],
|
||||||
|
"post-create-project-cmd": [
|
||||||
|
"@php artisan key:generate --ansi"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"dont-discover": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"optimize-autoloader": true,
|
||||||
|
"preferred-install": "dist",
|
||||||
|
"sort-packages": true,
|
||||||
|
"allow-plugins": {
|
||||||
|
"pestphp/pest-plugin": true,
|
||||||
|
"php-http/discovery": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"minimum-stability": "stable",
|
||||||
|
"prefer-stable": true
|
||||||
|
}
|
7835
composer.lock
generated
Normal file
7835
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
189
config/app.php
Normal file
189
config/app.php
Normal file
|
@ -0,0 +1,189 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Facade;
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application Name
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This value is the name of your application. This value is used when the
|
||||||
|
| framework needs to place the application's name in a notification or
|
||||||
|
| any other location as required by the application or its packages.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'name' => env('APP_NAME', 'Laravel'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application Environment
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This value determines the "environment" your application is currently
|
||||||
|
| running in. This may determine how you prefer to configure various
|
||||||
|
| services the application utilizes. Set this in your ".env" file.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'env' => env('APP_ENV', 'production'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application Debug Mode
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When your application is in debug mode, detailed error messages with
|
||||||
|
| stack traces will be shown on every error that occurs within your
|
||||||
|
| application. If disabled, a simple generic error page is shown.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'debug' => (bool) env('APP_DEBUG', false),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application URL
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This URL is used by the console to properly generate URLs when using
|
||||||
|
| the Artisan command line tool. You should set this to the root of
|
||||||
|
| your application so that it is used when running Artisan tasks.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'url' => env('APP_URL', 'http://localhost'),
|
||||||
|
|
||||||
|
'asset_url' => env('ASSET_URL'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application Timezone
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify the default timezone for your application, which
|
||||||
|
| will be used by the PHP date and date-time functions. We have gone
|
||||||
|
| ahead and set this to a sensible default for you out of the box.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'timezone' => env('APP_TIMEZONE', 'UTC'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application Locale Configuration
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The application locale determines the default locale that will be used
|
||||||
|
| by the translation service provider. You are free to set this value
|
||||||
|
| to any of the locales which will be supported by the application.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'locale' => env('APP_LOCALE', 'en'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application Fallback Locale
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The fallback locale determines the locale to use when the current one
|
||||||
|
| is not available. You may change the value to correspond to any of
|
||||||
|
| the language folders that are provided through your application.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'fallback_locale' => 'en',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Faker Locale
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This locale will be used by the Faker PHP library when generating fake
|
||||||
|
| data for your database seeds. For example, this will be used to get
|
||||||
|
| localized telephone numbers, street address information and more.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'faker_locale' => 'en_US',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Encryption Key
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This key is used by the Illuminate encrypter service and should be set
|
||||||
|
| to a random, 32 character string, otherwise these encrypted strings
|
||||||
|
| will not be safe. Please do this before deploying an application!
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'key' => env('APP_KEY'),
|
||||||
|
|
||||||
|
'cipher' => 'AES-256-CBC',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Maintenance Mode Driver
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| These configuration options determine the driver used to determine and
|
||||||
|
| manage Laravel's "maintenance mode" status. The "cache" driver will
|
||||||
|
| allow maintenance mode to be controlled across multiple machines.
|
||||||
|
|
|
||||||
|
| Supported drivers: "file", "cache"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'maintenance' => [
|
||||||
|
'driver' => 'file',
|
||||||
|
// 'store' => 'redis',
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Autoloaded Service Providers
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The service providers listed here will be automatically loaded on the
|
||||||
|
| request to your application. Feel free to add your own services to
|
||||||
|
| this array to grant expanded functionality to your applications.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'providers' => ServiceProvider::defaultProviders()->merge([
|
||||||
|
/*
|
||||||
|
* Package Service Providers...
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Application Service Providers...
|
||||||
|
*/
|
||||||
|
App\Providers\AppServiceProvider::class,
|
||||||
|
App\Providers\AuthServiceProvider::class,
|
||||||
|
// App\Providers\BroadcastServiceProvider::class,
|
||||||
|
App\Providers\EventServiceProvider::class,
|
||||||
|
App\Providers\RouteServiceProvider::class,
|
||||||
|
])->toArray(),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Class Aliases
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This array of class aliases will be registered when this application
|
||||||
|
| is started. However, feel free to register as many as you wish as
|
||||||
|
| the aliases are "lazy" loaded so they don't hinder performance.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'aliases' => Facade::defaultAliases()->merge([
|
||||||
|
// 'Example' => App\Facades\Example::class,
|
||||||
|
'Upload' => App\Helpers\Upload::class
|
||||||
|
])->toArray(),
|
||||||
|
|
||||||
|
];
|
115
config/auth.php
Normal file
115
config/auth.php
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Authentication Defaults
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the default authentication "guard" and password
|
||||||
|
| reset options for your application. You may change these defaults
|
||||||
|
| as required, but they're a perfect start for most applications.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'defaults' => [
|
||||||
|
'guard' => 'web',
|
||||||
|
'passwords' => 'users',
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Authentication Guards
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Next, you may define every authentication guard for your application.
|
||||||
|
| Of course, a great default configuration has been defined for you
|
||||||
|
| here which uses session storage and the Eloquent user provider.
|
||||||
|
|
|
||||||
|
| All authentication drivers have a user provider. This defines how the
|
||||||
|
| users are actually retrieved out of your database or other storage
|
||||||
|
| mechanisms used by this application to persist your user's data.
|
||||||
|
|
|
||||||
|
| Supported: "session"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'guards' => [
|
||||||
|
'web' => [
|
||||||
|
'driver' => 'session',
|
||||||
|
'provider' => 'users',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| User Providers
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| All authentication drivers have a user provider. This defines how the
|
||||||
|
| users are actually retrieved out of your database or other storage
|
||||||
|
| mechanisms used by this application to persist your user's data.
|
||||||
|
|
|
||||||
|
| If you have multiple user tables or models you may configure multiple
|
||||||
|
| sources which represent each model / table. These sources may then
|
||||||
|
| be assigned to any extra authentication guards you have defined.
|
||||||
|
|
|
||||||
|
| Supported: "database", "eloquent"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'providers' => [
|
||||||
|
'users' => [
|
||||||
|
'driver' => 'eloquent',
|
||||||
|
'model' => App\Models\User::class,
|
||||||
|
],
|
||||||
|
|
||||||
|
// 'users' => [
|
||||||
|
// 'driver' => 'database',
|
||||||
|
// 'table' => 'users',
|
||||||
|
// ],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Resetting Passwords
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| You may specify multiple password reset configurations if you have more
|
||||||
|
| than one user table or model in the application and you want to have
|
||||||
|
| separate password reset settings based on the specific user types.
|
||||||
|
|
|
||||||
|
| The expiry time is the number of minutes that each reset token will be
|
||||||
|
| considered valid. This security feature keeps tokens short-lived so
|
||||||
|
| they have less time to be guessed. You may change this as needed.
|
||||||
|
|
|
||||||
|
| The throttle setting is the number of seconds a user must wait before
|
||||||
|
| generating more password reset tokens. This prevents the user from
|
||||||
|
| quickly generating a very large amount of password reset tokens.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'passwords' => [
|
||||||
|
'users' => [
|
||||||
|
'provider' => 'users',
|
||||||
|
'table' => 'password_reset_tokens',
|
||||||
|
'expire' => 60,
|
||||||
|
'throttle' => 60,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Password Confirmation Timeout
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may define the amount of seconds before a password confirmation
|
||||||
|
| times out and the user is prompted to re-enter their password via the
|
||||||
|
| confirmation screen. By default, the timeout lasts for three hours.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'password_timeout' => 10800,
|
||||||
|
|
||||||
|
];
|
70
config/broadcasting.php
Normal file
70
config/broadcasting.php
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Broadcaster
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the default broadcaster that will be used by the
|
||||||
|
| framework when an event needs to be broadcast. You may set this to
|
||||||
|
| any of the connections defined in the "connections" array below.
|
||||||
|
|
|
||||||
|
| Supported: "pusher", "ably", "redis", "log", "null"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('BROADCAST_DRIVER', 'null'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Broadcast Connections
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may define all of the broadcast connections that will be used
|
||||||
|
| to broadcast events to other systems or over websockets. Samples of
|
||||||
|
| each available type of connection are provided inside this array.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'connections' => [
|
||||||
|
|
||||||
|
'pusher' => [
|
||||||
|
'driver' => 'pusher',
|
||||||
|
'key' => env('PUSHER_APP_KEY'),
|
||||||
|
'secret' => env('PUSHER_APP_SECRET'),
|
||||||
|
'app_id' => env('PUSHER_APP_ID'),
|
||||||
|
'options' => [
|
||||||
|
'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com',
|
||||||
|
'port' => env('PUSHER_PORT', 443),
|
||||||
|
'scheme' => env('PUSHER_SCHEME', 'https'),
|
||||||
|
'encrypted' => true,
|
||||||
|
'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
|
||||||
|
],
|
||||||
|
'client_options' => [
|
||||||
|
// Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
'ably' => [
|
||||||
|
'driver' => 'ably',
|
||||||
|
'key' => env('ABLY_KEY'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'redis' => [
|
||||||
|
'driver' => 'redis',
|
||||||
|
'connection' => 'default',
|
||||||
|
],
|
||||||
|
|
||||||
|
'log' => [
|
||||||
|
'driver' => 'log',
|
||||||
|
],
|
||||||
|
|
||||||
|
'null' => [
|
||||||
|
'driver' => 'null',
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
110
config/cache.php
Normal file
110
config/cache.php
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Cache Store
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the default cache connection that gets used while
|
||||||
|
| using this caching library. This connection is used when another is
|
||||||
|
| not explicitly specified when executing a given caching function.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('CACHE_DRIVER', 'file'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Cache Stores
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may define all of the cache "stores" for your application as
|
||||||
|
| well as their drivers. You may even define multiple stores for the
|
||||||
|
| same cache driver to group types of items stored in your caches.
|
||||||
|
|
|
||||||
|
| Supported drivers: "apc", "array", "database", "file",
|
||||||
|
| "memcached", "redis", "dynamodb", "octane", "null"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'stores' => [
|
||||||
|
|
||||||
|
'apc' => [
|
||||||
|
'driver' => 'apc',
|
||||||
|
],
|
||||||
|
|
||||||
|
'array' => [
|
||||||
|
'driver' => 'array',
|
||||||
|
'serialize' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'database' => [
|
||||||
|
'driver' => 'database',
|
||||||
|
'table' => 'cache',
|
||||||
|
'connection' => null,
|
||||||
|
'lock_connection' => null,
|
||||||
|
],
|
||||||
|
|
||||||
|
'file' => [
|
||||||
|
'driver' => 'file',
|
||||||
|
'path' => storage_path('framework/cache/data'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'memcached' => [
|
||||||
|
'driver' => 'memcached',
|
||||||
|
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
|
||||||
|
'sasl' => [
|
||||||
|
env('MEMCACHED_USERNAME'),
|
||||||
|
env('MEMCACHED_PASSWORD'),
|
||||||
|
],
|
||||||
|
'options' => [
|
||||||
|
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
|
||||||
|
],
|
||||||
|
'servers' => [
|
||||||
|
[
|
||||||
|
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
|
||||||
|
'port' => env('MEMCACHED_PORT', 11211),
|
||||||
|
'weight' => 100,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
'redis' => [
|
||||||
|
'driver' => 'redis',
|
||||||
|
'connection' => 'cache',
|
||||||
|
'lock_connection' => 'default',
|
||||||
|
],
|
||||||
|
|
||||||
|
'dynamodb' => [
|
||||||
|
'driver' => 'dynamodb',
|
||||||
|
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||||
|
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||||
|
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||||
|
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
|
||||||
|
'endpoint' => env('DYNAMODB_ENDPOINT'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'octane' => [
|
||||||
|
'driver' => 'octane',
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Cache Key Prefix
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When utilizing the APC, database, memcached, Redis, or DynamoDB cache
|
||||||
|
| stores there might be other applications using the same cache. For
|
||||||
|
| that reason, you may prefix every cache key to avoid collisions.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
|
||||||
|
|
||||||
|
];
|
34
config/cors.php
Normal file
34
config/cors.php
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Cross-Origin Resource Sharing (CORS) Configuration
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may configure your settings for cross-origin resource sharing
|
||||||
|
| or "CORS". This determines what cross-origin operations may execute
|
||||||
|
| in web browsers. You are free to adjust these settings as needed.
|
||||||
|
|
|
||||||
|
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'paths' => ['api/*', 'sanctum/csrf-cookie'],
|
||||||
|
|
||||||
|
'allowed_methods' => ['*'],
|
||||||
|
|
||||||
|
'allowed_origins' => ['*'],
|
||||||
|
|
||||||
|
'allowed_origins_patterns' => [],
|
||||||
|
|
||||||
|
'allowed_headers' => ['*'],
|
||||||
|
|
||||||
|
'exposed_headers' => [],
|
||||||
|
|
||||||
|
'max_age' => 0,
|
||||||
|
|
||||||
|
'supports_credentials' => false,
|
||||||
|
|
||||||
|
];
|
151
config/database.php
Normal file
151
config/database.php
Normal file
|
@ -0,0 +1,151 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Database Connection Name
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify which of the database connections below you wish
|
||||||
|
| to use as your default connection for all database work. Of course
|
||||||
|
| you may use many connections at once using the Database library.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('DB_CONNECTION', 'mysql'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Database Connections
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here are each of the database connections setup for your application.
|
||||||
|
| Of course, examples of configuring each database platform that is
|
||||||
|
| supported by Laravel is shown below to make development simple.
|
||||||
|
|
|
||||||
|
|
|
||||||
|
| All database work in Laravel is done through the PHP PDO facilities
|
||||||
|
| so make sure you have the driver for your particular database of
|
||||||
|
| choice installed on your machine before you begin development.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'connections' => [
|
||||||
|
|
||||||
|
'sqlite' => [
|
||||||
|
'driver' => 'sqlite',
|
||||||
|
'url' => env('DATABASE_URL'),
|
||||||
|
'database' => env('DB_DATABASE', database_path('database.sqlite')),
|
||||||
|
'prefix' => '',
|
||||||
|
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
|
||||||
|
],
|
||||||
|
|
||||||
|
'mysql' => [
|
||||||
|
'driver' => 'mysql',
|
||||||
|
'url' => env('DATABASE_URL'),
|
||||||
|
'host' => env('DB_HOST', '127.0.0.1'),
|
||||||
|
'port' => env('DB_PORT', '3306'),
|
||||||
|
'database' => env('DB_DATABASE', 'forge'),
|
||||||
|
'username' => env('DB_USERNAME', 'forge'),
|
||||||
|
'password' => env('DB_PASSWORD', ''),
|
||||||
|
'unix_socket' => env('DB_SOCKET', ''),
|
||||||
|
'charset' => 'utf8mb4',
|
||||||
|
'collation' => 'utf8mb4_unicode_ci',
|
||||||
|
'prefix' => '',
|
||||||
|
'prefix_indexes' => true,
|
||||||
|
'strict' => true,
|
||||||
|
'engine' => null,
|
||||||
|
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||||
|
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||||
|
]) : [],
|
||||||
|
],
|
||||||
|
|
||||||
|
'pgsql' => [
|
||||||
|
'driver' => 'pgsql',
|
||||||
|
'url' => env('DATABASE_URL'),
|
||||||
|
'host' => env('DB_HOST', '127.0.0.1'),
|
||||||
|
'port' => env('DB_PORT', '5432'),
|
||||||
|
'database' => env('DB_DATABASE', 'forge'),
|
||||||
|
'username' => env('DB_USERNAME', 'forge'),
|
||||||
|
'password' => env('DB_PASSWORD', ''),
|
||||||
|
'charset' => 'utf8',
|
||||||
|
'prefix' => '',
|
||||||
|
'prefix_indexes' => true,
|
||||||
|
'search_path' => 'public',
|
||||||
|
'sslmode' => 'prefer',
|
||||||
|
],
|
||||||
|
|
||||||
|
'sqlsrv' => [
|
||||||
|
'driver' => 'sqlsrv',
|
||||||
|
'url' => env('DATABASE_URL'),
|
||||||
|
'host' => env('DB_HOST', 'localhost'),
|
||||||
|
'port' => env('DB_PORT', '1433'),
|
||||||
|
'database' => env('DB_DATABASE', 'forge'),
|
||||||
|
'username' => env('DB_USERNAME', 'forge'),
|
||||||
|
'password' => env('DB_PASSWORD', ''),
|
||||||
|
'charset' => 'utf8',
|
||||||
|
'prefix' => '',
|
||||||
|
'prefix_indexes' => true,
|
||||||
|
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
|
||||||
|
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Migration Repository Table
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This table keeps track of all the migrations that have already run for
|
||||||
|
| your application. Using this information, we can determine which of
|
||||||
|
| the migrations on disk haven't actually been run in the database.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'migrations' => 'migrations',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Redis Databases
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Redis is an open source, fast, and advanced key-value store that also
|
||||||
|
| provides a richer body of commands than a typical key-value system
|
||||||
|
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'redis' => [
|
||||||
|
|
||||||
|
'client' => env('REDIS_CLIENT', 'phpredis'),
|
||||||
|
|
||||||
|
'options' => [
|
||||||
|
'cluster' => env('REDIS_CLUSTER', 'redis'),
|
||||||
|
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'default' => [
|
||||||
|
'url' => env('REDIS_URL'),
|
||||||
|
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||||
|
'username' => env('REDIS_USERNAME'),
|
||||||
|
'password' => env('REDIS_PASSWORD'),
|
||||||
|
'port' => env('REDIS_PORT', '6379'),
|
||||||
|
'database' => env('REDIS_DB', '0'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'cache' => [
|
||||||
|
'url' => env('REDIS_URL'),
|
||||||
|
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||||
|
'username' => env('REDIS_USERNAME'),
|
||||||
|
'password' => env('REDIS_PASSWORD'),
|
||||||
|
'port' => env('REDIS_PORT', '6379'),
|
||||||
|
'database' => env('REDIS_CACHE_DB', '1'),
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
92
config/filesystems.php
Normal file
92
config/filesystems.php
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Filesystem Disk
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify the default filesystem disk that should be used
|
||||||
|
| by the framework. The "local" disk, as well as a variety of cloud
|
||||||
|
| based disks are available to your application. Just store away!
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('FILESYSTEM_DISK', 'local'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Filesystem Disks
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may configure as many filesystem "disks" as you wish, and you
|
||||||
|
| may even configure multiple disks of the same driver. Defaults have
|
||||||
|
| been set up for each driver as an example of the required values.
|
||||||
|
|
|
||||||
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'disks' => [
|
||||||
|
|
||||||
|
'local' => [
|
||||||
|
'driver' => 'local',
|
||||||
|
'root' => storage_path('app'),
|
||||||
|
'throw' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'public' => [
|
||||||
|
'driver' => 'local',
|
||||||
|
'root' => storage_path('app/public'),
|
||||||
|
'url' => env('APP_URL').'/storage',
|
||||||
|
'visibility' => 'public',
|
||||||
|
'throw' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'uploads' => [
|
||||||
|
'driver' => 'local',
|
||||||
|
'root' => env('STORAGE_PATH', storage_path('app/uploads')),
|
||||||
|
'visibility' => 'private',
|
||||||
|
'permissions' => [
|
||||||
|
'file' => [
|
||||||
|
'public' => 0600,
|
||||||
|
'private' => 0600,
|
||||||
|
],
|
||||||
|
'dir' => [
|
||||||
|
'public' => 0755,
|
||||||
|
'private' => 0700,
|
||||||
|
],
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
's3' => [
|
||||||
|
'driver' => 's3',
|
||||||
|
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||||
|
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||||
|
'region' => env('AWS_DEFAULT_REGION'),
|
||||||
|
'bucket' => env('AWS_BUCKET'),
|
||||||
|
'url' => env('AWS_URL'),
|
||||||
|
'endpoint' => env('AWS_ENDPOINT'),
|
||||||
|
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
|
||||||
|
'throw' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Symbolic Links
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may configure the symbolic links that will be created when the
|
||||||
|
| `storage:link` Artisan command is executed. The array keys should be
|
||||||
|
| the locations of the links and the values should be their targets.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'links' => [
|
||||||
|
public_path('storage') => storage_path('app/public'),
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
52
config/hashing.php
Normal file
52
config/hashing.php
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Hash Driver
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the default hash driver that will be used to hash
|
||||||
|
| passwords for your application. By default, the bcrypt algorithm is
|
||||||
|
| used; however, you remain free to modify this option if you wish.
|
||||||
|
|
|
||||||
|
| Supported: "bcrypt", "argon", "argon2id"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'driver' => 'bcrypt',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Bcrypt Options
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify the configuration options that should be used when
|
||||||
|
| passwords are hashed using the Bcrypt algorithm. This will allow you
|
||||||
|
| to control the amount of time it takes to hash the given password.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'bcrypt' => [
|
||||||
|
'rounds' => env('BCRYPT_ROUNDS', 10),
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Argon Options
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify the configuration options that should be used when
|
||||||
|
| passwords are hashed using the Argon algorithm. These will allow you
|
||||||
|
| to control the amount of time it takes to hash the given password.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'argon' => [
|
||||||
|
'memory' => 65536,
|
||||||
|
'threads' => 1,
|
||||||
|
'time' => 4,
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
131
config/logging.php
Normal file
131
config/logging.php
Normal file
|
@ -0,0 +1,131 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Monolog\Handler\NullHandler;
|
||||||
|
use Monolog\Handler\StreamHandler;
|
||||||
|
use Monolog\Handler\SyslogUdpHandler;
|
||||||
|
use Monolog\Processor\PsrLogMessageProcessor;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Log Channel
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option defines the default log channel that gets used when writing
|
||||||
|
| messages to the logs. The name specified in this option should match
|
||||||
|
| one of the channels defined in the "channels" configuration array.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('LOG_CHANNEL', 'stack'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Deprecations Log Channel
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the log channel that should be used to log warnings
|
||||||
|
| regarding deprecated PHP and library features. This allows you to get
|
||||||
|
| your application ready for upcoming major versions of dependencies.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'deprecations' => [
|
||||||
|
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
|
||||||
|
'trace' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Log Channels
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may configure the log channels for your application. Out of
|
||||||
|
| the box, Laravel uses the Monolog PHP logging library. This gives
|
||||||
|
| you a variety of powerful log handlers / formatters to utilize.
|
||||||
|
|
|
||||||
|
| Available Drivers: "single", "daily", "slack", "syslog",
|
||||||
|
| "errorlog", "monolog",
|
||||||
|
| "custom", "stack"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'channels' => [
|
||||||
|
'stack' => [
|
||||||
|
'driver' => 'stack',
|
||||||
|
'channels' => ['single'],
|
||||||
|
'ignore_exceptions' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'single' => [
|
||||||
|
'driver' => 'single',
|
||||||
|
'path' => storage_path('logs/laravel.log'),
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'replace_placeholders' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
'daily' => [
|
||||||
|
'driver' => 'daily',
|
||||||
|
'path' => storage_path('logs/laravel.log'),
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'days' => 14,
|
||||||
|
'replace_placeholders' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
'slack' => [
|
||||||
|
'driver' => 'slack',
|
||||||
|
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
||||||
|
'username' => 'Laravel Log',
|
||||||
|
'emoji' => ':boom:',
|
||||||
|
'level' => env('LOG_LEVEL', 'critical'),
|
||||||
|
'replace_placeholders' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
'papertrail' => [
|
||||||
|
'driver' => 'monolog',
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
|
||||||
|
'handler_with' => [
|
||||||
|
'host' => env('PAPERTRAIL_URL'),
|
||||||
|
'port' => env('PAPERTRAIL_PORT'),
|
||||||
|
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
|
||||||
|
],
|
||||||
|
'processors' => [PsrLogMessageProcessor::class],
|
||||||
|
],
|
||||||
|
|
||||||
|
'stderr' => [
|
||||||
|
'driver' => 'monolog',
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'handler' => StreamHandler::class,
|
||||||
|
'formatter' => env('LOG_STDERR_FORMATTER'),
|
||||||
|
'with' => [
|
||||||
|
'stream' => 'php://stderr',
|
||||||
|
],
|
||||||
|
'processors' => [PsrLogMessageProcessor::class],
|
||||||
|
],
|
||||||
|
|
||||||
|
'syslog' => [
|
||||||
|
'driver' => 'syslog',
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'facility' => LOG_USER,
|
||||||
|
'replace_placeholders' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
'errorlog' => [
|
||||||
|
'driver' => 'errorlog',
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'replace_placeholders' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
'null' => [
|
||||||
|
'driver' => 'monolog',
|
||||||
|
'handler' => NullHandler::class,
|
||||||
|
],
|
||||||
|
|
||||||
|
'emergency' => [
|
||||||
|
'path' => storage_path('logs/laravel.log'),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
124
config/mail.php
Normal file
124
config/mail.php
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Mailer
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the default mailer that is used to send any email
|
||||||
|
| messages sent by your application. Alternative mailers may be setup
|
||||||
|
| and used as needed; however, this mailer will be used by default.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('MAIL_MAILER', 'smtp'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Mailer Configurations
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may configure all of the mailers used by your application plus
|
||||||
|
| their respective settings. Several examples have been configured for
|
||||||
|
| you and you are free to add your own as your application requires.
|
||||||
|
|
|
||||||
|
| Laravel supports a variety of mail "transport" drivers to be used while
|
||||||
|
| sending an e-mail. You will specify which one you are using for your
|
||||||
|
| mailers below. You are free to add additional mailers as required.
|
||||||
|
|
|
||||||
|
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
|
||||||
|
| "postmark", "log", "array", "failover"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'mailers' => [
|
||||||
|
'smtp' => [
|
||||||
|
'transport' => 'smtp',
|
||||||
|
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
|
||||||
|
'port' => env('MAIL_PORT', 587),
|
||||||
|
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
|
||||||
|
'username' => env('MAIL_USERNAME'),
|
||||||
|
'password' => env('MAIL_PASSWORD'),
|
||||||
|
'timeout' => null,
|
||||||
|
'local_domain' => env('MAIL_EHLO_DOMAIN'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'ses' => [
|
||||||
|
'transport' => 'ses',
|
||||||
|
],
|
||||||
|
|
||||||
|
'mailgun' => [
|
||||||
|
'transport' => 'mailgun',
|
||||||
|
// 'client' => [
|
||||||
|
// 'timeout' => 5,
|
||||||
|
// ],
|
||||||
|
],
|
||||||
|
|
||||||
|
'postmark' => [
|
||||||
|
'transport' => 'postmark',
|
||||||
|
// 'client' => [
|
||||||
|
// 'timeout' => 5,
|
||||||
|
// ],
|
||||||
|
],
|
||||||
|
|
||||||
|
'sendmail' => [
|
||||||
|
'transport' => 'sendmail',
|
||||||
|
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'log' => [
|
||||||
|
'transport' => 'log',
|
||||||
|
'channel' => env('MAIL_LOG_CHANNEL'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'array' => [
|
||||||
|
'transport' => 'array',
|
||||||
|
],
|
||||||
|
|
||||||
|
'failover' => [
|
||||||
|
'transport' => 'failover',
|
||||||
|
'mailers' => [
|
||||||
|
'smtp',
|
||||||
|
'log',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Global "From" Address
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| You may wish for all e-mails sent by your application to be sent from
|
||||||
|
| the same address. Here, you may specify a name and address that is
|
||||||
|
| used globally for all e-mails that are sent by your application.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'from' => [
|
||||||
|
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
||||||
|
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Markdown Mail Settings
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| If you are using Markdown based email rendering, you may configure your
|
||||||
|
| theme and component paths here, allowing you to customize the design
|
||||||
|
| of the emails. Or, you may simply stick with the Laravel defaults!
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'markdown' => [
|
||||||
|
'theme' => 'default',
|
||||||
|
|
||||||
|
'paths' => [
|
||||||
|
resource_path('views/vendor/mail'),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
109
config/queue.php
Normal file
109
config/queue.php
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Queue Connection Name
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Laravel's queue API supports an assortment of back-ends via a single
|
||||||
|
| API, giving you convenient access to each back-end using the same
|
||||||
|
| syntax for every one. Here you may define a default connection.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('QUEUE_CONNECTION', 'sync'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Queue Connections
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may configure the connection information for each server that
|
||||||
|
| is used by your application. A default configuration has been added
|
||||||
|
| for each back-end shipped with Laravel. You are free to add more.
|
||||||
|
|
|
||||||
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'connections' => [
|
||||||
|
|
||||||
|
'sync' => [
|
||||||
|
'driver' => 'sync',
|
||||||
|
],
|
||||||
|
|
||||||
|
'database' => [
|
||||||
|
'driver' => 'database',
|
||||||
|
'table' => 'jobs',
|
||||||
|
'queue' => 'default',
|
||||||
|
'retry_after' => 90,
|
||||||
|
'after_commit' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'beanstalkd' => [
|
||||||
|
'driver' => 'beanstalkd',
|
||||||
|
'host' => 'localhost',
|
||||||
|
'queue' => 'default',
|
||||||
|
'retry_after' => 90,
|
||||||
|
'block_for' => 0,
|
||||||
|
'after_commit' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'sqs' => [
|
||||||
|
'driver' => 'sqs',
|
||||||
|
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||||
|
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||||
|
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
|
||||||
|
'queue' => env('SQS_QUEUE', 'default'),
|
||||||
|
'suffix' => env('SQS_SUFFIX'),
|
||||||
|
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||||
|
'after_commit' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'redis' => [
|
||||||
|
'driver' => 'redis',
|
||||||
|
'connection' => 'default',
|
||||||
|
'queue' => env('REDIS_QUEUE', 'default'),
|
||||||
|
'retry_after' => 90,
|
||||||
|
'block_for' => null,
|
||||||
|
'after_commit' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Job Batching
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The following options configure the database and table that store job
|
||||||
|
| batching information. These options can be updated to any database
|
||||||
|
| connection and table which has been defined by your application.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'batching' => [
|
||||||
|
'database' => env('DB_CONNECTION', 'mysql'),
|
||||||
|
'table' => 'job_batches',
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Failed Queue Jobs
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| These options configure the behavior of failed queue job logging so you
|
||||||
|
| can control which database and table are used to store the jobs that
|
||||||
|
| have failed. You may change them to any database / table you wish.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'failed' => [
|
||||||
|
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
|
||||||
|
'database' => env('DB_CONNECTION', 'mysql'),
|
||||||
|
'table' => 'failed_jobs',
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
67
config/sanctum.php
Normal file
67
config/sanctum.php
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Laravel\Sanctum\Sanctum;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Stateful Domains
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Requests from the following domains / hosts will receive stateful API
|
||||||
|
| authentication cookies. Typically, these should include your local
|
||||||
|
| and production domains which access your API via a frontend SPA.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
|
||||||
|
'%s%s',
|
||||||
|
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
|
||||||
|
Sanctum::currentApplicationUrlWithPort()
|
||||||
|
))),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Sanctum Guards
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This array contains the authentication guards that will be checked when
|
||||||
|
| Sanctum is trying to authenticate a request. If none of these guards
|
||||||
|
| are able to authenticate the request, Sanctum will use the bearer
|
||||||
|
| token that's present on an incoming request for authentication.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'guard' => ['web'],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Expiration Minutes
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This value controls the number of minutes until an issued token will be
|
||||||
|
| considered expired. If this value is null, personal access tokens do
|
||||||
|
| not expire. This won't tweak the lifetime of first-party sessions.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'expiration' => null,
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Sanctum Middleware
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When authenticating your first-party SPA with Sanctum you may need to
|
||||||
|
| customize some of the middleware Sanctum uses while processing the
|
||||||
|
| request. You may change the middleware listed below as required.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'middleware' => [
|
||||||
|
'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class,
|
||||||
|
'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class,
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
34
config/services.php
Normal file
34
config/services.php
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Third Party Services
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This file is for storing the credentials for third party services such
|
||||||
|
| as Mailgun, Postmark, AWS and more. This file provides the de facto
|
||||||
|
| location for this type of information, allowing packages to have
|
||||||
|
| a conventional file to locate the various service credentials.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'mailgun' => [
|
||||||
|
'domain' => env('MAILGUN_DOMAIN'),
|
||||||
|
'secret' => env('MAILGUN_SECRET'),
|
||||||
|
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
|
||||||
|
'scheme' => 'https',
|
||||||
|
],
|
||||||
|
|
||||||
|
'postmark' => [
|
||||||
|
'token' => env('POSTMARK_TOKEN'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'ses' => [
|
||||||
|
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||||
|
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||||
|
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
201
config/session.php
Normal file
201
config/session.php
Normal file
|
@ -0,0 +1,201 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Session Driver
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the default session "driver" that will be used on
|
||||||
|
| requests. By default, we will use the lightweight native driver but
|
||||||
|
| you may specify any of the other wonderful drivers provided here.
|
||||||
|
|
|
||||||
|
| Supported: "file", "cookie", "database", "apc",
|
||||||
|
| "memcached", "redis", "dynamodb", "array"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'driver' => env('SESSION_DRIVER', 'file'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Lifetime
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify the number of minutes that you wish the session
|
||||||
|
| to be allowed to remain idle before it expires. If you want them
|
||||||
|
| to immediately expire on the browser closing, set that option.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'lifetime' => env('SESSION_LIFETIME', 120),
|
||||||
|
|
||||||
|
'expire_on_close' => false,
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Encryption
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option allows you to easily specify that all of your session data
|
||||||
|
| should be encrypted before it is stored. All encryption will be run
|
||||||
|
| automatically by Laravel and you can use the Session like normal.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'encrypt' => false,
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session File Location
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When using the native session driver, we need a location where session
|
||||||
|
| files may be stored. A default has been set for you but a different
|
||||||
|
| location may be specified. This is only needed for file sessions.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'files' => storage_path('framework/sessions'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Database Connection
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When using the "database" or "redis" session drivers, you may specify a
|
||||||
|
| connection that should be used to manage these sessions. This should
|
||||||
|
| correspond to a connection in your database configuration options.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'connection' => env('SESSION_CONNECTION'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Database Table
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When using the "database" session driver, you may specify the table we
|
||||||
|
| should use to manage the sessions. Of course, a sensible default is
|
||||||
|
| provided for you; however, you are free to change this as needed.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'table' => 'sessions',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Cache Store
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| While using one of the framework's cache driven session backends you may
|
||||||
|
| list a cache store that should be used for these sessions. This value
|
||||||
|
| must match with one of the application's configured cache "stores".
|
||||||
|
|
|
||||||
|
| Affects: "apc", "dynamodb", "memcached", "redis"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'store' => env('SESSION_STORE'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Sweeping Lottery
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Some session drivers must manually sweep their storage location to get
|
||||||
|
| rid of old sessions from storage. Here are the chances that it will
|
||||||
|
| happen on a given request. By default, the odds are 2 out of 100.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'lottery' => [2, 100],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Cookie Name
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may change the name of the cookie used to identify a session
|
||||||
|
| instance by ID. The name specified here will get used every time a
|
||||||
|
| new session cookie is created by the framework for every driver.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'cookie' => env(
|
||||||
|
'SESSION_COOKIE',
|
||||||
|
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
|
||||||
|
),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Cookie Path
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The session cookie path determines the path for which the cookie will
|
||||||
|
| be regarded as available. Typically, this will be the root path of
|
||||||
|
| your application but you are free to change this when necessary.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'path' => '/',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Cookie Domain
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may change the domain of the cookie used to identify a session
|
||||||
|
| in your application. This will determine which domains the cookie is
|
||||||
|
| available to in your application. A sensible default has been set.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'domain' => env('SESSION_DOMAIN'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| HTTPS Only Cookies
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| By setting this option to true, session cookies will only be sent back
|
||||||
|
| to the server if the browser has a HTTPS connection. This will keep
|
||||||
|
| the cookie from being sent to you when it can't be done securely.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'secure' => env('SESSION_SECURE_COOKIE'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| HTTP Access Only
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Setting this value to true will prevent JavaScript from accessing the
|
||||||
|
| value of the cookie and the cookie will only be accessible through
|
||||||
|
| the HTTP protocol. You are free to modify this option if needed.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'http_only' => true,
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Same-Site Cookies
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option determines how your cookies behave when cross-site requests
|
||||||
|
| take place, and can be used to mitigate CSRF attacks. By default, we
|
||||||
|
| will set this value to "lax" since this is a secure default value.
|
||||||
|
|
|
||||||
|
| Supported: "lax", "strict", "none", null
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'same_site' => 'lax',
|
||||||
|
|
||||||
|
];
|
32
config/sharing.php
Normal file
32
config/sharing.php
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
'max_filesize' => env('UPLOAD_MAX_FILESIZE', '5M'),
|
||||||
|
'max_files' => env('UPLOAD_MAX_FILES', 100),
|
||||||
|
'expiry_values' => [
|
||||||
|
'1H' => 'one-hour',
|
||||||
|
'2H' => 'two-hours',
|
||||||
|
'6H' => 'six-hours',
|
||||||
|
'12H' => 'twelve-hours',
|
||||||
|
'24H' => 'one-day',
|
||||||
|
'48H' => 'two-days',
|
||||||
|
'1W' => 'one-week',
|
||||||
|
'2W' => 'two-weeks',
|
||||||
|
'1M' => 'one-month',
|
||||||
|
'3M' => 'three-months',
|
||||||
|
'6M' => 'six-months'
|
||||||
|
],
|
||||||
|
'default_expiry' => 86400, // 1 Day,
|
||||||
|
|
||||||
|
/**
|
||||||
|
** IP v4 access limitations
|
||||||
|
** Acceptable formats :
|
||||||
|
** 1. Full IP address (192.168.10.2)
|
||||||
|
** 2. Wildcard format (192.168.10.*)
|
||||||
|
** 3. CIDR Format (192.168.10/24) OR 1.2.3.4/255.255.255.0
|
||||||
|
** 4. Start-end IP (192.168.10.0-192.168.10.10)
|
||||||
|
*/
|
||||||
|
'upload_ip_limit' => env('UPLOAD_LIMIT_IPS', null),
|
||||||
|
|
||||||
|
];
|
36
config/view.php
Normal file
36
config/view.php
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| View Storage Paths
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Most templating systems load templates from disk. Here you may specify
|
||||||
|
| an array of paths that should be checked for your views. Of course
|
||||||
|
| the usual Laravel view path has already been registered for you.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'paths' => [
|
||||||
|
resource_path('views'),
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Compiled View Path
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option determines where all the compiled Blade templates will be
|
||||||
|
| stored for your application. Typically, this is within the storage
|
||||||
|
| directory. However, as usual, you are free to change this value.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'compiled' => env(
|
||||||
|
'VIEW_COMPILED_PATH',
|
||||||
|
realpath(storage_path('framework/views'))
|
||||||
|
),
|
||||||
|
|
||||||
|
];
|
1
database/.gitignore
vendored
Normal file
1
database/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
*.sqlite*
|
75
lang/en/app.php
Normal file
75
lang/en/app.php
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
return [
|
||||||
|
'preview-bundle' => 'Bundle content',
|
||||||
|
'bundle-preview-intro' => 'Here is the list of the files you can download:',
|
||||||
|
'warning-bundle-expiration' => 'Bundle expires',
|
||||||
|
'warning-bundle-expired' => 'Bundle has expired',
|
||||||
|
'download-all' => 'Download all',
|
||||||
|
'for' => 'for',
|
||||||
|
'files' => 'file|files',
|
||||||
|
'no-file-in-this-bundle' => 'No file into this bundle',
|
||||||
|
'maximum-filesize' => 'Max filesize :',
|
||||||
|
'preview-link' => 'Preview link',
|
||||||
|
'direct-link' => 'Direct download link',
|
||||||
|
'delete-link' => 'Deletion link',
|
||||||
|
'upload-files-title' => 'Upload files',
|
||||||
|
'bundle-preview-title' => 'Files download',
|
||||||
|
'files-list' => 'Uploaded files list',
|
||||||
|
'error-title' => 'An error has occurred',
|
||||||
|
'files-count-limit' => 'Max number of files reached',
|
||||||
|
'file-too-big' => 'This file is too big',
|
||||||
|
'cannot-upload' => 'Cannot upload',
|
||||||
|
'cannot-upload-blocked-ip' => 'You haven\'t been granted permission to upload on this application',
|
||||||
|
'upload-permission-required' => 'Permission required for upload',
|
||||||
|
'cannot-upload-no-password' => 'You must provide a valid password in order to upload on this application',
|
||||||
|
'password' => 'Password: ',
|
||||||
|
'upload-disabled' => 'Upload is disabled on this application',
|
||||||
|
'start-new-upload' => 'Click here to start a new upload',
|
||||||
|
'upload-settings' => 'Settings',
|
||||||
|
'upload-expiry' => 'Expiration',
|
||||||
|
'upload-title' => 'Title',
|
||||||
|
'upload-description' => 'Description',
|
||||||
|
'required' => 'Required',
|
||||||
|
'download-links' => 'Download links',
|
||||||
|
'one-hour' => 'One hour (1H)',
|
||||||
|
'two-hours' => 'Two hours (2H)',
|
||||||
|
'six-hours' => 'Six hours (6H)',
|
||||||
|
'twelve-hours' => 'Twelve hours (12H)',
|
||||||
|
'one-day' => 'One day (1D)',
|
||||||
|
'two-days' => 'Two days (2D)',
|
||||||
|
'one-week' => 'One week (1W)',
|
||||||
|
'two-weeks' => 'Two weeks (2W)',
|
||||||
|
'one-month' => 'One month (1M)',
|
||||||
|
'three-months' => 'Three months (3M)',
|
||||||
|
'six-months' => 'Six months (6M)',
|
||||||
|
'step' => 'Step',
|
||||||
|
'leave-empty' => 'Leave empty for no password',
|
||||||
|
'back' => 'Back',
|
||||||
|
'start-uploading' => 'Start uploading files',
|
||||||
|
'bundle-password' => 'Password',
|
||||||
|
'complete-upload' => 'Complete upload',
|
||||||
|
'no-file' => 'No file uploaded yet',
|
||||||
|
'click-to-remove' => 'Click to delete this file',
|
||||||
|
'confirm-delete' => 'Do you really want to delete this file?',
|
||||||
|
'confirm-complete' => 'Do you really want to complete this bundle? It will be locked and cannot not be modified afterwards.',
|
||||||
|
'confirmation' => 'Confirmation',
|
||||||
|
'cancel' => 'Cancel',
|
||||||
|
'confirm' => 'Confirm',
|
||||||
|
'bundle-locked' => 'This bundle is completed and locked',
|
||||||
|
'created-at' => 'Created',
|
||||||
|
'fullsize' => 'Total',
|
||||||
|
'max-downloads' => 'Max downloads',
|
||||||
|
'create-new-upload' => 'Create a new upload bundle',
|
||||||
|
'page-not-found' => 'Page not found',
|
||||||
|
'permission-denied' => 'Permission denied',
|
||||||
|
'dropzone-text' => 'Drop files here to upload (or click)',
|
||||||
|
'server-answered' => 'Server responded with {{statusCode}} code.',
|
||||||
|
'files-count-on-server' => 'Number of uploaded files',
|
||||||
|
'files-remaining-files' => 'Number of remaining files allowed',
|
||||||
|
'delete-bundle' => 'Delete bundle',
|
||||||
|
'confirm-delete-bundle' => 'Do you really want to delete this bundle?',
|
||||||
|
'bundle-expired' => 'This bundle has expired'
|
||||||
|
|
||||||
|
];
|
20
lang/en/auth.php
Normal file
20
lang/en/auth.php
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Authentication Language Lines
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The following language lines are used during authentication for various
|
||||||
|
| messages that we need to display to the user. You are free to modify
|
||||||
|
| these language lines according to your application's requirements.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'failed' => 'These credentials do not match our records.',
|
||||||
|
'password' => 'The provided password is incorrect.',
|
||||||
|
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
|
||||||
|
|
||||||
|
];
|
19
lang/en/pagination.php
Normal file
19
lang/en/pagination.php
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Pagination Language Lines
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The following language lines are used by the paginator library to build
|
||||||
|
| the simple pagination links. You are free to change them to anything
|
||||||
|
| you want to customize your views to better match your application.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'previous' => '« Previous',
|
||||||
|
'next' => 'Next »',
|
||||||
|
|
||||||
|
];
|
22
lang/en/passwords.php
Normal file
22
lang/en/passwords.php
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Password Reset Language Lines
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The following language lines are the default lines which match reasons
|
||||||
|
| that are given by the password broker for a password update attempt
|
||||||
|
| has failed, such as for an invalid token or invalid new password.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'reset' => 'Your password has been reset.',
|
||||||
|
'sent' => 'We have emailed your password reset link.',
|
||||||
|
'throttled' => 'Please wait before retrying.',
|
||||||
|
'token' => 'This password reset token is invalid.',
|
||||||
|
'user' => "We can't find a user with that email address.",
|
||||||
|
|
||||||
|
];
|
184
lang/en/validation.php
Normal file
184
lang/en/validation.php
Normal file
|
@ -0,0 +1,184 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Validation Language Lines
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The following language lines contain the default error messages used by
|
||||||
|
| the validator class. Some of these rules have multiple versions such
|
||||||
|
| as the size rules. Feel free to tweak each of these messages here.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'accepted' => 'The :attribute field must be accepted.',
|
||||||
|
'accepted_if' => 'The :attribute field must be accepted when :other is :value.',
|
||||||
|
'active_url' => 'The :attribute field must be a valid URL.',
|
||||||
|
'after' => 'The :attribute field must be a date after :date.',
|
||||||
|
'after_or_equal' => 'The :attribute field must be a date after or equal to :date.',
|
||||||
|
'alpha' => 'The :attribute field must only contain letters.',
|
||||||
|
'alpha_dash' => 'The :attribute field must only contain letters, numbers, dashes, and underscores.',
|
||||||
|
'alpha_num' => 'The :attribute field must only contain letters and numbers.',
|
||||||
|
'array' => 'The :attribute field must be an array.',
|
||||||
|
'ascii' => 'The :attribute field must only contain single-byte alphanumeric characters and symbols.',
|
||||||
|
'before' => 'The :attribute field must be a date before :date.',
|
||||||
|
'before_or_equal' => 'The :attribute field must be a date before or equal to :date.',
|
||||||
|
'between' => [
|
||||||
|
'array' => 'The :attribute field must have between :min and :max items.',
|
||||||
|
'file' => 'The :attribute field must be between :min and :max kilobytes.',
|
||||||
|
'numeric' => 'The :attribute field must be between :min and :max.',
|
||||||
|
'string' => 'The :attribute field must be between :min and :max characters.',
|
||||||
|
],
|
||||||
|
'boolean' => 'The :attribute field must be true or false.',
|
||||||
|
'confirmed' => 'The :attribute field confirmation does not match.',
|
||||||
|
'current_password' => 'The password is incorrect.',
|
||||||
|
'date' => 'The :attribute field must be a valid date.',
|
||||||
|
'date_equals' => 'The :attribute field must be a date equal to :date.',
|
||||||
|
'date_format' => 'The :attribute field must match the format :format.',
|
||||||
|
'decimal' => 'The :attribute field must have :decimal decimal places.',
|
||||||
|
'declined' => 'The :attribute field must be declined.',
|
||||||
|
'declined_if' => 'The :attribute field must be declined when :other is :value.',
|
||||||
|
'different' => 'The :attribute field and :other must be different.',
|
||||||
|
'digits' => 'The :attribute field must be :digits digits.',
|
||||||
|
'digits_between' => 'The :attribute field must be between :min and :max digits.',
|
||||||
|
'dimensions' => 'The :attribute field has invalid image dimensions.',
|
||||||
|
'distinct' => 'The :attribute field has a duplicate value.',
|
||||||
|
'doesnt_end_with' => 'The :attribute field must not end with one of the following: :values.',
|
||||||
|
'doesnt_start_with' => 'The :attribute field must not start with one of the following: :values.',
|
||||||
|
'email' => 'The :attribute field must be a valid email address.',
|
||||||
|
'ends_with' => 'The :attribute field must end with one of the following: :values.',
|
||||||
|
'enum' => 'The selected :attribute is invalid.',
|
||||||
|
'exists' => 'The selected :attribute is invalid.',
|
||||||
|
'file' => 'The :attribute field must be a file.',
|
||||||
|
'filled' => 'The :attribute field must have a value.',
|
||||||
|
'gt' => [
|
||||||
|
'array' => 'The :attribute field must have more than :value items.',
|
||||||
|
'file' => 'The :attribute field must be greater than :value kilobytes.',
|
||||||
|
'numeric' => 'The :attribute field must be greater than :value.',
|
||||||
|
'string' => 'The :attribute field must be greater than :value characters.',
|
||||||
|
],
|
||||||
|
'gte' => [
|
||||||
|
'array' => 'The :attribute field must have :value items or more.',
|
||||||
|
'file' => 'The :attribute field must be greater than or equal to :value kilobytes.',
|
||||||
|
'numeric' => 'The :attribute field must be greater than or equal to :value.',
|
||||||
|
'string' => 'The :attribute field must be greater than or equal to :value characters.',
|
||||||
|
],
|
||||||
|
'image' => 'The :attribute field must be an image.',
|
||||||
|
'in' => 'The selected :attribute is invalid.',
|
||||||
|
'in_array' => 'The :attribute field must exist in :other.',
|
||||||
|
'integer' => 'The :attribute field must be an integer.',
|
||||||
|
'ip' => 'The :attribute field must be a valid IP address.',
|
||||||
|
'ipv4' => 'The :attribute field must be a valid IPv4 address.',
|
||||||
|
'ipv6' => 'The :attribute field must be a valid IPv6 address.',
|
||||||
|
'json' => 'The :attribute field must be a valid JSON string.',
|
||||||
|
'lowercase' => 'The :attribute field must be lowercase.',
|
||||||
|
'lt' => [
|
||||||
|
'array' => 'The :attribute field must have less than :value items.',
|
||||||
|
'file' => 'The :attribute field must be less than :value kilobytes.',
|
||||||
|
'numeric' => 'The :attribute field must be less than :value.',
|
||||||
|
'string' => 'The :attribute field must be less than :value characters.',
|
||||||
|
],
|
||||||
|
'lte' => [
|
||||||
|
'array' => 'The :attribute field must not have more than :value items.',
|
||||||
|
'file' => 'The :attribute field must be less than or equal to :value kilobytes.',
|
||||||
|
'numeric' => 'The :attribute field must be less than or equal to :value.',
|
||||||
|
'string' => 'The :attribute field must be less than or equal to :value characters.',
|
||||||
|
],
|
||||||
|
'mac_address' => 'The :attribute field must be a valid MAC address.',
|
||||||
|
'max' => [
|
||||||
|
'array' => 'The :attribute field must not have more than :max items.',
|
||||||
|
'file' => 'The :attribute field must not be greater than :max kilobytes.',
|
||||||
|
'numeric' => 'The :attribute field must not be greater than :max.',
|
||||||
|
'string' => 'The :attribute field must not be greater than :max characters.',
|
||||||
|
],
|
||||||
|
'max_digits' => 'The :attribute field must not have more than :max digits.',
|
||||||
|
'mimes' => 'The :attribute field must be a file of type: :values.',
|
||||||
|
'mimetypes' => 'The :attribute field must be a file of type: :values.',
|
||||||
|
'min' => [
|
||||||
|
'array' => 'The :attribute field must have at least :min items.',
|
||||||
|
'file' => 'The :attribute field must be at least :min kilobytes.',
|
||||||
|
'numeric' => 'The :attribute field must be at least :min.',
|
||||||
|
'string' => 'The :attribute field must be at least :min characters.',
|
||||||
|
],
|
||||||
|
'min_digits' => 'The :attribute field must have at least :min digits.',
|
||||||
|
'missing' => 'The :attribute field must be missing.',
|
||||||
|
'missing_if' => 'The :attribute field must be missing when :other is :value.',
|
||||||
|
'missing_unless' => 'The :attribute field must be missing unless :other is :value.',
|
||||||
|
'missing_with' => 'The :attribute field must be missing when :values is present.',
|
||||||
|
'missing_with_all' => 'The :attribute field must be missing when :values are present.',
|
||||||
|
'multiple_of' => 'The :attribute field must be a multiple of :value.',
|
||||||
|
'not_in' => 'The selected :attribute is invalid.',
|
||||||
|
'not_regex' => 'The :attribute field format is invalid.',
|
||||||
|
'numeric' => 'The :attribute field must be a number.',
|
||||||
|
'password' => [
|
||||||
|
'letters' => 'The :attribute field must contain at least one letter.',
|
||||||
|
'mixed' => 'The :attribute field must contain at least one uppercase and one lowercase letter.',
|
||||||
|
'numbers' => 'The :attribute field must contain at least one number.',
|
||||||
|
'symbols' => 'The :attribute field must contain at least one symbol.',
|
||||||
|
'uncompromised' => 'The given :attribute has appeared in a data leak. Please choose a different :attribute.',
|
||||||
|
],
|
||||||
|
'present' => 'The :attribute field must be present.',
|
||||||
|
'prohibited' => 'The :attribute field is prohibited.',
|
||||||
|
'prohibited_if' => 'The :attribute field is prohibited when :other is :value.',
|
||||||
|
'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.',
|
||||||
|
'prohibits' => 'The :attribute field prohibits :other from being present.',
|
||||||
|
'regex' => 'The :attribute field format is invalid.',
|
||||||
|
'required' => 'The :attribute field is required.',
|
||||||
|
'required_array_keys' => 'The :attribute field must contain entries for: :values.',
|
||||||
|
'required_if' => 'The :attribute field is required when :other is :value.',
|
||||||
|
'required_if_accepted' => 'The :attribute field is required when :other is accepted.',
|
||||||
|
'required_unless' => 'The :attribute field is required unless :other is in :values.',
|
||||||
|
'required_with' => 'The :attribute field is required when :values is present.',
|
||||||
|
'required_with_all' => 'The :attribute field is required when :values are present.',
|
||||||
|
'required_without' => 'The :attribute field is required when :values is not present.',
|
||||||
|
'required_without_all' => 'The :attribute field is required when none of :values are present.',
|
||||||
|
'same' => 'The :attribute field must match :other.',
|
||||||
|
'size' => [
|
||||||
|
'array' => 'The :attribute field must contain :size items.',
|
||||||
|
'file' => 'The :attribute field must be :size kilobytes.',
|
||||||
|
'numeric' => 'The :attribute field must be :size.',
|
||||||
|
'string' => 'The :attribute field must be :size characters.',
|
||||||
|
],
|
||||||
|
'starts_with' => 'The :attribute field must start with one of the following: :values.',
|
||||||
|
'string' => 'The :attribute field must be a string.',
|
||||||
|
'timezone' => 'The :attribute field must be a valid timezone.',
|
||||||
|
'unique' => 'The :attribute has already been taken.',
|
||||||
|
'uploaded' => 'The :attribute failed to upload.',
|
||||||
|
'uppercase' => 'The :attribute field must be uppercase.',
|
||||||
|
'url' => 'The :attribute field must be a valid URL.',
|
||||||
|
'ulid' => 'The :attribute field must be a valid ULID.',
|
||||||
|
'uuid' => 'The :attribute field must be a valid UUID.',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Custom Validation Language Lines
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify custom validation messages for attributes using the
|
||||||
|
| convention "attribute.rule" to name the lines. This makes it quick to
|
||||||
|
| specify a specific custom language line for a given attribute rule.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'custom' => [
|
||||||
|
'attribute-name' => [
|
||||||
|
'rule-name' => 'custom-message',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Custom Validation Attributes
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The following language lines are used to swap our attribute placeholder
|
||||||
|
| with something more reader friendly such as "E-Mail Address" instead
|
||||||
|
| of "email". This simply helps us make our message more expressive.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'attributes' => [],
|
||||||
|
|
||||||
|
];
|
75
lang/fr/app.php
Normal file
75
lang/fr/app.php
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
return [
|
||||||
|
'preview-bundle' => 'Contenu de l\'archive',
|
||||||
|
'bundle-preview-intro' => 'Here is the list of the files you can download:',
|
||||||
|
'warning-bundle-expiration' => 'L\'archive expire',
|
||||||
|
'warning-bundle-expired' => 'L\'archive a expiré',
|
||||||
|
'download-all' => 'Tout télécharger',
|
||||||
|
'for' => 'pour',
|
||||||
|
'files' => 'fichier|fichiers',
|
||||||
|
'no-file-in-this-bundle' => 'Aucun fichier dans cette archive',
|
||||||
|
'maximum-filesize' => 'Taille maximum :',
|
||||||
|
'preview-link' => 'Lien de visualisation',
|
||||||
|
'direct-link' => 'Lien de téléchargement',
|
||||||
|
'delete-link' => 'Lien de suppression',
|
||||||
|
'upload-files-title' => 'Téléverser',
|
||||||
|
'bundle-preview-title' => 'Télécharger',
|
||||||
|
'files-list' => 'Fichiers téléversés',
|
||||||
|
'error-title' => 'Une erreur est survenue',
|
||||||
|
'files-count-limit' => 'Nombre maximal de fichiers atteint',
|
||||||
|
'file-too-big' => 'Le fichier est trop lourd',
|
||||||
|
'cannot-upload' => 'Impossible de téléverser',
|
||||||
|
'cannot-upload-blocked-ip' => 'Vous n\'avez pas la permission de téléverser sur cette application',
|
||||||
|
'upload-permission-required' => 'Autorisation requise pour téléverser',
|
||||||
|
'cannot-upload-no-password' => 'You must provide a valid password in order to upload on this application',
|
||||||
|
'password' => 'Mot de passe',
|
||||||
|
'upload-disabled' => 'Téléversement désactivé',
|
||||||
|
'start-new-upload' => 'Cliquez ici pour créer une nouvelle archive',
|
||||||
|
'upload-settings' => 'Préférences',
|
||||||
|
'upload-expiry' => 'Expiration',
|
||||||
|
'upload-title' => 'Titre',
|
||||||
|
'upload-description' => 'Description',
|
||||||
|
'required' => 'Requis',
|
||||||
|
'download-links' => 'Liens de téléchargement',
|
||||||
|
'one-hour' => 'Une heure (1H)',
|
||||||
|
'two-hours' => 'Deux heures (2H)',
|
||||||
|
'six-hours' => 'Six heures (6H)',
|
||||||
|
'twelve-hours' => 'Douze heures (12H)',
|
||||||
|
'one-day' => 'Un jour (1J)',
|
||||||
|
'two-days' => 'Deux jours (2J)',
|
||||||
|
'one-week' => 'Une semaine (1S)',
|
||||||
|
'two-weeks' => 'Deux semaines (2S)',
|
||||||
|
'one-month' => 'Un mois (1M)',
|
||||||
|
'three-months' => 'Trois mois (3M)',
|
||||||
|
'six-months' => 'Six mois (6M)',
|
||||||
|
'step' => 'Etape',
|
||||||
|
'leave-empty' => 'Laissez vide pour désactiver mot de passe',
|
||||||
|
'back' => 'Retour',
|
||||||
|
'start-uploading' => 'Téléverser vos fichiers',
|
||||||
|
'bundle-password' => 'Mot de passe',
|
||||||
|
'complete-upload' => 'Compléter l\'archive',
|
||||||
|
'no-file' => 'Aucun fichier téléversé',
|
||||||
|
'click-to-remove' => 'Cliquez pour supprimer ce fichier',
|
||||||
|
'confirm-delete' => 'Voulez-vous supprimer ce fichier ?',
|
||||||
|
'confirm-complete' => 'Voulez-vous compléter cette archive ? Elle sera verrouillée et ne pourra plus être modifiée.',
|
||||||
|
'confirmation' => 'Confirmation',
|
||||||
|
'cancel' => 'Annuler',
|
||||||
|
'confirm' => 'Confirmer',
|
||||||
|
'bundle-locked' => 'Cette archive est close et verrouillée',
|
||||||
|
'created-at' => 'Créé',
|
||||||
|
'fullsize' => 'Total',
|
||||||
|
'max-downloads' => 'Téléchargements maximum',
|
||||||
|
'create-new-upload' => 'Créer une nouvelle archive',
|
||||||
|
'page-not-found' => 'Page non trouvée',
|
||||||
|
'permission-denied' => 'Permission refusée',
|
||||||
|
'dropzone-text' => 'Déposez vos fichiers ici (ou cliquez)',
|
||||||
|
'server-answered' => 'Le serveur a répondu avec le code {{statusCode}}.',
|
||||||
|
'files-count-on-server' => 'Nombre de fichiers téléversés',
|
||||||
|
'files-remaining-files' => 'Nombre de fichiers restants autorisés',
|
||||||
|
'delete-bundle' => 'Supprimer l\'archive',
|
||||||
|
'confirm-delete-bundle' => 'Voulez-vous supprimer cette archive ?',
|
||||||
|
'bundle-expired' => 'Cette archive a expiré'
|
||||||
|
|
||||||
|
];
|
22
package.json
Normal file
22
package.json
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "vite build"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"axios": "^1.1.2",
|
||||||
|
"laravel-vite-plugin": "^0.7.2",
|
||||||
|
"vite": "^4.3.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"alpinejs": "^3.12.0",
|
||||||
|
"autoprefixer": "^10.4.14",
|
||||||
|
"dropzone": "^6.0.0-beta.2",
|
||||||
|
"global": "^4.4.0",
|
||||||
|
"lodash": "^4.17.21",
|
||||||
|
"moment": "^2.29.4",
|
||||||
|
"postcss": "^8.4.23",
|
||||||
|
"tailwindcss": "^3.3.2"
|
||||||
|
}
|
||||||
|
}
|
31
phpunit.xml
Normal file
31
phpunit.xml
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
|
||||||
|
bootstrap="vendor/autoload.php"
|
||||||
|
colors="true"
|
||||||
|
>
|
||||||
|
<testsuites>
|
||||||
|
<testsuite name="Unit">
|
||||||
|
<directory suffix="Test.php">./tests/Unit</directory>
|
||||||
|
</testsuite>
|
||||||
|
<testsuite name="Feature">
|
||||||
|
<directory suffix="Test.php">./tests/Feature</directory>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
||||||
|
<source>
|
||||||
|
<include>
|
||||||
|
<directory suffix=".php">./app</directory>
|
||||||
|
</include>
|
||||||
|
</source>
|
||||||
|
<php>
|
||||||
|
<env name="APP_ENV" value="testing"/>
|
||||||
|
<env name="BCRYPT_ROUNDS" value="4"/>
|
||||||
|
<env name="CACHE_DRIVER" value="array"/>
|
||||||
|
<!-- <env name="DB_CONNECTION" value="sqlite"/> -->
|
||||||
|
<!-- <env name="DB_DATABASE" value=":memory:"/> -->
|
||||||
|
<env name="MAIL_MAILER" value="array"/>
|
||||||
|
<env name="QUEUE_CONNECTION" value="sync"/>
|
||||||
|
<env name="SESSION_DRIVER" value="array"/>
|
||||||
|
<env name="TELESCOPE_ENABLED" value="false"/>
|
||||||
|
</php>
|
||||||
|
</phpunit>
|
6
postcss.config.js
Normal file
6
postcss.config.js
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
module.exports = {
|
||||||
|
plugins: {
|
||||||
|
tailwindcss: {},
|
||||||
|
autoprefixer: {},
|
||||||
|
},
|
||||||
|
}
|
21
public/.htaccess
Normal file
21
public/.htaccess
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<IfModule mod_rewrite.c>
|
||||||
|
<IfModule mod_negotiation.c>
|
||||||
|
Options -MultiViews -Indexes
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
RewriteEngine On
|
||||||
|
|
||||||
|
# Handle Authorization Header
|
||||||
|
RewriteCond %{HTTP:Authorization} .
|
||||||
|
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||||
|
|
||||||
|
# Redirect Trailing Slashes If Not A Folder...
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
RewriteCond %{REQUEST_URI} (.+)/$
|
||||||
|
RewriteRule ^ %1 [L,R=301]
|
||||||
|
|
||||||
|
# Send Requests To Front Controller...
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteRule ^ index.php [L]
|
||||||
|
</IfModule>
|
0
public/favicon.ico
Normal file
0
public/favicon.ico
Normal file
BIN
public/images/bg.jpg
Normal file
BIN
public/images/bg.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 160 KiB |
BIN
public/images/bg.png
Normal file
BIN
public/images/bg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 259 KiB |
BIN
public/images/capture.gif
Normal file
BIN
public/images/capture.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 763 KiB |
55
public/index.php
Normal file
55
public/index.php
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Http\Kernel;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
define('LARAVEL_START', microtime(true));
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Check If The Application Is Under Maintenance
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| If the application is in maintenance / demo mode via the "down" command
|
||||||
|
| we will load this file so that any pre-rendered content can be shown
|
||||||
|
| instead of starting the framework, which could cause an exception.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
|
||||||
|
require $maintenance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Register The Auto Loader
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Composer provides a convenient, automatically generated class loader for
|
||||||
|
| this application. We just need to utilize it! We'll simply require it
|
||||||
|
| into the script here so we don't need to manually load our classes.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
require __DIR__.'/../vendor/autoload.php';
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Run The Application
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Once we have the application, we can handle the incoming request using
|
||||||
|
| the application's HTTP kernel. Then, we will send the response back
|
||||||
|
| to this client's browser, allowing them to enjoy our application.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$app = require_once __DIR__.'/../bootstrap/app.php';
|
||||||
|
|
||||||
|
$kernel = $app->make(Kernel::class);
|
||||||
|
|
||||||
|
$response = $kernel->handle(
|
||||||
|
$request = Request::capture()
|
||||||
|
)->send();
|
||||||
|
|
||||||
|
$kernel->terminate($request, $response);
|
2
public/robots.txt
Normal file
2
public/robots.txt
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
User-agent: *
|
||||||
|
Disallow:
|
132
readme.md
Normal file
132
readme.md
Normal file
|
@ -0,0 +1,132 @@
|
||||||
|
# Files Sharing
|
||||||
|
|
||||||
|
<p align="center"><img src="https://github.com/axeloz/filesharing/raw/master/public/img/capture.png" width="700" /></p>
|
||||||
|
|
||||||
|
Powered by Laravel
|
||||||
|
<p><img src="https://laravel.com/assets/img/components/logo-laravel.svg"></p>
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
This PHP application based on Laravel 5.4 allows to share files like Wetransfer. You may install it **on your own server**. It **does not require** any database system, it works with JSON files into the storage folder. It is **multilingual** and comes with english and french translations for now. You're welcome to help translating the app.
|
||||||
|
|
||||||
|
It comes with a droplet. You may drag and drop some files or directories into the droplet, your files will be uploaded to the server as a bundle.
|
||||||
|
|
||||||
|
A bundle is like a package containing is a various number of files. The bundle has a 2 weeks expiry date after the creation of the bundle. This value is not editable yet, this is a todo.
|
||||||
|
|
||||||
|
This application provides three links per upload bundle :
|
||||||
|
- a bundle preview link : you can send this link to your recipients who will see the bundle content. For example: http://yourdomain/bundle/dda2d646b6746b96ea9b?auth=965242. The recipient can see all the files of the bundle, can download one given file only or the entire bundle.
|
||||||
|
- a bundle download link : you can send this link yo your recipients who will download all the files of the bundle at once (without any preview). For example: http://yourdomain/bundle/dda2d646b6746b96ea9b/download?auth=965242.
|
||||||
|
- a deletion link : for you only, it invalidates the bundle. For example:
|
||||||
|
http://yourdomain/bundle/dda2d646b6746b96ea9b/delete?auth=ace6f22f5.
|
||||||
|
|
||||||
|
Each of these links comes with an authorization code. This code is the same for the preview and the download links. However it is different for the deletion link for obvious reasons.
|
||||||
|
|
||||||
|
The application also comes with a Laravel Artisan command as a background task who will physically remove expired bundle files of the storage disk. This command is configured to run every five minutes among the Laravel scheduled commands.
|
||||||
|
|
||||||
|
Sorry about the design, I'm not very good at this, you're welcome to help and participate.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- upload one or more files via drag and drop or via browsing your computer
|
||||||
|
- creation of a bundle
|
||||||
|
- ability to keep adding files to the bundle until you close your browser tab, the preview link remain untouched
|
||||||
|
- bundle expiration after 2 weeks
|
||||||
|
- sharing link with bundle content preview
|
||||||
|
- ability to download a single file of the bundle or the entire bundle
|
||||||
|
- direct download link (doesn't preview the bundle content)
|
||||||
|
- deletion link for bundle owner
|
||||||
|
- garbage collector which removes the expired bundles as a background task
|
||||||
|
- multilingual (EN and FR)
|
||||||
|
- easy installation, no database required
|
||||||
|
- upload limitation based on client IP filtering
|
||||||
|
- secured by tokens, authentication codes and non-publicly-accessible files
|
||||||
|
- (very) early stage for theming support
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
Basically, nothing more than Laravel itself:
|
||||||
|
- PHP >= 5.6.4
|
||||||
|
- OpenSSL PHP Extension
|
||||||
|
- PDO PHP Extension
|
||||||
|
- Mbstring PHP Extension
|
||||||
|
- Tokenizer PHP Extension
|
||||||
|
- XML PHP Extension
|
||||||
|
|
||||||
|
Plus:
|
||||||
|
- JSON PHP Extension (included in PHP 5.2+)
|
||||||
|
- ZipArchive PHP Extension (included in PHP 5.3+)
|
||||||
|
|
||||||
|
The application also uses:
|
||||||
|
- http://www.dropzonejs.com/
|
||||||
|
- http://jquery.com/
|
||||||
|
- https://clipboardjs.com/
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
- configure your domain name. For example: files.yourdomain.com
|
||||||
|
- clone the repo or download the sources into the webroot folder
|
||||||
|
- configure your webserver to point your domain name to the public/ folder
|
||||||
|
- run a `composer install`
|
||||||
|
- run a `npm install --production`
|
||||||
|
- make sure that the PHP process has write permission on the ./storage folder
|
||||||
|
- generate the Laravel KEY: `php artisan key:generate`
|
||||||
|
- start the Laravel scheduler (it will delete expired bundles of the storage). For example `* * * * * php /path-to-your-project/artisan schedule:run >> /dev/null 2>&1`
|
||||||
|
|
||||||
|
Use your browser to navigate to your domain name (example: files.yourdomain.com) and **that's it**.
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
In order to configure your application, copy the .env.example file into .env. Then edit the .env file.
|
||||||
|
|
||||||
|
| Configuration | Description |
|
||||||
|
| ------------- | ----------- |
|
||||||
|
| `APP_ENV` | change this to `production` when in production (`local` otherwise) |
|
||||||
|
| `APP_DEBUG` | change this to `false` when in production (`true` otherwise) |
|
||||||
|
| `TIMEZONE` | change this to your current timezone |
|
||||||
|
| `LOCALE` | change this to "fr" or "en" |
|
||||||
|
| `STORAGE_PATH` | (*optional*) changes this wherever you want to store the files. When missing, using the `storage` folder at the root of the application |
|
||||||
|
| `UPLOAD_MAX_FILES` | (*optional*) maximal number of files per bundle |
|
||||||
|
| `UPLOAD_MAX_FILESIZE` | (*optional*) change this to the value you want (K, M, G, T, ...). Attention : you must configure your PHP settings too (`post_max_size`, `upload_max_filesize` and `memory_limit`). When missing, using PHP lowest configuration |
|
||||||
|
| `UPLOAD_LIMIT_IPS` | (*optional*) a comma separated list of IPs from which you may upload files. Different formats are supported : Full IP address (192.168.10.2), Wildcard format (192.168.10.*), CIDR Format (192.168.10/24 or 1.2.3.4/255.255.255.0) or Start-end IP (192.168.10.0-192.168.10.10). When missing, filtering is disabled. |
|
||||||
|
| `APP_NAME` | the title of the application |
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
If your want to modify the sources, you can use the Laravel Mix features:
|
||||||
|
- configure your domain name. For example: files.yourdomain.com
|
||||||
|
- clone the repo or download the sources into the webroot folder
|
||||||
|
- configure your webserver to point your domain name to the public/ folder
|
||||||
|
- run a `composer install`
|
||||||
|
- run a `npm install`
|
||||||
|
- run a `npm run watch` in order to recompile the assets when changed
|
||||||
|
|
||||||
|
## Roadmap / Ideas / Improvements
|
||||||
|
|
||||||
|
There are many ideas to come. You are welcome to **participate**.
|
||||||
|
- ability to define a bundle name and/or description that will be shown to the recipients
|
||||||
|
- make the expiry date editable per bundle
|
||||||
|
- limit upload permission by a password (or passwords)
|
||||||
|
- disable bundle after X downloads (value to be configurable by the bundle owner)
|
||||||
|
- ability to send link to recipients directly from the app
|
||||||
|
- add PHP unit testing
|
||||||
|
- more testing on heavy files
|
||||||
|
- customizable / white labeling (logo, name, terms of service, footer ...)
|
||||||
|
- responsiveness (is it really useful?)
|
||||||
|
|
||||||
|
## Licence
|
||||||
|
|
||||||
|
GPLv3
|
||||||
|
|
||||||
|
| Permissions | Conditions | Limitations |
|
||||||
|
| --------------- | ----------------------------- | ----------- |
|
||||||
|
| Commercial use | Disclose source | Liability |
|
||||||
|
| Distribution | License and copyright notice | Warranty |
|
||||||
|
| Modification | Same license | |
|
||||||
|
| Patent use | State changes | |
|
||||||
|
| Private use | | |
|
||||||
|
|
||||||
|
https://choosealicense.com/licenses/gpl-3.0/
|
||||||
|
|
||||||
|
## Welcome on board
|
||||||
|
|
||||||
|
If you are willing to **participate** or if you just want to talk with me : sharing@mabox.eu
|
13
resources/css/app.css
Normal file
13
resources/css/app.css
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
@import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@300;400;500;600;700&family=Rajdhani:wght@300;400;500;600;700&display=swap');
|
||||||
|
|
||||||
|
@tailwind base;
|
||||||
|
@tailwind components;
|
||||||
|
@tailwind utilities;
|
||||||
|
|
||||||
|
@layer utilities {
|
||||||
|
.dropzone {
|
||||||
|
@apply border-2 border-primary-light !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
[x-cloak] { display: none !important; }
|
||||||
|
}
|
BIN
resources/images/bg.jpg
Normal file
BIN
resources/images/bg.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 MiB |
25
resources/js/app.js
Normal file
25
resources/js/app.js
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
import Alpine from 'alpinejs';
|
||||||
|
import { takeWhile } from 'lodash';
|
||||||
|
window.Alpine = Alpine;
|
||||||
|
|
||||||
|
import axios from 'axios';
|
||||||
|
window.axios = axios;
|
||||||
|
|
||||||
|
import moment from 'moment';
|
||||||
|
window.moment = moment;
|
||||||
|
moment().format();
|
||||||
|
|
||||||
|
|
||||||
|
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
||||||
|
|
||||||
|
import Dropzone from "dropzone";
|
||||||
|
window.Dropzone = Dropzone;
|
||||||
|
import "dropzone/dist/dropzone.css";
|
||||||
|
|
||||||
|
|
||||||
|
import.meta.glob([
|
||||||
|
'../images/**',
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
Alpine.start()
|
1
resources/js/bootstrap.js
vendored
Normal file
1
resources/js/bootstrap.js
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
|
18
resources/views/cannotupload.blade.php
Normal file
18
resources/views/cannotupload.blade.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
@extends('layout')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div>
|
||||||
|
<div class="relative bg-white border border-primary rounded-lg overflow-hidden">
|
||||||
|
<div class="bg-gradient-to-r from-primary-light to-primary px-2 py-4 text-center">
|
||||||
|
<h1 class="relative font-title font-medium font-body text-4xl text-center text-white uppercase flex items-center">
|
||||||
|
|
||||||
|
<div class="grow text-center">{{ config('app.name') }}</div>
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="my-10 text-center text-base font-title uppercase text-primary">
|
||||||
|
@lang('app.cannot-upload-blocked-ip')
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
151
resources/views/download.blade.php
Normal file
151
resources/views/download.blade.php
Normal file
|
@ -0,0 +1,151 @@
|
||||||
|
@extends('layout')
|
||||||
|
|
||||||
|
@section('page_title', $metadata['title'] ?? null)
|
||||||
|
|
||||||
|
@push('scripts')
|
||||||
|
<script>
|
||||||
|
let auth = @js($auth);
|
||||||
|
let bundleId = @js($bundleId);
|
||||||
|
let bundle_expires = '{{ __('app.warning-bundle-expiration') }}'
|
||||||
|
let bundle_expired = '{{ __('app.warning-bundle-expired') }}'
|
||||||
|
|
||||||
|
document.addEventListener('alpine:init', () => {
|
||||||
|
Alpine.data('download', () => ({
|
||||||
|
metadata: @js($metadata),
|
||||||
|
created_at: null,
|
||||||
|
expires_at: null,
|
||||||
|
expired: null,
|
||||||
|
|
||||||
|
init: function() {
|
||||||
|
this.updateTimes()
|
||||||
|
|
||||||
|
window.setInterval( () => {
|
||||||
|
this.updateTimes()
|
||||||
|
}, 5000)
|
||||||
|
},
|
||||||
|
|
||||||
|
updateTimes: function() {
|
||||||
|
this.created_at = moment.unix(this.metadata.created_at).fromNow()
|
||||||
|
|
||||||
|
if (this.isExpired()) {
|
||||||
|
this.expires_at = bundle_expired
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.expires_at = bundle_expires+' '+moment.unix(this.metadata.expires_at).fromNow()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
isExpired: function() {
|
||||||
|
if (moment().isAfter(moment.unix(this.metadata.expires_at))) {
|
||||||
|
this.expired = true
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.expired = false
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
humanSize: function(val) {
|
||||||
|
if (val >= 100000000) {
|
||||||
|
return (val / 1000000000).toFixed(1) + ' Go'
|
||||||
|
}
|
||||||
|
else if (val >= 1000000) {
|
||||||
|
return (val / 1000000).toFixed(1) + ' Mo'
|
||||||
|
}
|
||||||
|
else if (val >= 1000) {
|
||||||
|
return (val / 1000).toFixed(1) + ' Ko'
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return val + ' o'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
downloadAll: function() {
|
||||||
|
window.location.href = this.metadata.download_link
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div x-data="download">
|
||||||
|
<div class="relative bg-white border border-primary rounded-lg overflow-hidden">
|
||||||
|
<div class="bg-gradient-to-r from-primary-light to-primary px-2 py-4 mb-3 text-center">
|
||||||
|
<h1 class="relative font-title font-medium font-body text-4xl text-center text-white uppercase flex items-center">
|
||||||
|
<div class="w-1/12 text-center"> </div>
|
||||||
|
|
||||||
|
<div class="grow text-center">{{ config('app.name') }}</div>
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="p-5">
|
||||||
|
<h2 class="font-title text-2xl mb-5 text-primary font-medium uppercase">
|
||||||
|
@lang('app.preview-bundle')
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<div class="flex flex-wrap items-center">
|
||||||
|
<p class="w-6/12 px-1">
|
||||||
|
<span class="font-title text-xs text-primary uppercase mr-1">
|
||||||
|
@lang('app.upload-title')
|
||||||
|
</span>
|
||||||
|
<span x-text="metadata.title"></span>
|
||||||
|
</p>
|
||||||
|
<p class="w-4/12 px-1">
|
||||||
|
<span class="font-title text-xs text-primary uppercase mr-1">
|
||||||
|
@lang('app.created-at')
|
||||||
|
</span>
|
||||||
|
<span x-text="created_at"></span>
|
||||||
|
</p>
|
||||||
|
<p class="w-2/12 px-1">
|
||||||
|
<span class="font-title text-xs text-primary uppercase mr-1">
|
||||||
|
@lang('app.fullsize')
|
||||||
|
</span>
|
||||||
|
<span x-text="humanSize(metadata.fullsize)"></span>
|
||||||
|
</p>
|
||||||
|
<p class="w-full px-1" x-show="metadata.description">
|
||||||
|
<span class="font-title text-xs text-primary uppercase mr-1">
|
||||||
|
@lang('app.upload-description')
|
||||||
|
</span>
|
||||||
|
<span x-text="metadata.description"></span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h2 class="font-title font-xs uppercase text-primary px-1 mt-5">Files</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul id="output" class="text-xs mt-1 max-h-32 overflow-y-scroll pb-3" x-show="Object.keys(metadata.files).length > 0">
|
||||||
|
<template x-for="f in metadata.files" :key="f.uuid">
|
||||||
|
<li class="leading-5 list-inside even:bg-gray-50 rounded px-2">
|
||||||
|
<p class="float-left w-9/12 overflow-hidden" x-text="f.original.substring(0, 40)"></p>
|
||||||
|
<p class="float-right w-2/12 text-right" float-right text-xs" x-text="humanSize(f.filesize)"></p>
|
||||||
|
<span class="clear-both"> </span>
|
||||||
|
</li>
|
||||||
|
</template>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="grid grid-cols-2 gap-10 mt-10 text-center items-center">
|
||||||
|
<div>
|
||||||
|
<p class="font-xs font-medium">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="inline w-4 h-4">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z" />
|
||||||
|
</svg>
|
||||||
|
<span x-text="expires_at"></span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
@include('partials.button', [
|
||||||
|
'way' => 'right',
|
||||||
|
'text' => __('app.download-all'),
|
||||||
|
'icon' => '<path stroke-linecap="round" stroke-linejoin="round" d="M7.5 7.5h-.75A2.25 2.25 0 004.5 9.75v7.5a2.25 2.25 0 002.25 2.25h7.5a2.25 2.25 0 002.25-2.25v-7.5a2.25 2.25 0 00-2.25-2.25h-.75m-6 3.75l3 3m0 0l3-3m-3 3V1.5m6 9h.75a2.25 2.25 0 012.25 2.25v7.5a2.25 2.25 0 01-2.25 2.25h-7.5a2.25 2.25 0 01-2.25-2.25v-.75" />',
|
||||||
|
'action' => 'downloadAll'
|
||||||
|
])
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
19
resources/views/errors/401.blade.php
Normal file
19
resources/views/errors/401.blade.php
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
@extends('layout')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div>
|
||||||
|
<div class="relative bg-white border border-primary rounded-lg overflow-hidden">
|
||||||
|
<div class="bg-gradient-to-r from-primary-light to-primary px-2 py-4 text-center">
|
||||||
|
<h1 class="relative font-title font-medium font-body text-4xl text-center text-white uppercase flex items-center">
|
||||||
|
|
||||||
|
<div class="grow text-center">{{ config('app.name') }}</div>
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="my-10 text-center text-base font-title uppercase text-primary">
|
||||||
|
<h1 class="text-7xl mb-0 font-black">401</h1>
|
||||||
|
@lang('app.permission-denied')
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
19
resources/views/errors/404.blade.php
Normal file
19
resources/views/errors/404.blade.php
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
@extends('layout')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div>
|
||||||
|
<div class="relative bg-white border border-primary rounded-lg overflow-hidden">
|
||||||
|
<div class="bg-gradient-to-r from-primary-light to-primary px-2 py-4 text-center">
|
||||||
|
<h1 class="relative font-title font-medium font-body text-4xl text-center text-white uppercase flex items-center">
|
||||||
|
|
||||||
|
<div class="grow text-center">{{ config('app.name') }}</div>
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="my-10 text-center text-base font-title uppercase text-primary">
|
||||||
|
<h1 class="text-7xl mb-0 font-black">404</h1>
|
||||||
|
@lang('app.page-not-found')
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
1
resources/views/footer.blade.php
Normal file
1
resources/views/footer.blade.php
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<footer></footer>
|
1
resources/views/header.blade.php
Normal file
1
resources/views/header.blade.php
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<header></header>
|
82
resources/views/homepage.blade.php
Normal file
82
resources/views/homepage.blade.php
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
@extends('layout')
|
||||||
|
|
||||||
|
|
||||||
|
@push('scripts')
|
||||||
|
<script>
|
||||||
|
document.addEventListener('alpine:init', () => {
|
||||||
|
Alpine.data('bundle', () => ({
|
||||||
|
bundles: null,
|
||||||
|
|
||||||
|
init: function() {
|
||||||
|
bundles = localStorage.getItem('bundles');
|
||||||
|
|
||||||
|
if (bundles == null || bundles == '') {
|
||||||
|
console.log('creating bundles')
|
||||||
|
this.bundles = []
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.bundles = JSON.parse(bundles)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
newBundle: function() {
|
||||||
|
// Generating a new bundle key pair
|
||||||
|
const pair = {
|
||||||
|
bundle_id: this.generateStr(30),
|
||||||
|
owner_token: this.generateStr(15)
|
||||||
|
}
|
||||||
|
this.bundles.push(pair)
|
||||||
|
|
||||||
|
// Storing them locally
|
||||||
|
localStorage.setItem('bundles', JSON.stringify(this.bundles))
|
||||||
|
|
||||||
|
axios({
|
||||||
|
url: '/new',
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
bundle_id: pair.bundle_id,
|
||||||
|
owner_token: pair.owner_token
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then( (response) => {
|
||||||
|
window.location.href = '/upload/'+response.data.bundle_id
|
||||||
|
})
|
||||||
|
.catch( (error) => {
|
||||||
|
//TODO: do something here
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
generateStr: function(length) {
|
||||||
|
const characters ='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||||
|
|
||||||
|
let result = '';
|
||||||
|
const charactersLength = characters.length;
|
||||||
|
for ( let i = 0; i < length; i++ ) {
|
||||||
|
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div x-data="bundle">
|
||||||
|
<div class="relative bg-white border border-primary rounded-lg overflow-hidden">
|
||||||
|
<div class="bg-gradient-to-r from-primary-light to-primary px-2 py-4 text-center">
|
||||||
|
<h1 class="relative font-title font-medium font-body text-4xl text-center text-white uppercase flex items-center">
|
||||||
|
|
||||||
|
<div class="grow text-center">{{ config('app.name') }}</div>
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="my-10 text-center text-base font-title uppercase text-primary">
|
||||||
|
<a x-on:click="newBundle()" class="cursor-pointer border px-5 py-3 border-primary rounded hover:bg-primary hover:text-white text-primary">
|
||||||
|
@lang('app.create-new-upload')
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
24
resources/views/layout.blade.php
Normal file
24
resources/views/layout.blade.php
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>
|
||||||
|
@hasSection('page_title')
|
||||||
|
@yield('page_title') -
|
||||||
|
@endif
|
||||||
|
{{ config('app.name') }}
|
||||||
|
</title>
|
||||||
|
<meta name="theme-color" content="#319197">
|
||||||
|
@vite('resources/css/app.css')
|
||||||
|
@stack('styles')
|
||||||
|
@vite('resources/js/app.js')
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="font-display text-[13px] selection:bg-purple-100 outline-none select-none">
|
||||||
|
|
||||||
|
<div class="fixed min-w-xl max-w-3xl left-[50%] top-[50%] translate-x-[-50%] translate-y-[-50%] md:w-2/3">@yield('content')</div>
|
||||||
|
|
||||||
|
@stack('scripts')
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
19
resources/views/partials/button.blade.php
Normal file
19
resources/views/partials/button.blade.php
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
@empty($way)
|
||||||
|
@php $way = 'right'; @endphp
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="inline-flex items-center w-full py-1 rounded bg-primary hover:bg-primary-light text-center text-white text-base text-center"
|
||||||
|
x-on:click="{{ $action }}()"
|
||||||
|
>
|
||||||
|
<p class="w-10/12 {{ $way == 'left' ? 'order-last' : '' }}">{{ $text }}</p>
|
||||||
|
|
||||||
|
<p class="w-2/12 {{ $way == 'left' ? 'border-r' : 'border-l' }} px-2 border-primary-light">
|
||||||
|
@if (! empty($icon))
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5 inline">
|
||||||
|
{!! $icon !!}
|
||||||
|
</svg>
|
||||||
|
@endif
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</button>
|
709
resources/views/upload.blade.php
Normal file
709
resources/views/upload.blade.php
Normal file
|
@ -0,0 +1,709 @@
|
||||||
|
@extends('layout')
|
||||||
|
|
||||||
|
@push('scripts')
|
||||||
|
<script>
|
||||||
|
let baseUrl = @js($baseUrl);
|
||||||
|
let metadata = @js($metadata ?? []);
|
||||||
|
let maxFiles = @js(config('sharing.max_files'));
|
||||||
|
let maxFileSize = @js(Upload::fileMaxSize());
|
||||||
|
|
||||||
|
document.addEventListener('alpine:init', () => {
|
||||||
|
Alpine.data('upload', () => ({
|
||||||
|
bundle: null,
|
||||||
|
bundles: null,
|
||||||
|
dropzone: null,
|
||||||
|
uploadedFiles: [],
|
||||||
|
metadata: [],
|
||||||
|
completed: false,
|
||||||
|
step: 0,
|
||||||
|
modal: {
|
||||||
|
show: false,
|
||||||
|
text: 'test'
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
title: '@lang('app.upload-settings')',
|
||||||
|
active: true,
|
||||||
|
icon: '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5 inline align-text-top text-primary"><path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12a7.5 7.5 0 0015 0m-15 0a7.5 7.5 0 1115 0m-15 0H3m16.5 0H21m-1.5 0H12m-8.457 3.077l1.41-.513m14.095-5.13l1.41-.513M5.106 17.785l1.15-.964m11.49-9.642l1.149-.964M7.501 19.795l.75-1.3m7.5-12.99l.75-1.3m-6.063 16.658l.26-1.477m2.605-14.772l.26-1.477m0 17.726l-.26-1.477M10.698 4.614l-.26-1.477M16.5 19.794l-.75-1.299M7.5 4.205L12 12m6.894 5.785l-1.149-.964M6.256 7.178l-1.15-.964m15.352 8.864l-1.41-.513M4.954 9.435l-1.41-.514M12.002 12l-3.75 6.495" /></svg>'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '@lang('app.upload-files-title')',
|
||||||
|
active: false,
|
||||||
|
icon: '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5 inline align-text-top text-primary"><path stroke-linecap="round" stroke-linejoin="round" d="M7.5 7.5h-.75A2.25 2.25 0 004.5 9.75v7.5a2.25 2.25 0 002.25 2.25h7.5a2.25 2.25 0 002.25-2.25v-7.5a2.25 2.25 0 00-2.25-2.25h-.75m0-3l-3-3m0 0l-3 3m3-3v11.25m6-2.25h.75a2.25 2.25 0 012.25 2.25v7.5a2.25 2.25 0 01-2.25 2.25h-7.5a2.25 2.25 0 01-2.25-2.25v-.75" /></svg>'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '@lang('app.download-links')',
|
||||||
|
active: false,
|
||||||
|
icon: '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5 inline align-text-top text-primary"><path stroke-linecap="round" stroke-linejoin="round" d="M11.35 3.836c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75 2.25 2.25 0 00-.1-.664m-5.8 0A2.251 2.251 0 0113.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m8.9-4.414c.376.023.75.05 1.124.08 1.131.094 1.976 1.057 1.976 2.192V16.5A2.25 2.25 0 0118 18.75h-2.25m-7.5-10.5H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V18.75m-7.5-10.5h6.375c.621 0 1.125.504 1.125 1.125v9.375m-8.25-3l1.5 1.5 3-3.75" /></svg>'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
init: function() {
|
||||||
|
this.metadata = metadata
|
||||||
|
|
||||||
|
if (this.getBundle()) {
|
||||||
|
// Steps router
|
||||||
|
if (this.metadata.completed == true) {
|
||||||
|
this.step = 3
|
||||||
|
}
|
||||||
|
else if (this.metadata.title) {
|
||||||
|
this.step = 2
|
||||||
|
this.startDropzone()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.step = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
getBundle: function() {
|
||||||
|
// Getting all bundles store in local storage
|
||||||
|
bundles = localStorage.getItem('bundles')
|
||||||
|
// If not bundle found, back to homepage
|
||||||
|
if (bundles == null || bundles == '') {
|
||||||
|
window.location.href = '/'
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
this.bundles = JSON.parse(bundles)
|
||||||
|
|
||||||
|
// Looking for the current bundle
|
||||||
|
this.bundles.forEach(element => {
|
||||||
|
if (element.bundle_id == this.metadata.bundle_id) {
|
||||||
|
this.bundle = element
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// If current bundle not found, aborting
|
||||||
|
if (this.bundle == null || this.bundle == '') {
|
||||||
|
window.location.href = '/'
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.bundle.owner_token != this.metadata.owner_token) {
|
||||||
|
window.location.href = '/'
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
|
||||||
|
uploadStep: function() {
|
||||||
|
let errors = null
|
||||||
|
document.getElementById('upload-title').setCustomValidity('')
|
||||||
|
document.getElementById('upload-description').setCustomValidity('')
|
||||||
|
document.getElementById('upload-expiry').setCustomValidity('')
|
||||||
|
document.getElementById('upload-password').setCustomValidity('')
|
||||||
|
document.getElementById('upload-max-downloads').setCustomValidity('')
|
||||||
|
|
||||||
|
if (this.metadata.title == null || this.metadata.title == '') {
|
||||||
|
document.getElementById('upload-title').setCustomValidity('Field is required')
|
||||||
|
errors = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.metadata.expiry == null || this.metadata.expiry == '') {
|
||||||
|
document.getElementById('upload-expiry').setCustomValidity('Field is required')
|
||||||
|
errors = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.metadata.max_downloads < 0 || this.metadata.max_downloads > 999) {
|
||||||
|
document.getElementById('upload-max-downloads').setCustomValidity('Invalid number of max downloads')
|
||||||
|
errors = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (errors === true) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
axios({
|
||||||
|
url: '/upload/'+this.metadata.bundle_id,
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
expiry: this.metadata.expiry,
|
||||||
|
title: this.metadata.title,
|
||||||
|
description: this.metadata.description,
|
||||||
|
max_downloads: this.metadata.max_downloads,
|
||||||
|
password: this.metadata.password,
|
||||||
|
auth: this.bundle.owner_token
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then( (response) => {
|
||||||
|
this.metadata = response.data
|
||||||
|
window.history.pushState(null, null, baseUrl+'/upload/'+this.metadata.bundle_id);
|
||||||
|
this.step = 2
|
||||||
|
|
||||||
|
this.startDropzone()
|
||||||
|
})
|
||||||
|
.catch( (error) => {
|
||||||
|
// TODO: do something here
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
completeStep: function() {
|
||||||
|
if (Object.keys(this.metadata.files).length == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.showModal('{{ __('app.confirm-complete') }}', () => {
|
||||||
|
axios({
|
||||||
|
url: '/upload/'+this.metadata.bundle_id+'/complete',
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
auth: this.bundle.owner_token
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
.then( (response) => {
|
||||||
|
this.step = 3
|
||||||
|
this.metadata = response.data
|
||||||
|
})
|
||||||
|
.catch( (error) => {
|
||||||
|
// TODO: do something here
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
back: function() {
|
||||||
|
if (this.step > 1) {
|
||||||
|
this.step --;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
startDropzone: function() {
|
||||||
|
if (! this.dropzone) {
|
||||||
|
maxFiles = maxFiles - this.countFilesOnServer() >= 0 ? maxFiles - this.countFilesOnServer() : 0
|
||||||
|
|
||||||
|
this.dropzone = new Dropzone('#upload-frm', {
|
||||||
|
url: '/upload/'+this.metadata.bundle_id+'/file',
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'X-Upload-Auth': this.bundle.owner_token
|
||||||
|
},
|
||||||
|
createImageThumbnails: false,
|
||||||
|
disablePreviews: true,
|
||||||
|
clickable: true,
|
||||||
|
paramName: 'file',
|
||||||
|
maxFiles: maxFiles,
|
||||||
|
maxFilesize: (maxFileSize / 1000000),
|
||||||
|
parallelUploads: 1, // TODO : increase this limit but must fix bug first when creating folders
|
||||||
|
dictMaxFilesExceeded: '@lang('app.files-count-limit')',
|
||||||
|
dictFileTooBig: '@lang('app.file-too-big')',
|
||||||
|
dictDefaultMessage: '@lang('app.dropzone-text')',
|
||||||
|
dictResponseError: '@lang('app.server-answered')',
|
||||||
|
// init: function() {
|
||||||
|
// this.options.maxFiles = this.options.maxFiles - currentFilesCount
|
||||||
|
// }
|
||||||
|
})
|
||||||
|
|
||||||
|
this.dropzone.on("addedfile", (file) => {
|
||||||
|
this.metadata.files.push({
|
||||||
|
uuid: file.upload.uuid,
|
||||||
|
original: file.name,
|
||||||
|
filesize: file.size,
|
||||||
|
fullpath: '',
|
||||||
|
filename: file.name,
|
||||||
|
created_at: moment().unix(),
|
||||||
|
status: 'uploading'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
this.dropzone.on("uploadprogress", (file, progress, bytes) => {
|
||||||
|
let fileIndex = null
|
||||||
|
|
||||||
|
if (fileIndex = this.findFileIndex(file.upload.uuid)) {
|
||||||
|
this.metadata.files[fileIndex].progress = Math.round(progress)
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
|
||||||
|
this.dropzone.on('error', (file, message) => {
|
||||||
|
let fileIndex = this.findFileIndex(file.upload.uuid)
|
||||||
|
this.metadata.files[fileIndex].status = false
|
||||||
|
this.metadata.files[fileIndex].message = message
|
||||||
|
}),
|
||||||
|
|
||||||
|
this.dropzone.on("complete", (file) => {
|
||||||
|
let fileIndex = this.findFileIndex(file.upload.uuid)
|
||||||
|
this.metadata.files[fileIndex].progress = 0
|
||||||
|
|
||||||
|
if (file.status == 'success') {
|
||||||
|
this.metadata.files[fileIndex].status = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
findFile: function(uuid) {
|
||||||
|
let index = this.findFileIndex(uuid)
|
||||||
|
if (index != null) {
|
||||||
|
return this.metadata.files[index]
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
},
|
||||||
|
|
||||||
|
findFileIndex: function (uuid) {
|
||||||
|
for (i in this.metadata.files) {
|
||||||
|
if (this.metadata.files[i].uuid == uuid) {
|
||||||
|
return i
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
},
|
||||||
|
|
||||||
|
deleteFile: function(file) {
|
||||||
|
// File status is valid so it must be deleted from server
|
||||||
|
if (file.status == true) {
|
||||||
|
this.showModal('{{ __('app.confirm-delete') }}', () => {
|
||||||
|
let lfile = file
|
||||||
|
|
||||||
|
axios({
|
||||||
|
url: '/upload/'+this.metadata.bundle_id+'/file',
|
||||||
|
method: 'DELETE',
|
||||||
|
data: {
|
||||||
|
file: lfile.uuid,
|
||||||
|
auth: this.bundle.owner_token
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then( (response) => {
|
||||||
|
this.metadata = response.data
|
||||||
|
})
|
||||||
|
.catch( (error) => {
|
||||||
|
// TODO: do something here
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// File not valid, no need to remove it from server, just locally
|
||||||
|
else if (file.status == false) {
|
||||||
|
let fileIndex = this.findFileIndex(file.uuid)
|
||||||
|
this.metadata.files.splice(fileIndex, 1)
|
||||||
|
}
|
||||||
|
// File has not being uploaded, cannot delete file yet
|
||||||
|
else {
|
||||||
|
// Nothing here
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
humanSize: function(val) {
|
||||||
|
if (val >= 100000000) {
|
||||||
|
return (val / 1000000000).toFixed(1) + ' Go'
|
||||||
|
}
|
||||||
|
else if (val >= 1000000) {
|
||||||
|
return (val / 1000000).toFixed(1) + ' Mo'
|
||||||
|
}
|
||||||
|
else if (val >= 1000) {
|
||||||
|
return (val / 1000).toFixed(1) + ' Ko'
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return val + ' o'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
showModal: function(text, callback) {
|
||||||
|
this.modal.text = text
|
||||||
|
this.modal.callback = callback
|
||||||
|
this.modal.show = true
|
||||||
|
},
|
||||||
|
|
||||||
|
confirmModal: function() {
|
||||||
|
this.modal.show = false
|
||||||
|
if (this.modal.callback) {
|
||||||
|
this.modal.callback()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
selectCopy: function(el) {
|
||||||
|
el.select();
|
||||||
|
|
||||||
|
if (navigator.clipboard) {
|
||||||
|
navigator.clipboard.writeText(el.value)
|
||||||
|
.then(() => {
|
||||||
|
alert("Copied to clipboard");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
countFilesOnServer: function() {
|
||||||
|
count = 0
|
||||||
|
this.metadata.files.forEach( (file) => {
|
||||||
|
if (file.status == true) {
|
||||||
|
count ++
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return count
|
||||||
|
},
|
||||||
|
|
||||||
|
isBundleExpired: function() {
|
||||||
|
if (this.metadata.expires_at == null || this.metadata.expires_at == '') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return moment.unix(this.metadata.expires_at).isBefore(moment())
|
||||||
|
},
|
||||||
|
|
||||||
|
deleteBundle: function() {
|
||||||
|
this.showModal('{{ __('app.confirm-delete-bundle') }}', () => {
|
||||||
|
axios({
|
||||||
|
url: '/upload/'+this.metadata.bundle_id+'/delete',
|
||||||
|
method: 'DELETE',
|
||||||
|
data: {
|
||||||
|
auth: this.bundle.owner_token
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then( (response) => {
|
||||||
|
if (! response.data.success) {
|
||||||
|
this.metadata = response.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div x-data="upload">
|
||||||
|
<div class="relative bg-white border border-primary rounded-lg overflow-hidden">
|
||||||
|
<div class="bg-gradient-to-r from-primary-light to-primary px-2 py-4 mb-3 text-center">
|
||||||
|
<h1 class="relative font-title font-medium font-body text-4xl text-center text-white uppercase flex items-center">
|
||||||
|
<div class="w-1/12 text-center">
|
||||||
|
{{-- If bundle is locked --}}
|
||||||
|
<p title="{{ __('app.bundle-locked') }}" x-show="metadata.completed">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="inline w-8 h-8 text-purple-200">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M16.5 10.5V6.75a4.5 4.5 0 10-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 002.25-2.25v-6.75a2.25 2.25 0 00-2.25-2.25H6.75a2.25 2.25 0 00-2.25 2.25v6.75a2.25 2.25 0 002.25 2.25z" />
|
||||||
|
</svg>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- App's title --}}
|
||||||
|
<div class="grow text-center">{{ config('app.name') }}</div>
|
||||||
|
|
||||||
|
|
||||||
|
{{-- Bundle status --}}
|
||||||
|
<div class="w-1/12 gap-2 item-right">
|
||||||
|
{{-- If bundle is expired --}}
|
||||||
|
<p title="{{ __('app.bundle-expired') }}" x-show="isBundleExpired()">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="inline w-8 h-8 text-purple-200">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||||
|
</svg>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Modal box --}}
|
||||||
|
<template x-if="modal.show">
|
||||||
|
<div class="absolute z-40 top-0 left-0 right-0 bottom-0 w-full bg-[#848A97EE]">
|
||||||
|
<div class="absolute z-50 top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%] rounded-lg bg-white w-1/2 p-6 text-center shadow-lg border-2 border-gray-300">
|
||||||
|
<div class="w-full text-center">
|
||||||
|
<p class="relative mx-auto bg-orange-200 rounded-full w-14 h-14">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="absolute top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%] w-8 h-8 inline text-orange-600">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z" />
|
||||||
|
</svg>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<p class="mt-4 font-title font-medium text-primary text-lg">{{ __('app.confirmation') }}</p>
|
||||||
|
<div class="mb-6 text-gray-500" x-text="modal.text"></div>
|
||||||
|
<div class="flex">
|
||||||
|
<div class="w-1/2 text-right px-1">
|
||||||
|
<button class="bg-gray-300 text-black rounded px-3 py-1" x-on:click="modal.show = false">{{ __('app.cancel') }}</button>
|
||||||
|
</div>
|
||||||
|
<div class="w-1/2 text-left px-1"><button class="bg-primary text-white rounded px-3 py-1" x-on:click="confirmModal()">{{ __('app.confirm') }}</button></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<div class="p-5">
|
||||||
|
{{-- Steps --}}
|
||||||
|
<div class="rounded-t-md grid grid-cols-3 gap-2 leading-3 mb-10">
|
||||||
|
<template x-for="(s, i) in steps">
|
||||||
|
<div class="p-2">
|
||||||
|
<div class="rounded mb-4 w-full h-1" :class="(i + 1) <= step ? 'bg-primary' : 'bg-gray-200'"></div>
|
||||||
|
|
||||||
|
<div class="flex items-center">
|
||||||
|
<div x-html="s.icon"></div>
|
||||||
|
<div>
|
||||||
|
<p class="leading-[.9rem] font-title px-1 uppercase text-sm text-primary" x-text="'{{ __('app.step') }} '+ (i + 1)"></p>
|
||||||
|
<h2 class="leading-[.9rem] px-1 text-xs font-medium" x-text="s.title"></h2>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-10">
|
||||||
|
|
||||||
|
{{-- STEP 1 --}}
|
||||||
|
<div x-cloak x-show="step == 1">
|
||||||
|
<h2 class="font-title text-2xl mb-5 text-primary font-medium uppercase">
|
||||||
|
@lang('app.upload-settings')
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
{{-- Title --}}
|
||||||
|
<div class="">
|
||||||
|
<p class="font-title uppercase">
|
||||||
|
@lang('app.upload-title')
|
||||||
|
<span class="text-base">*</span>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<input
|
||||||
|
x-model="metadata.title"
|
||||||
|
class="w-full p-0 bg-transparent text-slate-700 h-8 py-1 rounded-none border-b border-purple-300 outline-none invalid:border-b-red-500 invalid:bg-red-50"
|
||||||
|
type="text"
|
||||||
|
name="title"
|
||||||
|
id="upload-title"
|
||||||
|
maxlength="70"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Description --}}
|
||||||
|
<div class="mt-5">
|
||||||
|
<span class="font-title uppercase">@lang('app.upload-description')</span>
|
||||||
|
|
||||||
|
<textarea
|
||||||
|
x-model="metadata.description"
|
||||||
|
maxlength="300"
|
||||||
|
class="w-full p-0 bg-transparent text-slate-700 h-18 py-1 rounded-none border-b border-purple-300 outline-none invalid:border-b-red-500 invalid:bg-red-50"
|
||||||
|
type="text"
|
||||||
|
name="description"
|
||||||
|
id="upload-description"
|
||||||
|
/></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Expiration --}}
|
||||||
|
<div class="flex flex-wrap items-center mt-5">
|
||||||
|
<div class="w-1/3 px-2">
|
||||||
|
<p class="font-title uppercase">
|
||||||
|
@lang('app.upload-expiry')
|
||||||
|
<span class="text-base">*</span>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<select
|
||||||
|
x-model="metadata.expiry""
|
||||||
|
class="w-full text-slate-700 bg-transparent h-8 p-0 py-1 border-b border-primary-superlight focus:ring-0 invalid:border-b-red-500 invalid:bg-red-50"
|
||||||
|
name="expiry"
|
||||||
|
id="upload-expiry"
|
||||||
|
>
|
||||||
|
<option value="0"></option>
|
||||||
|
@foreach (config('sharing.expiry_values') as $k => $e)
|
||||||
|
<option value="{{ Upload::getExpirySeconds($k) }}" {{ $e == config('sharing.default_expiry') ? 'selected' : '' }}>@lang('app.'.$e)</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Max downloads --}}
|
||||||
|
<div class="w-1/3 px-2">
|
||||||
|
<p class="font-title uppercase">
|
||||||
|
@lang('app.max-downloads')
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<input
|
||||||
|
x-model="metadata.max_downloads"
|
||||||
|
class="w-full p-0 bg-transparent text-slate-700 h-8 py-1 rounded-none border-b border-purple-300 outline-none invalid:border-b-red-500 invalid:bg-red-50"
|
||||||
|
type="number"
|
||||||
|
name="max_downloads"
|
||||||
|
id="upload-max-downloads"
|
||||||
|
min="0"
|
||||||
|
max="999"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Password --}}
|
||||||
|
<div class="w-1/3 px-2">
|
||||||
|
<span class="font-title uppercase">@lang('app.bundle-password')</span>
|
||||||
|
|
||||||
|
<input
|
||||||
|
x-model="metadata.password"
|
||||||
|
class="w-full bg-transparent text-slate-700 h-8 p-0 py-1 rounded-none border-b border-primary-superlight outline-none invalid:border-b-red-500 invalid:bg-red-50"
|
||||||
|
placeholder="@lang('app.leave-empty')"
|
||||||
|
type="text"
|
||||||
|
name="password"
|
||||||
|
id="upload-password"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Buttons --}}
|
||||||
|
<div class="grid grid-cols-2 gap-10 mt-10 text-center">
|
||||||
|
<div> </div>
|
||||||
|
<div>
|
||||||
|
@include('partials.button', [
|
||||||
|
'way' => 'right',
|
||||||
|
'text' => __('app.start-uploading'),
|
||||||
|
'icon' => '<path stroke-linecap="round" stroke-linejoin="round" d="M8.25 4.5l7.5 7.5-7.5 7.5" />',
|
||||||
|
'action' => 'uploadStep'
|
||||||
|
])
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- STEP 2 --}}
|
||||||
|
<div x-cloak class="" x-show="step == 2">
|
||||||
|
<h2 class="font-title text-2xl mb-5 text-primary font-medium uppercase">
|
||||||
|
@lang('app.upload-files-title')
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<div class="grid grid-cols-4 gap-2">
|
||||||
|
{{-- Dropzone --}}
|
||||||
|
<div>
|
||||||
|
<form class="relative dropzone border-primary border" id="upload-frm" enctype="multipart/form-data">
|
||||||
|
<div class="absolute right-2 bottom-1 text-[.6rem] text-slate-800 italic">
|
||||||
|
@lang('app.maximum-filesize')
|
||||||
|
{{ Upload::fileMaxSize(true) }}
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-span-3 ml-2">
|
||||||
|
<h3 class="font-title flex items-center text-base mb-2 text-primary font-medium uppercase">
|
||||||
|
<p>@lang('app.files-list')</p>
|
||||||
|
<div class="ml-3 flex text-xs bg-primary rounded-full px-1 text-center text-white divide-x">
|
||||||
|
<p
|
||||||
|
class="px-2 text-center"
|
||||||
|
x-text="countFilesOnServer()"
|
||||||
|
:title="'{{ __('app.files-count-on-server') }}'"
|
||||||
|
></p>
|
||||||
|
<p
|
||||||
|
class="px-2 text-center"
|
||||||
|
x-text="maxFiles"
|
||||||
|
:title="'{{ __('app.files-remaining-files') }}'"
|
||||||
|
></p>
|
||||||
|
</div>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<span class="text-xs text-slate-400" x-show="countFilesOnServer() == 0">@lang('app.no-file')</span>
|
||||||
|
|
||||||
|
{{-- Files list --}}
|
||||||
|
<ul id="output" class="text-xs max-h-32 overflow-y-scroll pb-3" x-show="countFilesOnServer() > 0">
|
||||||
|
<template x-for="(f, k) in metadata.files" :key="k">
|
||||||
|
<li
|
||||||
|
title="{{ __('app.click-to-remove') }}"
|
||||||
|
class="relative flex items-center leading-5 list-inside even:bg-gray-50 rounded px-2 cursor-pointer overflow-hidden"
|
||||||
|
x-on:click="deleteFile(f)"
|
||||||
|
>
|
||||||
|
{{-- Progress bar --}}
|
||||||
|
<p class="absolute top-0 left-0 bottom-0 bg-[#9333EA66] w-0" :style="'width: '+f.progress+'%;'"> </p>
|
||||||
|
|
||||||
|
{{-- Status icon --}}
|
||||||
|
<p class="w-[5%]">
|
||||||
|
<template x-if="f.status == true">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="inline w-4 h-4 text-green-600">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||||
|
</svg>
|
||||||
|
</template>
|
||||||
|
<template x-if="f.status == false">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="inline w-4 h-4 text-red-600">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z" />
|
||||||
|
</svg>
|
||||||
|
</template>
|
||||||
|
<template x-if="f.status == 'uploading'">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="inline w-4 h-4 text-orange-600">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||||
|
</svg>
|
||||||
|
</template>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{{-- File name --}}
|
||||||
|
<p class="w-[80%] overflow-hidden whitespace-nowrap relative">
|
||||||
|
<span x-text="f.original"></span>
|
||||||
|
<template x-if="f.message">
|
||||||
|
<span class="w-full px-1 rounded bg-red-100 absolute opacity-0 hover:opacity-95 transition-all duration-300 top-0 left-0" x-html="f.message"></span>
|
||||||
|
</template>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{{-- File size --}}
|
||||||
|
<p class="w-[15%] text-right" float-right text-xs" x-text="humanSize(f.filesize)"></p>
|
||||||
|
</li>
|
||||||
|
</template>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Buttons --}}
|
||||||
|
<div class="grid grid-cols-2 gap-10 mt-10 text-center">
|
||||||
|
<div>
|
||||||
|
@include('partials.button', [
|
||||||
|
'way' => 'left',
|
||||||
|
'text' => __('app.back'),
|
||||||
|
'icon' => '<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 19.5L8.25 12l7.5-7.5" />',
|
||||||
|
'action' => 'back'
|
||||||
|
])
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
@include('partials.button', [
|
||||||
|
'way' => 'right',
|
||||||
|
'text' => __('app.complete-upload'),
|
||||||
|
'icon' => '<path stroke-linecap="round" stroke-linejoin="round" d="M8.25 4.5l7.5 7.5-7.5 7.5" />',
|
||||||
|
'action' => 'completeStep'
|
||||||
|
])
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- STEP 3 --}}
|
||||||
|
<template x-if="step == 3">
|
||||||
|
<div class="" x-show="step == 3">
|
||||||
|
<h2 class="font-title text-2xl mb-5 text-primary font-medium uppercase">
|
||||||
|
@lang('app.download-links')
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
{{-- Preview link --}}
|
||||||
|
<div class="flex flex-wrap items-center">
|
||||||
|
<div class="w-1/3 text-right px-2">
|
||||||
|
@lang('app.preview-link')
|
||||||
|
</div>
|
||||||
|
<div class="w-2/3 shadow">
|
||||||
|
<input x-model="metadata.preview_link" class="w-full bg-transparent text-slate-700 h-8 px-2 py-1 rounded-none border border-primary-superlight outline-none" type="text" readonly x-on:click="selectCopy($el)" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Direct download link --}}
|
||||||
|
<div class="flex flex-wrap items-center mt-5">
|
||||||
|
<div class="w-1/3 text-right px-2">
|
||||||
|
@lang('app.direct-link')
|
||||||
|
</div>
|
||||||
|
<div class="w-2/3 shadow">
|
||||||
|
<input x-model="metadata.download_link" class="w-full bg-transparent text-slate-700 h-8 px-2 py-1 rounded-none border border-primary-superlight outline-none" type="text" readonly x-on:click="selectCopy($el)" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Delete link --}}
|
||||||
|
<div class="flex flex-wrap items-center mt-5">
|
||||||
|
<div class="w-1/3 text-right px-2">
|
||||||
|
@lang('app.delete-link')
|
||||||
|
</div>
|
||||||
|
<div class="w-2/3 shadow">
|
||||||
|
<input x-model="metadata.deletion_link" class="w-full bg-transparent text-slate-700 h-8 px-2 py-1 rounded-none border border-primary-superlight outline-none" type="text" readonly x-on:click="selectCopy($el)" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Buttons --}}
|
||||||
|
<div class="grid grid-cols-2 gap-10 mt-10 text-center">
|
||||||
|
<div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<template x-if="! isBundleExpired()">
|
||||||
|
@include('partials.button', [
|
||||||
|
'way' => 'right',
|
||||||
|
'text' => __('app.delete-bundle'),
|
||||||
|
'icon' => '<path stroke-linecap="round" stroke-linejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" />',
|
||||||
|
'action' => 'deleteBundle'
|
||||||
|
])
|
||||||
|
</template>
|
||||||
|
<template x-if="isBundleExpired()">
|
||||||
|
<p class="text-xs">
|
||||||
|
@lang('app.bundle-expired')
|
||||||
|
</p>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
15
routes/api.php
Normal file
15
routes/api.php
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| API Routes
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here is where you can register API routes for your application. These
|
||||||
|
| routes are loaded by the RouteServiceProvider and all of them will
|
||||||
|
| be assigned to the "api" middleware group. Make something great!
|
||||||
|
|
|
||||||
|
*/
|
18
routes/channels.php
Normal file
18
routes/channels.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Broadcast;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Broadcast Channels
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may register all of the event broadcasting channels that your
|
||||||
|
| application supports. The given channel authorization callbacks are
|
||||||
|
| used to check if an authenticated user can listen to the channel.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
Broadcast::channel('App.Models.User.{id}', function ($user, $id) {
|
||||||
|
return (int) $user->id === (int) $id;
|
||||||
|
});
|
19
routes/console.php
Normal file
19
routes/console.php
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Inspiring;
|
||||||
|
use Illuminate\Support\Facades\Artisan;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Console Routes
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This file is where you may define all of your Closure based console
|
||||||
|
| commands. Each Closure is bound to a command instance allowing a
|
||||||
|
| simple approach to interacting with each command's IO methods.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
Artisan::command('inspire', function () {
|
||||||
|
$this->comment(Inspiring::quote());
|
||||||
|
})->purpose('Display an inspiring quote');
|
46
routes/web.php
Normal file
46
routes/web.php
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
|
use App\Http\Controllers\WebController;
|
||||||
|
use App\Http\Controllers\UploadController;
|
||||||
|
use App\Http\Controllers\BundleController;
|
||||||
|
use App\Http\Middleware\UploadAccess;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Web Routes
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here is where you can register web routes for your application. These
|
||||||
|
| routes are loaded by the RouteServiceProvider and all of them will
|
||||||
|
| be assigned to the "web" middleware group. Make something great!
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
Route::middleware(['upload'])->group(function() {
|
||||||
|
Route::get('/', [WebController::class, 'homepage'])->name('homepage');
|
||||||
|
Route::post('/new', [WebController::class, 'newBundle'])->name('bundle.new');
|
||||||
|
|
||||||
|
|
||||||
|
Route::prefix('/upload/{bundle}')->controller(UploadController::class)->name('upload.')->group(function() {
|
||||||
|
Route::get('/', 'createBundle')->name('create.show');
|
||||||
|
|
||||||
|
Route::middleware(['access.owner'])->group(function() {
|
||||||
|
Route::post('/', 'storeBundle')->name('create.store');
|
||||||
|
Route::get('/metadata', 'getMetadata')->name('metadata.get');
|
||||||
|
Route::post('/file', 'uploadFile')->name('file.store');
|
||||||
|
Route::delete('/file', 'deleteFile')->name('file.delete');
|
||||||
|
Route::post('/complete', 'completeBundle')->name('complete');
|
||||||
|
Route::delete('/delete', 'deleteBundle')->name('bundle.delete');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Route::middleware(['access.guest'])->prefix('/bundle/{bundle}')->controller(BundleController::class)->name('bundle.')->group(function() {
|
||||||
|
Route::get('/preview', 'previewBundle')->name('preview');
|
||||||
|
Route::post('/zip', 'prepareZip')->name('zip.make');
|
||||||
|
Route::get('/download', 'downloadZip')->name('zip.download');
|
||||||
|
});
|
3
storage/app/.gitignore
vendored
Normal file
3
storage/app/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
*
|
||||||
|
!public/
|
||||||
|
!.gitignore
|
2
storage/app/public/.gitignore
vendored
Normal file
2
storage/app/public/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
*
|
||||||
|
!.gitignore
|
9
storage/framework/.gitignore
vendored
Normal file
9
storage/framework/.gitignore
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
compiled.php
|
||||||
|
config.php
|
||||||
|
down
|
||||||
|
events.scanned.php
|
||||||
|
maintenance.php
|
||||||
|
routes.php
|
||||||
|
routes.scanned.php
|
||||||
|
schedule-*
|
||||||
|
services.json
|
3
storage/framework/cache/.gitignore
vendored
Normal file
3
storage/framework/cache/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
*
|
||||||
|
!data/
|
||||||
|
!.gitignore
|
2
storage/framework/cache/data/.gitignore
vendored
Normal file
2
storage/framework/cache/data/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
*
|
||||||
|
!.gitignore
|
2
storage/framework/sessions/.gitignore
vendored
Normal file
2
storage/framework/sessions/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
*
|
||||||
|
!.gitignore
|
2
storage/framework/testing/.gitignore
vendored
Normal file
2
storage/framework/testing/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
*
|
||||||
|
!.gitignore
|
2
storage/framework/views/.gitignore
vendored
Normal file
2
storage/framework/views/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
*
|
||||||
|
!.gitignore
|
2
storage/logs/.gitignore
vendored
Normal file
2
storage/logs/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
*
|
||||||
|
!.gitignore
|
22
tailwind.config.js
Normal file
22
tailwind.config.js
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
/** @type {import('tailwindcss').Config} */
|
||||||
|
module.exports = {
|
||||||
|
content: [
|
||||||
|
"./resources/**/*.blade.php",
|
||||||
|
"./resources/**/*.js",
|
||||||
|
"./resources/**/*.vue",
|
||||||
|
],
|
||||||
|
theme: {
|
||||||
|
fontFamily: {
|
||||||
|
'display': ['Comfortaa'],
|
||||||
|
'title': ['Rajdhani']
|
||||||
|
},
|
||||||
|
extend: {
|
||||||
|
colors: {
|
||||||
|
'primary': 'rgb(126 34 206)',
|
||||||
|
'primary-light': 'rgb(147 51 234)',
|
||||||
|
'primary-superlight': 'rgb(216 180 254)'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
plugins: [],
|
||||||
|
}
|
21
tests/CreatesApplication.php
Normal file
21
tests/CreatesApplication.php
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Console\Kernel;
|
||||||
|
use Illuminate\Foundation\Application;
|
||||||
|
|
||||||
|
trait CreatesApplication
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Creates the application.
|
||||||
|
*/
|
||||||
|
public function createApplication(): Application
|
||||||
|
{
|
||||||
|
$app = require __DIR__.'/../bootstrap/app.php';
|
||||||
|
|
||||||
|
$app->make(Kernel::class)->bootstrap();
|
||||||
|
|
||||||
|
return $app;
|
||||||
|
}
|
||||||
|
}
|
19
tests/Feature/ExampleTest.php
Normal file
19
tests/Feature/ExampleTest.php
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
// use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class ExampleTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic test example.
|
||||||
|
*/
|
||||||
|
public function test_the_application_returns_a_successful_response(): void
|
||||||
|
{
|
||||||
|
$response = $this->get('/');
|
||||||
|
|
||||||
|
$response->assertStatus(200);
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue