feat(market): embed offer photos inline instead of a media server

Replace the Blossom media-server approach with a fully decentralized one:
generate a small (~320px) JPEG thumbnail from the lot's cover photo and
embed it in the offer event as a data: URI, so photos ride the relays with
no server and no IP leak. The full photo stays in the encrypted inventory.

- offer_thumbnail.dart: downscale-until-it-fits data-URI builder + decoder
- market_widgets: render data: URIs from memory, http(s) URLs from network
- offers_cubit: publish a thumbnail (best-effort) in place of an upload
- drop MediaTransport/Blossom from commons_core (http/crypto deps) and the
  media-server setting; parked on branch parked/offer-photos-blossom

Relay event-size limits cap the image to a thumbnail; higher-res sharing
would need the parked Blossom path.
This commit is contained in:
vjrj 2026-07-10 21:27:59 +02:00
parent 5017ea51e0
commit 2b419e6516
24 changed files with 230 additions and 411 deletions

View file

@ -4,7 +4,24 @@ import 'package:tane/ui/market_widgets.dart';
Widget _wrap(Widget child) => MaterialApp(home: Scaffold(body: Center(child: child)));
/// A 1×1 PNG as an inline data URI the shape offers actually publish.
const _dataUri =
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lE'
'QVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==';
void main() {
testWidgets('OfferThumbnail renders an inline data-URI from memory',
(tester) async {
await tester.pumpWidget(
_wrap(const OfferThumbnail(url: _dataUri, semanticLabel: 'Photo')),
);
await tester.pump();
expect(find.byType(Image), findsOneWidget);
// Decoded fine no broken-image placeholder.
expect(find.byIcon(Icons.image_not_supported_outlined), findsNothing);
});
testWidgets('OfferThumbnail builds a network image', (tester) async {
await tester.pumpWidget(
_wrap(const OfferThumbnail(