Release 2.3.0
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:
co-authored by
Claude Opus 5.5
parent
202813a1e6
commit
f9a7839ad3
@@ -7,6 +7,7 @@ use App\Services\ShareService;
|
||||
use Carbon\CarbonInterval;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Livewire\Attributes\Layout;
|
||||
use Livewire\Attributes\Renderless;
|
||||
use Livewire\Attributes\Validate;
|
||||
use Livewire\Component;
|
||||
|
||||
@@ -60,11 +61,34 @@ class ShareDownload extends Component
|
||||
$this->authenticated = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The share's private text, for the recipient who pressed "Show text": counted as their
|
||||
* download, as a file would be. Returned to the browser only, never kept in a property, so it
|
||||
* is not in the component's snapshot. Null when the text is no longer available; no abort(),
|
||||
* which would open Livewire's error modal. Renderless: a re-render would morph the download
|
||||
* note Alpine just switched back into the one it hid.
|
||||
*/
|
||||
#[Renderless]
|
||||
public function revealText(ShareService $shareService): ?string
|
||||
{
|
||||
$share = $this->share;
|
||||
|
||||
if (! $share->isCompleted() || $share->isExpired() || ! $share->hasText()
|
||||
|| ($share->isPasswordProtected() && ! session('share_key_'.$share->token))
|
||||
|| ! $shareService->claimDownload($share, session()->driver())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $shareService->readText($share, $shareService->sessionDecryptionKey($share, session()->driver()));
|
||||
}
|
||||
|
||||
public function render(): mixed
|
||||
{
|
||||
$shareService = app(ShareService::class);
|
||||
|
||||
return view('livewire.share-download', [
|
||||
'files' => $this->share->files->where('is_text', false)->values(),
|
||||
'hasText' => $this->share->files->contains('is_text', true),
|
||||
'downloadWindowEndsAt' => $shareService->downloadWindowEndsAt($this->share, session()->driver()),
|
||||
'remainingDownloads' => $this->share->max_downloads ? max($this->share->max_downloads - $this->share->download_count, 0) : null,
|
||||
'downloadWindow' => CarbonInterval::minutes(ShareService::DOWNLOAD_WINDOW_MINUTES)->cascade()->forHumans(),
|
||||
|
||||
Reference in New Issue
Block a user