Release 2.3.0
linter / quality (push) Successful in 1m5s
tests / ci (8.5) (push) Successful in 3m24s
docker / build-and-push (push) Successful in 7m10s
docker / test (8.5) (push) Successful in 3m21s
docker / release (push) Successful in 4s

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>
This commit is contained in:
Andreas Reinhold / reini
2026-09-26 07:00:17 +02:00
co-authored by Claude Opus 5.5
parent 202813a1e6
commit f9a7839ad3
73 changed files with 806 additions and 134 deletions
+65 -1
View File
@@ -135,6 +135,70 @@ test('removing files takes them out of the pending share', function () {
expect(Share::query()->sole()->total_size)->toBe(4);
});
test('registering the private text hands the browser its chunk target, like a file', function () {
Storage::fake('shares');
$component = Livewire::test(FileUploader::class);
$component->call('registerText', 20)
->assertReturned(fn (?array $target): bool => $target !== null);
$file = ShareFile::query()->sole();
expect($file->is_text)->toBeTrue();
expect($file->file_size)->toBe(20);
expect(session('pending_shares'))->toBe([$file->share->token]);
});
test('registering the private text again replaces the earlier text row', function () {
Storage::fake('shares');
$component = Livewire::test(FileUploader::class)
->call('registerText', 20);
$firstId = ShareFile::query()->sole()->id;
$component->call('registerText', 30);
$file = ShareFile::query()->sole();
expect($file->id)->not->toBe($firstId);
expect($file->file_size)->toBe(30);
});
test('registering the private text with 0 bytes removes it', function () {
Storage::fake('shares');
$component = Livewire::test(FileUploader::class)
->call('registerText', 20);
$component->call('registerText', 0)
->assertReturned(fn (?array $target): bool => $target === null);
expect(ShareFile::query()->count())->toBe(0);
});
test('a text-only pending share completes', function () {
Storage::fake('shares');
$component = Livewire::test(FileUploader::class)
->call('registerText', 20);
$file = ShareFile::query()->sole();
app(ShareService::class)->storeChunk($file, 0, encryptedChunk($file, str_repeat('a', 20), 0, true));
$component->call('createShare')
->assertRedirectContains('/share/');
$share = Share::query()->sole();
expect($share->isCompleted())->toBeTrue();
expect($share->files->first()->is_text)->toBeTrue();
});
test('the selected files list does not show the private text', function () {
Storage::fake('shares');
$component = Livewire::test(FileUploader::class);
uploadThroughPage($component, ['document.pdf' => 'the document']);
$component->call('registerText', 20);
$component->assertSeeHtml('data-test="selected-file"')
->assertSee('document.pdf')
->assertDontSee('text.txt');
});
test('a share cannot be created while a file is still uploading', function () {
Storage::fake('shares');
$component = Livewire::test(FileUploader::class)
@@ -297,7 +361,7 @@ test('file upload requires at least one file', function () {
$component = Livewire::test(FileUploader::class)
->call('createShare');
expect($component->errors()->first('files'))->toBe('Please select at least one file to upload.');
expect($component->errors()->first('files'))->toBe('Add files or a text to share.');
expect(Share::query()->count())->toBe(0);
});