Add SealShare file sharing application with encryption, branding, auth, Docker, and Octane support
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
4790be8142
commit
e37b322dde
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Share;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends Factory<Share>
|
||||
*/
|
||||
class ShareFactory extends Factory
|
||||
{
|
||||
protected $model = Share::class;
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'token' => Str::random(16),
|
||||
'password' => null,
|
||||
'encryption_key' => null,
|
||||
'encryption_salt' => bin2hex(random_bytes(32)),
|
||||
'expires_at' => null,
|
||||
'max_downloads' => null,
|
||||
'download_count' => 0,
|
||||
'total_size' => 0,
|
||||
];
|
||||
}
|
||||
|
||||
public function withPassword(string $password = 'secret'): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'password' => bcrypt($password),
|
||||
]);
|
||||
}
|
||||
|
||||
public function expired(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'expires_at' => now()->subHour(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function withMaxDownloads(int $max = 5): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'max_downloads' => $max,
|
||||
]);
|
||||
}
|
||||
|
||||
public function expiresInHours(int $hours = 24): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'expires_at' => now()->addHours($hours),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Share;
|
||||
use App\Models\ShareFile;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<ShareFile>
|
||||
*/
|
||||
class ShareFileFactory extends Factory
|
||||
{
|
||||
protected $model = ShareFile::class;
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'share_id' => Share::factory(),
|
||||
'original_name' => fake()->word().'.txt',
|
||||
'relative_path' => null,
|
||||
'stored_path' => 'shares/'.fake()->uuid().'.enc',
|
||||
'file_size' => fake()->numberBetween(1024, 10485760),
|
||||
'mime_type' => 'text/plain',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,16 @@ class UserFactory extends Factory
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the user is an admin.
|
||||
*/
|
||||
public function admin(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'is_admin' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model has two-factor authentication configured.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user