Offer a new share as a QR code and through the share sheet

The share created page gets "Show QR code", a dialog with the link as a
QR code (black on white, full screen on a phone) that downloads as a PNG
drawn in the browser, with a password reminder for protected shares; and
"Share…", which opens the device's share sheet where there is one. Both
carry only the link.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V9NnLxnPp8vaaurb3Z1MFy
This commit is contained in:
Andreas Reinhold / reini
2026-09-13 11:46:07 +02:00
co-authored by Claude Opus 5
parent fbe358b2e5
commit 1352533667
11 changed files with 416 additions and 10 deletions
+21
View File
@@ -0,0 +1,21 @@
<?php
use App\Services\QrCodeService;
test('it draws a 1024 pixel QR code as inline SVG, black on white', function () {
$svg = (new QrCodeService)->svg('https://share.example.com/s/aBcDeFgHiJkLmNoP');
expect($svg)->toStartWith('<svg ')
->not->toContain('<?xml')
->toContain('width="1024" height="1024"')
->toContain('fill="#ffffff"')
->toContain('fill="#000000"');
});
test('the same contents give the same code, other contents another', function () {
$service = new QrCodeService;
expect($service->svg('https://share.example.com/s/aBcDeFgHiJkLmNoP'))
->toBe($service->svg('https://share.example.com/s/aBcDeFgHiJkLmNoP'))
->not->toBe($service->svg('https://share.example.com/s/zYxWvUtSrQpOnMlK'));
});