A share can now hold a private text (a password, a key, a short note) with its files or on its own. The upload page's new "Private text" card takes up to 100 KB; the browser encrypts the text and sends it through the same chunk pipeline as a file, flagged is_text on share_files, so it gets the share's password, expiry, download limit and cleanup. The recipient sees the text only after pressing "Show text", which counts as their download, so a messenger link preview cannot use up a share limited to one download. The text is left out of the file list, the ZIP and the file counts; the admin dashboard marks shares that hold one with "Text". The website gains a Private text feature card and a fifth phone screenshot; every screenshot is retaken. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
59 lines
1.4 KiB
PHP
59 lines
1.4 KiB
PHP
<?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',
|
|
'is_text' => false,
|
|
'uploaded_chunks' => 1,
|
|
'completed_at' => now(),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* A file whose chunks have not all arrived yet.
|
|
*/
|
|
public function uploading(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'mime_type' => null,
|
|
'uploaded_chunks' => 0,
|
|
'completed_at' => null,
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* A share's private text.
|
|
*/
|
|
public function text(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'original_name' => 'text.txt',
|
|
'relative_path' => null,
|
|
'file_size' => fake()->numberBetween(1, 1024),
|
|
'is_text' => true,
|
|
]);
|
|
}
|
|
}
|