diff --git a/documentation/README.md b/documentation/README.md index 9053cf05..d0cf670f 100644 --- a/documentation/README.md +++ b/documentation/README.md @@ -54,7 +54,7 @@ MeshCore Open connects to MeshCore LoRa mesh radios over BLE, USB, or TCP. Once | Mesh image encoding/reconstruction | Local after model installation | | On-device translation | Local after model installation | | Model downloads | Internet required | -| GIF search/display and URL image previews | Internet required to retrieve content | +| GIF search/display, URL image previews, and IPFS image/file uploads | Internet required to upload or retrieve content | | Map display | Cached tiles work offline; uncached tiles need internet | | Online network map and opt-in uploads | Internet required | | Terrain LOS analysis | Elevation lookup needs internet unless the required data is already cached | diff --git a/documentation/additional-features.md b/documentation/additional-features.md index 9a110020..dd32e470 100644 --- a/documentation/additional-features.md +++ b/documentation/additional-features.md @@ -268,6 +268,14 @@ Enable URL images per contact in Chat → overflow → Contact Settings, or per The message sends a reference; image retrieval needs internet access and makes requests to the relevant host or gateway. This differs from [image packets transmitted over the mesh](image-messages.md). With previews disabled, the chat may indicate that a message contains a possible image URL. +## Share an Image via IPFS + +1. Configure **App Settings → IPFS provider configuration**. Choose Pinata, Filebase, or **Custom (Kubo)** for self hosted or other, then set the upload endpoint, upload gateway, and any required API key. See [IPFS provider configuration](settings.md#ipfs-provider-configuration). +2. In a direct or channel chat, open the composer’s **+** menu and choose **Send image or file via IPFS**. +3. Pick an image or file. The app uploads it to the configured provider and inserts the resulting link into the draft. When an upload gateway is configured, the link is `http://gateway/ipfs/CID`; otherwise it is `ipfs://CID`. Review or edit the draft, then send it as a normal text message; uploading does not send the chat message automatically. + +Uploads and image previews need internet access. The file is stored with the selected provider; the mesh carries only the text link, not the file bytes. IPFS content is publicly addressable, so only upload content suitable for sharing publicly. A recipient needs internet access and a working IPFS gateway to retrieve it. If the upload link plus existing draft exceeds the message limit, the app may shorten the existing draft to make room for the link. + ## Regions, Mesh Images, and Radio Statistics See [Regions](regions.md) for default scopes, per-message labels, and reply-region inheritance; [Image Messages](image-messages.md) for model installation and reconstruction; and [Companion Radio Statistics](radio-statistics.md) for connected-radio measurements. diff --git a/documentation/chat-and-messaging.md b/documentation/chat-and-messaging.md index 6cc3af0c..0df9ad46 100644 --- a/documentation/chat-and-messaging.md +++ b/documentation/chat-and-messaging.md @@ -126,4 +126,4 @@ Add emoji reactions to incoming messages (not your own): ## Image and translation setup -Enable URL images in the contact’s chat settings to preview supported image links; see [URL images](additional-features.md#url-image-previews). Mesh image packets are currently sent through channel chat, not this direct-message composer. Set up translation and download a model in [App Settings](settings.md#translation) before using incoming or pre-send translation. +Enable URL images in the contact’s chat settings to preview supported image links; see [URL images](additional-features.md#url-image-previews). Images and files can also be uploaded to a configured IPFS provider from the **+** menu in direct or channel chat; the resulting URL is sent as ordinary text. See [sharing via IPFS](additional-features.md#share-an-image-via-ipfs) and [IPFS provider configuration](settings.md#ipfs-provider-configuration). Mesh image packets are currently sent through channel chat, not the direct-message composer. Set up translation and download a model in [App Settings](settings.md#translation) before using incoming or pre-send translation. diff --git a/documentation/settings.md b/documentation/settings.md index 04fbe3ef..5ead1994 100644 --- a/documentation/settings.md +++ b/documentation/settings.md @@ -158,6 +158,20 @@ Not shown on web. Controls on-device message translation powered by a locally-do The auto-translate and composer toggles are disabled until **Enable translation** is on. +### IPFS Provider Configuration + +Open **App Settings → IPFS provider configuration** to configure IPFS uploads and previews: + +- **Public IPFS gateway**: Select Pinata, Filebase, a custom gateway, or deactivate it. This gateway lets the app load bare IPFS content IDs in image links. +- **Upload provider**: Select Pinata, Filebase, a custom provider, or deactivate uploads. Presets fill in the provider’s upload endpoint and upload gateway; custom setups can edit both. +- **API key**: Enter the credential required by the selected provider. The value is masked in the settings dialog. Pinata and Filebase presets require provider credentials. + +For a self-hosted Kubo node, choose **Custom (Kubo)** and configure its RPC upload endpoint and HTTP gateway. The preset defaults use `http://127.0.0.1:5001/api/v0/add` and `http://127.0.0.1:8080/ipfs/`; replace these with addresses reachable from the device running MeshCore Open. Do not expose Kubo’s unauthenticated RPC API to the public internet. + +When an **upload gateway** is configured, uploaded content is added to the draft as an HTTP(S) gateway URL in the form `http://gateway/ipfs/CID`. If it is blank, the app uses `ipfs://CID`. The public gateway setting is separate and is used to retrieve bare IPFS content IDs in incoming links. + +Save the settings before sharing. The upload action is shown in the chat composer only when an upload endpoint is configured. Provider accounts, credentials, limits, and terms are managed by the provider, not MeshCore Open. See [sharing images via IPFS](additional-features.md#share-an-image-via-ipfs) for the chat workflow. + ### Image Messages Image message controls live in App Settings → Messaging. Turn on **Enable image messages** first; **Process images automatically** and the image model download/cancel/removal controls then appear. Automatic processing reconstructs every image as it arrives and uses about 2 GB of memory for a second each time; leave it off to reconstruct with a tap. See [Image Messages](image-messages.md) for firmware, native-runtime, storage, and memory requirements. diff --git a/lib/connector/meshcore_connector.dart b/lib/connector/meshcore_connector.dart index 8a5428ee..b1eaeda7 100644 --- a/lib/connector/meshcore_connector.dart +++ b/lib/connector/meshcore_connector.dart @@ -491,7 +491,7 @@ class MeshCoreConnector extends ChangeNotifier { List _cachedChannels = []; final Map _channelSmazEnabled = {}; final Map _channelCyr2LatEnabled = {}; - final Map _channelUrlImagesEnabled = {}; + final Map _channelUrlImagesEnabled = {}; final Map _channelCyr2LatProfileId = {}; final Map _channelRegions = {}; Region _defaultRegion = ''; @@ -501,7 +501,7 @@ class MeshCoreConnector extends ChangeNotifier { Uint8List? _defaultFloodScopeKey; final Map _contactSmazEnabled = {}; final Map _contactCyr2LatEnabled = {}; - final Map _contactUrlImagesEnabled = {}; + final Map _contactUrlImagesEnabled = {}; final Map _contactCyr2LatProfileId = {}; final Set _knownContactKeys = {}; final Map _contactUnreadCount = {}; @@ -1059,13 +1059,25 @@ class MeshCoreConnector extends ChangeNotifier { return _contactSmazEnabled[contactKeyHex] ?? false; } + bool _lastShowLinkImagesByDefault = false; + + void _onAppSettingsChanged() { + final showByDefault = _showLinkImagesByDefault; + if (showByDefault == _lastShowLinkImagesByDefault) return; + _lastShowLinkImagesByDefault = showByDefault; + notifyListeners(); + } + + bool get _showLinkImagesByDefault => + _appSettingsService?.settings.showLinkImagesByDefault ?? false; + bool isChannelUrlImagesEnabled(int channelIndex) { - return _channelUrlImagesEnabled[channelIndex] ?? false; + return _channelUrlImagesEnabled[channelIndex] ?? _showLinkImagesByDefault; } bool isContactUrlImagesEnabled(String contactKeyHex) { _ensureContactUrlImagesSettingLoaded(contactKeyHex); - return _contactUrlImagesEnabled[contactKeyHex] ?? false; + return _contactUrlImagesEnabled[contactKeyHex] ?? _showLinkImagesByDefault; } /// True when the channel has its own (real) region assigned. @@ -1621,6 +1633,8 @@ class MeshCoreConnector extends ChangeNotifier { _retryService = retryService; _pathHistoryService = pathHistoryService; _appSettingsService = appSettingsService; + _lastShowLinkImagesByDefault = _showLinkImagesByDefault; + appSettingsService?.addListener(_onAppSettingsChanged); _translationService = translationService; _imageCodecService = imageCodecService; _imageTransport = imageTransport; @@ -3825,6 +3839,9 @@ class MeshCoreConnector extends ChangeNotifier { if (pendingAck != null) { _pendingGenericAckQueue.remove(pendingAck); } + if (_activeTransport == MeshCoreTransportType.tcp) { + unawaited(disconnect(manual: false)); + } rethrow; } @@ -5897,17 +5914,23 @@ class MeshCoreConnector extends ChangeNotifier { _findChannelByIndex(index)?.storageId ?? _slotChannelIds[index]; // Delete by setting empty name and zero PSK await sendFrame(buildSetChannelFrame(index, '', Uint8List(16))); - // Another slot holding the same PSK keeps the shared history. - final stillHeld = _channels.any( - (channel) => channel.index != index && channel.storageId == channelId, - ); - if (channelId != null && !stillHeld) { - await _clearChannelStorage(channelId); - } _channelMessages.remove(index); _processedChannelReactions.remove(index); - // Refresh channels after deleting - await getChannels(force: true); + try { + // Refresh before clearing history so messages from an in-flight queue + // sync cannot recreate the channel's stored history after it is deleted. + await getChannels(force: true); + } finally { + // Another slot holding the same PSK keeps the shared history. The + // deleted slot is skipped: a failed or partial refresh can leave it in + // the map. + final stillHeld = _slotChannelIds.entries.any( + (entry) => entry.key != index && entry.value == channelId, + ); + if (channelId != null && !stillHeld) { + await _clearChannelStorage(channelId); + } + } } /// Removes everything persisted for [channelId]: messages, settings, @@ -7311,7 +7334,7 @@ class MeshCoreConnector extends ChangeNotifier { void _ensureContactUrlImagesSettingLoaded(String contactKeyHex) { if (_contactUrlImagesEnabled.containsKey(contactKeyHex)) return; _contactSettingsStore.loadUrlImagesEnabled(contactKeyHex).then((enabled) { - if (_contactUrlImagesEnabled[contactKeyHex] == enabled) return; + if (_contactUrlImagesEnabled.containsKey(contactKeyHex)) return; _contactUrlImagesEnabled[contactKeyHex] = enabled; notifyListeners(); }); @@ -8865,6 +8888,7 @@ class MeshCoreConnector extends ChangeNotifier { @override void dispose() { _disposed = true; + _appSettingsService?.removeListener(_onAppSettingsChanged); _scanSubscription?.cancel(); _isScanningSubscription?.cancel(); _connectionSubscription?.cancel(); diff --git a/lib/helpers/ipfs_link_attach_flow.dart b/lib/helpers/ipfs_link_attach_flow.dart new file mode 100644 index 00000000..e1cb6530 --- /dev/null +++ b/lib/helpers/ipfs_link_attach_flow.dart @@ -0,0 +1,147 @@ +import 'dart:convert'; + +import 'package:file_selector/file_selector.dart' as file_selector; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import '../l10n/app_localizations.dart'; +import '../l10n/l10n.dart'; +import '../services/app_settings_service.dart'; +import 'ipfs_upload_helper.dart'; +import 'snack_bar_builder.dart'; + +/// Shared "send image via IPFS" flow for the direct-message and channel chat +/// screens: picks a file, uploads it with the configured IPFS settings and +/// puts the resulting link at the start of the composer draft. +/// +/// [maxBytes] is the screen's outbound byte limit and [encodeOutbound] turns +/// draft text into exactly what the send path measures (including any reply +/// prefix), so the limit is checked against that form. The draft is never +/// shortened: if the link won't fit, nothing is uploaded and the user is told +/// to shorten the message. +Future attachIpfsLinkToDraft({ + required BuildContext context, + required TextEditingController controller, + required FocusNode focusNode, + required int maxBytes, + required String Function(String text) encodeOutbound, +}) async { + final l10n = context.l10n; + final settings = context.read().settings; + if (settings.uploadIpfsEndpoint.trim().isEmpty) { + showDismissibleSnackBar( + context, + content: Text(l10n.chat_ipfsUploadNotConfigured), + ); + return; + } + + String draftWithLink(String messageUrl) => composeIpfsLinkDraft( + messageUrl: messageUrl, + existingText: controller.text.trim(), + ); + bool fits(String draft) => ipfsLinkDraftFits( + draft, + maxBytes: maxBytes, + encodeOutbound: encodeOutbound, + ); + + final sampleLink = IpfsUploadHelper.linkForCid( + uploadGateway: settings.uploadIpfsGateway, + cid: IpfsUploadHelper.sampleCid, + ); + if (!fits(draftWithLink(sampleLink))) { + showDismissibleSnackBar(context, content: Text(l10n.chat_ipfsLinkNoRoom)); + return; + } + + void showFailure(Object error) { + if (!context.mounted) return; + showDismissibleSnackBar( + context, + content: Text(ipfsUploadErrorText(l10n, error)), + ); + } + + final String messageUrl; + try { + final file = await file_selector.openFile(); + if (file == null || !context.mounted) return; + final bytes = await file.readAsBytes(); + if (!context.mounted) return; + if (bytes.isEmpty) { + showDismissibleSnackBar( + context, + content: Text(l10n.chat_ipfsSelectedFileEmpty), + ); + return; + } + messageUrl = await IpfsUploadHelper.uploadImageWithSettings( + settings: settings, + bytes: bytes, + fileName: file.name, + mimeType: IpfsUploadHelper.mimeTypeForFileName(file.name), + ); + } on Exception catch (error) { + showFailure(error); + return; + } catch (error, stackTrace) { + FlutterError.reportError( + FlutterErrorDetails( + exception: error, + stack: stackTrace, + library: 'ipfs link attach', + ), + ); + showFailure(error); + return; + } + if (!context.mounted) return; + + final messageText = draftWithLink(messageUrl); + controller.value = TextEditingValue( + text: messageText, + selection: TextSelection.collapsed(offset: messageText.length), + ); + focusNode.requestFocus(); + if (!fits(messageText)) { + showDismissibleSnackBar( + context, + content: Text(l10n.chat_ipfsLinkOverLimit), + ); + } +} + +/// The localized snackbar text for an upload [error]: config problems get a +/// specific message, anything else a generic one with technical details. +@visibleForTesting +String ipfsUploadErrorText(AppLocalizations l10n, Object error) { + if (error is IpfsUploadConfigException) { + return switch (error.reason) { + IpfsUploadConfigError.emptyEndpoint => l10n.chat_ipfsUploadNotConfigured, + IpfsUploadConfigError.invalidEndpoint => l10n.chat_ipfsEndpointInvalid, + IpfsUploadConfigError.pinataTokenMissing => + l10n.chat_ipfsPinataTokenMissing, + IpfsUploadConfigError.filebaseTokenMissing => + l10n.chat_ipfsFilebaseTokenMissing, + IpfsUploadConfigError.kuboPathInvalid => l10n.chat_ipfsKuboPathInvalid, + }; + } + final details = '$error'.replaceFirst(RegExp(r'^Exception: '), ''); + return l10n.chat_ipfsUploadFailed(details); +} + +/// Puts [messageUrl] in front of [existingText], leaving the text intact. +@visibleForTesting +String composeIpfsLinkDraft({ + required String messageUrl, + required String existingText, +}) => existingText.isEmpty ? '$messageUrl ' : '$messageUrl\n$existingText'; + +/// Whether [draft], encoded the way the send path encodes it, fits [maxBytes]. +@visibleForTesting +bool ipfsLinkDraftFits( + String draft, { + required int maxBytes, + required String Function(String text) encodeOutbound, +}) => utf8.encode(encodeOutbound(draft.trim())).length <= maxBytes; diff --git a/lib/helpers/ipfs_upload_helper.dart b/lib/helpers/ipfs_upload_helper.dart new file mode 100644 index 00000000..7f6e36e1 --- /dev/null +++ b/lib/helpers/ipfs_upload_helper.dart @@ -0,0 +1,228 @@ +import 'dart:convert'; + +import 'package:flutter/foundation.dart'; +import 'package:http/http.dart' as http; + +import '../models/app_settings.dart'; + +/// Why the IPFS upload settings can't be used. +enum IpfsUploadConfigError { + emptyEndpoint, + invalidEndpoint, + pinataTokenMissing, + filebaseTokenMissing, + kuboPathInvalid, +} + +/// Thrown when the IPFS upload settings can't be used, before or instead of +/// a network failure. The UI maps [reason] to a localized message. +class IpfsUploadConfigException implements Exception { + const IpfsUploadConfigException(this.reason); + + final IpfsUploadConfigError reason; + + @override + String toString() => 'IpfsUploadConfigException(${reason.name})'; +} + +class IpfsUploadHelper { + @visibleForTesting + static http.Client? httpClient; + + static final _kuboAddPath = RegExp(r'/api/v0/add/?$'); + + /// A CIDv1 (base32, sha2-256) as long as the CID of every upload, used to + /// size the link before uploading. + static const sampleCid = + 'bafkreihdwdcefgh4dqkjv67uzcmw7ojee6xedzdetojuzjevtenxquvyku'; + + static String linkForCid({ + required String uploadGateway, + required String cid, + }) { + final gateway = normalizeIpfsGateway(uploadGateway); + return gateway.isEmpty ? 'ipfs://$cid' : '$gateway$cid'; + } + + static String mimeTypeForFileName(String fileName) { + switch (fileName.toLowerCase().split('.').last) { + case 'jpg': + case 'jpeg': + return 'image/jpeg'; + case 'png': + return 'image/png'; + case 'gif': + return 'image/gif'; + case 'webp': + return 'image/webp'; + case 'heic': + return 'image/heic'; + default: + return 'application/octet-stream'; + } + } + + static Future uploadImageWithSettings({ + required AppSettings settings, + required Uint8List bytes, + required String fileName, + required String mimeType, + }) { + return uploadImage( + bytes: bytes, + fileName: fileName, + mimeType: mimeType, + uploadEndpoint: settings.uploadIpfsEndpoint, + uploadApiKey: settings.uploadIpfsApiKey, + uploadGateway: settings.uploadIpfsGateway, + ); + } + + static Future uploadImage({ + required Uint8List bytes, + required String fileName, + required String mimeType, + required String uploadEndpoint, + required String uploadApiKey, + String uploadGateway = '', + }) async { + final endpoint = uploadEndpoint.trim(); + if (endpoint.isEmpty) { + throw const IpfsUploadConfigException( + IpfsUploadConfigError.emptyEndpoint, + ); + } + + final endpointUri = Uri.tryParse(endpoint); + if (endpointUri == null || + !(endpointUri.isScheme('http') || endpointUri.isScheme('https')) || + endpointUri.host.isEmpty) { + throw const IpfsUploadConfigException( + IpfsUploadConfigError.invalidEndpoint, + ); + } + + final token = uploadApiKey.trim(); + final endpointHost = endpointUri.host.toLowerCase(); + final isPinata = + endpointHost.contains('pinata') || + endpoint.toLowerCase().contains('pinfiletoipfs'); + final isFilebase = endpointHost.contains('filebase'); + final isKubo = !isPinata && !isFilebase; + final safeFileName = _sanitizeUploadFileName(fileName); + if (isPinata && token.isEmpty) { + throw const IpfsUploadConfigException( + IpfsUploadConfigError.pinataTokenMissing, + ); + } + if (isFilebase && token.isEmpty) { + throw const IpfsUploadConfigException( + IpfsUploadConfigError.filebaseTokenMissing, + ); + } + if (isKubo && !_kuboAddPath.hasMatch(endpointUri.path)) { + throw const IpfsUploadConfigException( + IpfsUploadConfigError.kuboPathInvalid, + ); + } + + final uploadUri = isPinata + ? endpointUri + : endpointUri.replace( + queryParameters: { + ...endpointUri.queryParameters, + 'cid-version': '1', + if (isKubo) 'pin': 'true', + }, + ); + + final request = http.MultipartRequest('POST', uploadUri) + ..files.add( + http.MultipartFile.fromBytes('file', bytes, filename: safeFileName), + ); + if (token.isNotEmpty) { + request.headers['Authorization'] = 'Bearer $token'; + } + if (isPinata) { + request.fields['pinataOptions'] = jsonEncode({'cidVersion': 1}); + request.fields['pinataMetadata'] = jsonEncode({'name': safeFileName}); + } + + final client = httpClient; + final response = await (client == null + ? request.send() + : client.send(request)); + final body = await response.stream.bytesToString(); + if (response.statusCode < 200 || response.statusCode >= 300) { + throw Exception('IPFS upload failed (${response.statusCode}): $body'); + } + + final cid = _extractUploadCid(body, isPinata: isPinata); + if (cid == null || cid.isEmpty) { + throw Exception('IPFS upload did not return a CID.'); + } + + if (isKubo) { + await _copyKuboFileToMfs( + addUri: endpointUri, + cid: cid, + fileName: safeFileName, + authorization: token.isEmpty ? null : 'Bearer $token', + ); + } + + return linkForCid(uploadGateway: uploadGateway, cid: cid); + } + + static Future _copyKuboFileToMfs({ + required Uri addUri, + required String cid, + required String fileName, + required String? authorization, + }) async { + final mfsPath = '/meshcore_uploads/$cid-$fileName'; + final copyUri = addUri.replace( + path: addUri.path.replaceFirst(_kuboAddPath, '/api/v0/files/cp'), + query: + 'arg=${Uri.encodeQueryComponent('/ipfs/$cid')}' + '&arg=${Uri.encodeQueryComponent(mfsPath)}&parents=true', + ); + final headers = authorization == null + ? {} + : {'Authorization': authorization}; + final client = httpClient; + final response = await (client == null + ? http.post(copyUri, headers: headers) + : client.post(copyUri, headers: headers)); + final alreadyCopied = response.body.contains('already has entry'); + if ((response.statusCode < 200 || response.statusCode >= 300) && + !alreadyCopied) { + throw Exception( + 'Kubo MFS import failed (${response.statusCode}): ${response.body}', + ); + } + } + + static String _sanitizeUploadFileName(String name) { + final cleaned = name.replaceAll(RegExp(r'[<>:"/\\|?*]'), '_').trim(); + return cleaned.isEmpty ? 'shared-image' : cleaned; + } + + static String? _extractUploadCid(String body, {required bool isPinata}) { + final lines = const LineSplitter() + .convert(body) + .where((line) => line.trim().isNotEmpty) + .toList(); + for (final line in lines.reversed) { + try { + final decoded = jsonDecode(line); + if (decoded is! Map) continue; + final value = isPinata ? decoded['IpfsHash'] : decoded['Hash']; + if (value is String && value.isNotEmpty) return value; + } catch (_) { + continue; + } + } + return null; + } +} diff --git a/lib/helpers/message_url_image_helper.dart b/lib/helpers/message_url_image_helper.dart index 3f2a7835..6e85351a 100644 --- a/lib/helpers/message_url_image_helper.dart +++ b/lib/helpers/message_url_image_helper.dart @@ -5,6 +5,8 @@ import 'package:flutter/material.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:http/http.dart' as http; +import '../models/app_settings.dart'; + /// Finds and renders image URLs embedded in ordinary text messages. /// /// This is deliberately separate from MeshCore's transmitted channel-image @@ -22,6 +24,10 @@ class MessageUrlImageHelper { @visibleForTesting static http.Client? httpClient; + /// Mirrors [AppSettings.loadLinkImages]. When false, nothing is fetched + /// for link images and every parse returns null. + static final ValueNotifier loadLinkImages = ValueNotifier(true); + static final RegExp _pyxPattern = RegExp( r'''https?://pyx\.li/\?i=([A-Za-z0-9_-]+)''', caseSensitive: false, @@ -57,7 +63,11 @@ class MessageUrlImageHelper { _imagePattern.hasMatch(text); } - static Future parse(String text) async { + static Future parse( + String text, { + String publicGateway = AppSettings.defaultPublicIpfsGateway, + }) async { + if (!loadLinkImages.value) return null; final trimmed = text.trim(); if (trimmed.isEmpty) return null; @@ -74,7 +84,9 @@ class MessageUrlImageHelper { final ipfsCidMatch = _ipfsCidPattern.firstMatch(trimmed); if (ipfsCidMatch != null) { final cid = _trimBoundary(ipfsCidMatch.group(1)!); - return 'https://ipfs.io/ipfs/$cid'; + final gateway = normalizeIpfsGateway(publicGateway); + if (gateway.isEmpty) return null; + return '$gateway$cid'; } final ibbMatch = _ibbSharePattern.firstMatch(trimmed); @@ -96,8 +108,11 @@ class MessageUrlImageHelper { return null; } - static Future parseVerified(String text) async { - final imageUrl = await parse(text); + static Future parseVerified( + String text, { + String publicGateway = AppSettings.defaultPublicIpfsGateway, + }) async { + final imageUrl = await parse(text, publicGateway: publicGateway); if (imageUrl == null) return null; final verified = await _verifyImageUrl(imageUrl); @@ -110,20 +125,23 @@ class MessageUrlImageHelper { /// be retried when a message is shown again. static Future parseVerifiedForMessage( String messageId, - String text, - ) { - final cached = _messageImageCache.remove(messageId); + String text, { + String publicGateway = AppSettings.defaultPublicIpfsGateway, + }) { + if (!loadLinkImages.value) return Future.value(); + final cacheKey = '$messageId|$publicGateway'; + final cached = _messageImageCache.remove(cacheKey); if (cached != null) { - _messageImageCache[messageId] = cached; + _messageImageCache[cacheKey] = cached; return cached; } - final parsing = parseVerified(text); - _messageImageCache[messageId] = parsing; + final parsing = parseVerified(text, publicGateway: publicGateway); + _messageImageCache[cacheKey] = parsing; parsing.then((imageUrl) { if (imageUrl == null && - identical(_messageImageCache[messageId], parsing)) { - _messageImageCache.remove(messageId); + identical(_messageImageCache[cacheKey], parsing)) { + _messageImageCache.remove(cacheKey); } else if (imageUrl != null) { while (_messageImageCache.length > _maxMessageImageCacheEntries) { _messageImageCache.remove(_messageImageCache.keys.first); @@ -207,11 +225,13 @@ class MessageUrlImageFutureBuilder extends StatefulWidget { super.key, required this.messageId, required this.text, + required this.publicGateway, required this.builder, }); final String messageId; final String text; + final String publicGateway; final AsyncWidgetBuilder builder; @override @@ -226,23 +246,39 @@ class _MessageUrlImageFutureBuilderState @override void initState() { super.initState(); - _imageFuture = MessageUrlImageHelper.parseVerifiedForMessage( - widget.messageId, - widget.text, - ); + _imageFuture = _parse(); + MessageUrlImageHelper.loadLinkImages.addListener(_onLoadLinkImagesChanged); } @override void didUpdateWidget(covariant MessageUrlImageFutureBuilder oldWidget) { super.didUpdateWidget(oldWidget); - if (oldWidget.messageId != widget.messageId) { - _imageFuture = MessageUrlImageHelper.parseVerifiedForMessage( - widget.messageId, - widget.text, - ); + if (oldWidget.messageId != widget.messageId || + oldWidget.publicGateway != widget.publicGateway) { + _imageFuture = _parse(); } } + @override + void dispose() { + MessageUrlImageHelper.loadLinkImages.removeListener( + _onLoadLinkImagesChanged, + ); + super.dispose(); + } + + Future _parse() { + return MessageUrlImageHelper.parseVerifiedForMessage( + widget.messageId, + widget.text, + publicGateway: widget.publicGateway, + ); + } + + void _onLoadLinkImagesChanged() { + setState(() => _imageFuture = _parse()); + } + @override Widget build(BuildContext context) { return FutureBuilder( diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 7b0c3550..9f8a6b78 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -69,6 +69,7 @@ }, "urlImage_enable": "Enable URL images", "urlImage_possible": "Possible URL image; enable it in Settings.", + "urlImage_disabledInAppSettings": "Turned off in app settings", "common_reboot": "Reboot", "common_loading": "Loading...", "common_notAvailable": "—", @@ -453,6 +454,25 @@ "appSettings_routeWeightFailureDecrementSubtitle": "Weight removed from a path after failed delivery", "appSettings_maxMessageRetries": "Max Message Retries", "appSettings_maxMessageRetriesSubtitle": "Number of retry attempts before marking a message as failed", + "appSettings_ipfsImageLinks": "IPFS provider configuration", + "appSettings_ipfsImageLinksSubtitle": "Upload for url Images (or Files) via IPFS provider and default gateway to receive", + "appSettings_loadLinkImages": "Load images from links", + "appSettings_loadLinkImagesSubtitle": "Show pictures from links in messages. Loading an image shares your IP address with the site that hosts it.", + "appSettings_showLinkImagesByDefault": "Show link images in all chats by default", + "appSettings_showLinkImagesByDefaultSubtitle": "Load link images in every chat unless you turned them off there. This shares your IP address with image hosts in every chat.", + "appSettings_publicIpfsGateway": "Public gateway", + "appSettings_ipfsGatewayDeactivated": "Deactivated", + "appSettings_ipfsGatewayIpfsIo": "ipfs.io", + "appSettings_ipfsGatewayPinata": "Pinata", + "appSettings_ipfsGatewayFilebase": "Filebase", + "appSettings_ipfsGatewayCustom": "Custom (Kubo)", + "appSettings_uploadIpfsProvider": "Upload provider", + "appSettings_uploadIpfsGateway": "Upload gateway", + "appSettings_uploadIpfsGatewaySubtitle": "Gateway to share Image or File as url-link. Leave empty to use ipfs: format, which may not be opened by other clients.", + "appSettings_uploadIpfsEndpoint": "Upload endpoint", + "appSettings_uploadIpfsEndpointSubtitle": "The API endpoint used to upload files", + "appSettings_uploadIpfsApiKey": "Upload API key", + "appSettings_ipfsImageLinksDescription": "Public gateway downloads ipfs: format images. Upload gateway is used to generate share links for uploaded url images or files.", "appSettings_battery": "Battery", "appSettings_batteryChemistry": "Battery Chemistry", "appSettings_batteryChemistryPerDevice": "Set per device ({deviceName})", @@ -929,6 +949,29 @@ "chat_removeGif": "Remove GIF", "chat_cancelReply": "Cancel reply", "chat_sendImageLora": "Send low-res image over radio", + "chat_sendImageIpfs": "Send image or file via IPFS", + "chat_ipfsUploadFailed": "IPFS upload failed: {error}", + "@chat_ipfsUploadFailed": { + "placeholders": { + "error": { + "type": "String" + } + } + }, + "chat_ipfsUploadNotConfigured": "Configure an IPFS upload provider in App Settings first.", + "chat_ipfsSelectedFileEmpty": "The selected file is empty.", + "chat_ipfsEndpointInvalid": "The IPFS upload endpoint must be a full http:// or https:// address. Check it in App Settings.", + "chat_ipfsPinataTokenMissing": "Pinata needs an API key or JWT. Add it in App Settings.", + "chat_ipfsFilebaseTokenMissing": "Filebase needs an API token. Add it in App Settings.", + "chat_ipfsKuboPathInvalid": "The Kubo upload endpoint must end with /api/v0/add. Check it in App Settings.", + "chat_ipfsLinkNoRoom": "Not enough room for the image link. Shorten your message, then try again.", + "@chat_ipfsLinkNoRoom": { + "description": "Shown before an IPFS upload when the link would push the draft over the message size limit" + }, + "chat_ipfsLinkOverLimit": "Image link added, but the message is now too long. Shorten it before sending.", + "@chat_ipfsLinkOverLimit": { + "description": "Shown after an IPFS upload when the link plus the draft no longer fits the message size limit" + }, "chat_imagePickFailed": "Couldn't open that image", "@chat_imagePickFailed": { "description": "Shown when picking or reading a photo to send fails" diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index 152fd407..64853f11 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -382,6 +382,12 @@ abstract class AppLocalizations { /// **'Possible URL image; enable it in Settings.'** String get urlImage_possible; + /// No description provided for @urlImage_disabledInAppSettings. + /// + /// In en, this message translates to: + /// **'Turned off in app settings'** + String get urlImage_disabledInAppSettings; + /// No description provided for @common_reboot. /// /// In en, this message translates to: @@ -1954,6 +1960,120 @@ abstract class AppLocalizations { /// **'Number of retry attempts before marking a message as failed'** String get appSettings_maxMessageRetriesSubtitle; + /// No description provided for @appSettings_ipfsImageLinks. + /// + /// In en, this message translates to: + /// **'IPFS provider configuration'** + String get appSettings_ipfsImageLinks; + + /// No description provided for @appSettings_ipfsImageLinksSubtitle. + /// + /// In en, this message translates to: + /// **'Upload for url Images (or Files) via IPFS provider and default gateway to receive'** + String get appSettings_ipfsImageLinksSubtitle; + + /// No description provided for @appSettings_loadLinkImages. + /// + /// In en, this message translates to: + /// **'Load images from links'** + String get appSettings_loadLinkImages; + + /// No description provided for @appSettings_loadLinkImagesSubtitle. + /// + /// In en, this message translates to: + /// **'Show pictures from links in messages. Loading an image shares your IP address with the site that hosts it.'** + String get appSettings_loadLinkImagesSubtitle; + + /// No description provided for @appSettings_showLinkImagesByDefault. + /// + /// In en, this message translates to: + /// **'Show link images in all chats by default'** + String get appSettings_showLinkImagesByDefault; + + /// No description provided for @appSettings_showLinkImagesByDefaultSubtitle. + /// + /// In en, this message translates to: + /// **'Load link images in every chat unless you turned them off there. This shares your IP address with image hosts in every chat.'** + String get appSettings_showLinkImagesByDefaultSubtitle; + + /// No description provided for @appSettings_publicIpfsGateway. + /// + /// In en, this message translates to: + /// **'Public gateway'** + String get appSettings_publicIpfsGateway; + + /// No description provided for @appSettings_ipfsGatewayDeactivated. + /// + /// In en, this message translates to: + /// **'Deactivated'** + String get appSettings_ipfsGatewayDeactivated; + + /// No description provided for @appSettings_ipfsGatewayIpfsIo. + /// + /// In en, this message translates to: + /// **'ipfs.io'** + String get appSettings_ipfsGatewayIpfsIo; + + /// No description provided for @appSettings_ipfsGatewayPinata. + /// + /// In en, this message translates to: + /// **'Pinata'** + String get appSettings_ipfsGatewayPinata; + + /// No description provided for @appSettings_ipfsGatewayFilebase. + /// + /// In en, this message translates to: + /// **'Filebase'** + String get appSettings_ipfsGatewayFilebase; + + /// No description provided for @appSettings_ipfsGatewayCustom. + /// + /// In en, this message translates to: + /// **'Custom (Kubo)'** + String get appSettings_ipfsGatewayCustom; + + /// No description provided for @appSettings_uploadIpfsProvider. + /// + /// In en, this message translates to: + /// **'Upload provider'** + String get appSettings_uploadIpfsProvider; + + /// No description provided for @appSettings_uploadIpfsGateway. + /// + /// In en, this message translates to: + /// **'Upload gateway'** + String get appSettings_uploadIpfsGateway; + + /// No description provided for @appSettings_uploadIpfsGatewaySubtitle. + /// + /// In en, this message translates to: + /// **'Gateway to share Image or File as url-link. Leave empty to use ipfs: format, which may not be opened by other clients.'** + String get appSettings_uploadIpfsGatewaySubtitle; + + /// No description provided for @appSettings_uploadIpfsEndpoint. + /// + /// In en, this message translates to: + /// **'Upload endpoint'** + String get appSettings_uploadIpfsEndpoint; + + /// No description provided for @appSettings_uploadIpfsEndpointSubtitle. + /// + /// In en, this message translates to: + /// **'The API endpoint used to upload files'** + String get appSettings_uploadIpfsEndpointSubtitle; + + /// No description provided for @appSettings_uploadIpfsApiKey. + /// + /// In en, this message translates to: + /// **'Upload API key'** + String get appSettings_uploadIpfsApiKey; + + /// No description provided for @appSettings_ipfsImageLinksDescription. + /// + /// In en, this message translates to: + /// **'Public gateway downloads ipfs: format images. Upload gateway is used to generate share links for uploaded url images or files.'** + String get appSettings_ipfsImageLinksDescription; + /// No description provided for @appSettings_battery. /// /// In en, this message translates to: @@ -3184,6 +3304,66 @@ abstract class AppLocalizations { /// **'Send low-res image over radio'** String get chat_sendImageLora; + /// No description provided for @chat_sendImageIpfs. + /// + /// In en, this message translates to: + /// **'Send image or file via IPFS'** + String get chat_sendImageIpfs; + + /// No description provided for @chat_ipfsUploadFailed. + /// + /// In en, this message translates to: + /// **'IPFS upload failed: {error}'** + String chat_ipfsUploadFailed(String error); + + /// No description provided for @chat_ipfsUploadNotConfigured. + /// + /// In en, this message translates to: + /// **'Configure an IPFS upload provider in App Settings first.'** + String get chat_ipfsUploadNotConfigured; + + /// No description provided for @chat_ipfsSelectedFileEmpty. + /// + /// In en, this message translates to: + /// **'The selected file is empty.'** + String get chat_ipfsSelectedFileEmpty; + + /// No description provided for @chat_ipfsEndpointInvalid. + /// + /// In en, this message translates to: + /// **'The IPFS upload endpoint must be a full http:// or https:// address. Check it in App Settings.'** + String get chat_ipfsEndpointInvalid; + + /// No description provided for @chat_ipfsPinataTokenMissing. + /// + /// In en, this message translates to: + /// **'Pinata needs an API key or JWT. Add it in App Settings.'** + String get chat_ipfsPinataTokenMissing; + + /// No description provided for @chat_ipfsFilebaseTokenMissing. + /// + /// In en, this message translates to: + /// **'Filebase needs an API token. Add it in App Settings.'** + String get chat_ipfsFilebaseTokenMissing; + + /// No description provided for @chat_ipfsKuboPathInvalid. + /// + /// In en, this message translates to: + /// **'The Kubo upload endpoint must end with /api/v0/add. Check it in App Settings.'** + String get chat_ipfsKuboPathInvalid; + + /// Shown before an IPFS upload when the link would push the draft over the message size limit + /// + /// In en, this message translates to: + /// **'Not enough room for the image link. Shorten your message, then try again.'** + String get chat_ipfsLinkNoRoom; + + /// Shown after an IPFS upload when the link plus the draft no longer fits the message size limit + /// + /// In en, this message translates to: + /// **'Image link added, but the message is now too long. Shorten it before sending.'** + String get chat_ipfsLinkOverLimit; + /// Shown when picking or reading a photo to send fails /// /// In en, this message translates to: diff --git a/lib/l10n/app_localizations_bg.dart b/lib/l10n/app_localizations_bg.dart index accc719a..7aee19b5 100644 --- a/lib/l10n/app_localizations_bg.dart +++ b/lib/l10n/app_localizations_bg.dart @@ -150,6 +150,9 @@ class AppLocalizationsBg extends AppLocalizations { String get urlImage_possible => 'Възможно изображение от URL; активирайте го в Настройки.'; + @override + String get urlImage_disabledInAppSettings => 'Turned off in app settings'; + @override String get common_reboot => 'Рестартирай'; @@ -1076,6 +1079,70 @@ class AppLocalizationsBg extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Брой опити за повторно изпращане, преди съобщението да бъде маркирано като неуспешно.'; + @override + String get appSettings_ipfsImageLinks => 'IPFS provider configuration'; + + @override + String get appSettings_ipfsImageLinksSubtitle => + 'Upload for url Images (or Files) via IPFS provider and default gateway to receive'; + + @override + String get appSettings_loadLinkImages => 'Load images from links'; + + @override + String get appSettings_loadLinkImagesSubtitle => + 'Show pictures from links in messages. Loading an image shares your IP address with the site that hosts it.'; + + @override + String get appSettings_showLinkImagesByDefault => + 'Show link images in all chats by default'; + + @override + String get appSettings_showLinkImagesByDefaultSubtitle => + 'Load link images in every chat unless you turned them off there. This shares your IP address with image hosts in every chat.'; + + @override + String get appSettings_publicIpfsGateway => 'Public gateway'; + + @override + String get appSettings_ipfsGatewayDeactivated => 'Deactivated'; + + @override + String get appSettings_ipfsGatewayIpfsIo => 'ipfs.io'; + + @override + String get appSettings_ipfsGatewayPinata => 'Pinata'; + + @override + String get appSettings_ipfsGatewayFilebase => 'Filebase'; + + @override + String get appSettings_ipfsGatewayCustom => 'Custom (Kubo)'; + + @override + String get appSettings_uploadIpfsProvider => 'Upload provider'; + + @override + String get appSettings_uploadIpfsGateway => 'Upload gateway'; + + @override + String get appSettings_uploadIpfsGatewaySubtitle => + 'Gateway to share Image or File as url-link. Leave empty to use ipfs: format, which may not be opened by other clients.'; + + @override + String get appSettings_uploadIpfsEndpoint => 'Upload endpoint'; + + @override + String get appSettings_uploadIpfsEndpointSubtitle => + 'The API endpoint used to upload files'; + + @override + String get appSettings_uploadIpfsApiKey => 'Upload API key'; + + @override + String get appSettings_ipfsImageLinksDescription => + 'Public gateway downloads ipfs: format images. Upload gateway is used to generate share links for uploaded url images or files.'; + @override String get appSettings_battery => 'Батерия'; @@ -1792,6 +1859,45 @@ class AppLocalizationsBg extends AppLocalizations { @override String get chat_sendImageLora => 'Изпращане на изображение чрез MeshCore'; + @override + String get chat_sendImageIpfs => 'Send image or file via IPFS'; + + @override + String chat_ipfsUploadFailed(String error) { + return 'IPFS upload failed: $error'; + } + + @override + String get chat_ipfsUploadNotConfigured => + 'Configure an IPFS upload provider in App Settings first.'; + + @override + String get chat_ipfsSelectedFileEmpty => 'The selected file is empty.'; + + @override + String get chat_ipfsEndpointInvalid => + 'The IPFS upload endpoint must be a full http:// or https:// address. Check it in App Settings.'; + + @override + String get chat_ipfsPinataTokenMissing => + 'Pinata needs an API key or JWT. Add it in App Settings.'; + + @override + String get chat_ipfsFilebaseTokenMissing => + 'Filebase needs an API token. Add it in App Settings.'; + + @override + String get chat_ipfsKuboPathInvalid => + 'The Kubo upload endpoint must end with /api/v0/add. Check it in App Settings.'; + + @override + String get chat_ipfsLinkNoRoom => + 'Not enough room for the image link. Shorten your message, then try again.'; + + @override + String get chat_ipfsLinkOverLimit => + 'Image link added, but the message is now too long. Shorten it before sending.'; + @override String get chat_imagePickFailed => 'Не мог да откривам та изображин'; diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart index 36ff0eb5..5486f6d3 100644 --- a/lib/l10n/app_localizations_de.dart +++ b/lib/l10n/app_localizations_de.dart @@ -150,6 +150,9 @@ class AppLocalizationsDe extends AppLocalizations { String get urlImage_possible => 'Mögliches URL-Bild; in den Einstellungen aktivieren.'; + @override + String get urlImage_disabledInAppSettings => 'Turned off in app settings'; + @override String get common_reboot => 'Neustart'; @@ -1071,6 +1074,70 @@ class AppLocalizationsDe extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Anzahl der Versuche, eine Nachricht erneut zu senden, bevor sie als fehlgeschlagen markiert wird.'; + @override + String get appSettings_ipfsImageLinks => 'IPFS provider configuration'; + + @override + String get appSettings_ipfsImageLinksSubtitle => + 'Upload for url Images (or Files) via IPFS provider and default gateway to receive'; + + @override + String get appSettings_loadLinkImages => 'Load images from links'; + + @override + String get appSettings_loadLinkImagesSubtitle => + 'Show pictures from links in messages. Loading an image shares your IP address with the site that hosts it.'; + + @override + String get appSettings_showLinkImagesByDefault => + 'Show link images in all chats by default'; + + @override + String get appSettings_showLinkImagesByDefaultSubtitle => + 'Load link images in every chat unless you turned them off there. This shares your IP address with image hosts in every chat.'; + + @override + String get appSettings_publicIpfsGateway => 'Public gateway'; + + @override + String get appSettings_ipfsGatewayDeactivated => 'Deactivated'; + + @override + String get appSettings_ipfsGatewayIpfsIo => 'ipfs.io'; + + @override + String get appSettings_ipfsGatewayPinata => 'Pinata'; + + @override + String get appSettings_ipfsGatewayFilebase => 'Filebase'; + + @override + String get appSettings_ipfsGatewayCustom => 'Custom (Kubo)'; + + @override + String get appSettings_uploadIpfsProvider => 'Upload provider'; + + @override + String get appSettings_uploadIpfsGateway => 'Upload gateway'; + + @override + String get appSettings_uploadIpfsGatewaySubtitle => + 'Gateway to share Image or File as url-link. Leave empty to use ipfs: format, which may not be opened by other clients.'; + + @override + String get appSettings_uploadIpfsEndpoint => 'Upload endpoint'; + + @override + String get appSettings_uploadIpfsEndpointSubtitle => + 'The API endpoint used to upload files'; + + @override + String get appSettings_uploadIpfsApiKey => 'Upload API key'; + + @override + String get appSettings_ipfsImageLinksDescription => + 'Public gateway downloads ipfs: format images. Upload gateway is used to generate share links for uploaded url images or files.'; + @override String get appSettings_battery => 'Akku'; @@ -1791,6 +1858,45 @@ class AppLocalizationsDe extends AppLocalizations { @override String get chat_sendImageLora => 'Bild über MeshCore senden'; + @override + String get chat_sendImageIpfs => 'Send image or file via IPFS'; + + @override + String chat_ipfsUploadFailed(String error) { + return 'IPFS upload failed: $error'; + } + + @override + String get chat_ipfsUploadNotConfigured => + 'Configure an IPFS upload provider in App Settings first.'; + + @override + String get chat_ipfsSelectedFileEmpty => 'The selected file is empty.'; + + @override + String get chat_ipfsEndpointInvalid => + 'The IPFS upload endpoint must be a full http:// or https:// address. Check it in App Settings.'; + + @override + String get chat_ipfsPinataTokenMissing => + 'Pinata needs an API key or JWT. Add it in App Settings.'; + + @override + String get chat_ipfsFilebaseTokenMissing => + 'Filebase needs an API token. Add it in App Settings.'; + + @override + String get chat_ipfsKuboPathInvalid => + 'The Kubo upload endpoint must end with /api/v0/add. Check it in App Settings.'; + + @override + String get chat_ipfsLinkNoRoom => + 'Not enough room for the image link. Shorten your message, then try again.'; + + @override + String get chat_ipfsLinkOverLimit => + 'Image link added, but the message is now too long. Shorten it before sending.'; + @override String get chat_imagePickFailed => 'Konnte dieses Bild nicht öffnen.'; diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 52d92b5c..77fbf68f 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -150,6 +150,9 @@ class AppLocalizationsEn extends AppLocalizations { @override String get urlImage_possible => 'Possible URL image; enable it in Settings.'; + @override + String get urlImage_disabledInAppSettings => 'Turned off in app settings'; + @override String get common_reboot => 'Reboot'; @@ -1055,6 +1058,70 @@ class AppLocalizationsEn extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Number of retry attempts before marking a message as failed'; + @override + String get appSettings_ipfsImageLinks => 'IPFS provider configuration'; + + @override + String get appSettings_ipfsImageLinksSubtitle => + 'Upload for url Images (or Files) via IPFS provider and default gateway to receive'; + + @override + String get appSettings_loadLinkImages => 'Load images from links'; + + @override + String get appSettings_loadLinkImagesSubtitle => + 'Show pictures from links in messages. Loading an image shares your IP address with the site that hosts it.'; + + @override + String get appSettings_showLinkImagesByDefault => + 'Show link images in all chats by default'; + + @override + String get appSettings_showLinkImagesByDefaultSubtitle => + 'Load link images in every chat unless you turned them off there. This shares your IP address with image hosts in every chat.'; + + @override + String get appSettings_publicIpfsGateway => 'Public gateway'; + + @override + String get appSettings_ipfsGatewayDeactivated => 'Deactivated'; + + @override + String get appSettings_ipfsGatewayIpfsIo => 'ipfs.io'; + + @override + String get appSettings_ipfsGatewayPinata => 'Pinata'; + + @override + String get appSettings_ipfsGatewayFilebase => 'Filebase'; + + @override + String get appSettings_ipfsGatewayCustom => 'Custom (Kubo)'; + + @override + String get appSettings_uploadIpfsProvider => 'Upload provider'; + + @override + String get appSettings_uploadIpfsGateway => 'Upload gateway'; + + @override + String get appSettings_uploadIpfsGatewaySubtitle => + 'Gateway to share Image or File as url-link. Leave empty to use ipfs: format, which may not be opened by other clients.'; + + @override + String get appSettings_uploadIpfsEndpoint => 'Upload endpoint'; + + @override + String get appSettings_uploadIpfsEndpointSubtitle => + 'The API endpoint used to upload files'; + + @override + String get appSettings_uploadIpfsApiKey => 'Upload API key'; + + @override + String get appSettings_ipfsImageLinksDescription => + 'Public gateway downloads ipfs: format images. Upload gateway is used to generate share links for uploaded url images or files.'; + @override String get appSettings_battery => 'Battery'; @@ -1760,6 +1827,45 @@ class AppLocalizationsEn extends AppLocalizations { @override String get chat_sendImageLora => 'Send low-res image over radio'; + @override + String get chat_sendImageIpfs => 'Send image or file via IPFS'; + + @override + String chat_ipfsUploadFailed(String error) { + return 'IPFS upload failed: $error'; + } + + @override + String get chat_ipfsUploadNotConfigured => + 'Configure an IPFS upload provider in App Settings first.'; + + @override + String get chat_ipfsSelectedFileEmpty => 'The selected file is empty.'; + + @override + String get chat_ipfsEndpointInvalid => + 'The IPFS upload endpoint must be a full http:// or https:// address. Check it in App Settings.'; + + @override + String get chat_ipfsPinataTokenMissing => + 'Pinata needs an API key or JWT. Add it in App Settings.'; + + @override + String get chat_ipfsFilebaseTokenMissing => + 'Filebase needs an API token. Add it in App Settings.'; + + @override + String get chat_ipfsKuboPathInvalid => + 'The Kubo upload endpoint must end with /api/v0/add. Check it in App Settings.'; + + @override + String get chat_ipfsLinkNoRoom => + 'Not enough room for the image link. Shorten your message, then try again.'; + + @override + String get chat_ipfsLinkOverLimit => + 'Image link added, but the message is now too long. Shorten it before sending.'; + @override String get chat_imagePickFailed => 'Couldn\'t open that image'; diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart index 2ae09d71..2570b832 100644 --- a/lib/l10n/app_localizations_es.dart +++ b/lib/l10n/app_localizations_es.dart @@ -150,6 +150,9 @@ class AppLocalizationsEs extends AppLocalizations { String get urlImage_possible => 'Posible imagen de URL; actívala en Configuración.'; + @override + String get urlImage_disabledInAppSettings => 'Turned off in app settings'; + @override String get common_reboot => 'Reiniciar'; @@ -1068,6 +1071,70 @@ class AppLocalizationsEs extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Número de intentos de reintento antes de marcar un mensaje como fallido.'; + @override + String get appSettings_ipfsImageLinks => 'IPFS provider configuration'; + + @override + String get appSettings_ipfsImageLinksSubtitle => + 'Upload for url Images (or Files) via IPFS provider and default gateway to receive'; + + @override + String get appSettings_loadLinkImages => 'Load images from links'; + + @override + String get appSettings_loadLinkImagesSubtitle => + 'Show pictures from links in messages. Loading an image shares your IP address with the site that hosts it.'; + + @override + String get appSettings_showLinkImagesByDefault => + 'Show link images in all chats by default'; + + @override + String get appSettings_showLinkImagesByDefaultSubtitle => + 'Load link images in every chat unless you turned them off there. This shares your IP address with image hosts in every chat.'; + + @override + String get appSettings_publicIpfsGateway => 'Public gateway'; + + @override + String get appSettings_ipfsGatewayDeactivated => 'Deactivated'; + + @override + String get appSettings_ipfsGatewayIpfsIo => 'ipfs.io'; + + @override + String get appSettings_ipfsGatewayPinata => 'Pinata'; + + @override + String get appSettings_ipfsGatewayFilebase => 'Filebase'; + + @override + String get appSettings_ipfsGatewayCustom => 'Custom (Kubo)'; + + @override + String get appSettings_uploadIpfsProvider => 'Upload provider'; + + @override + String get appSettings_uploadIpfsGateway => 'Upload gateway'; + + @override + String get appSettings_uploadIpfsGatewaySubtitle => + 'Gateway to share Image or File as url-link. Leave empty to use ipfs: format, which may not be opened by other clients.'; + + @override + String get appSettings_uploadIpfsEndpoint => 'Upload endpoint'; + + @override + String get appSettings_uploadIpfsEndpointSubtitle => + 'The API endpoint used to upload files'; + + @override + String get appSettings_uploadIpfsApiKey => 'Upload API key'; + + @override + String get appSettings_ipfsImageLinksDescription => + 'Public gateway downloads ipfs: format images. Upload gateway is used to generate share links for uploaded url images or files.'; + @override String get appSettings_battery => 'Batería'; @@ -1787,6 +1854,45 @@ class AppLocalizationsEs extends AppLocalizations { @override String get chat_sendImageLora => 'Enviar imagen mediante MeshCore'; + @override + String get chat_sendImageIpfs => 'Send image or file via IPFS'; + + @override + String chat_ipfsUploadFailed(String error) { + return 'IPFS upload failed: $error'; + } + + @override + String get chat_ipfsUploadNotConfigured => + 'Configure an IPFS upload provider in App Settings first.'; + + @override + String get chat_ipfsSelectedFileEmpty => 'The selected file is empty.'; + + @override + String get chat_ipfsEndpointInvalid => + 'The IPFS upload endpoint must be a full http:// or https:// address. Check it in App Settings.'; + + @override + String get chat_ipfsPinataTokenMissing => + 'Pinata needs an API key or JWT. Add it in App Settings.'; + + @override + String get chat_ipfsFilebaseTokenMissing => + 'Filebase needs an API token. Add it in App Settings.'; + + @override + String get chat_ipfsKuboPathInvalid => + 'The Kubo upload endpoint must end with /api/v0/add. Check it in App Settings.'; + + @override + String get chat_ipfsLinkNoRoom => + 'Not enough room for the image link. Shorten your message, then try again.'; + + @override + String get chat_ipfsLinkOverLimit => + 'Image link added, but the message is now too long. Shorten it before sending.'; + @override String get chat_imagePickFailed => 'No pude abrir esa imagen'; diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart index b1f837bb..c5836961 100644 --- a/lib/l10n/app_localizations_fr.dart +++ b/lib/l10n/app_localizations_fr.dart @@ -150,6 +150,9 @@ class AppLocalizationsFr extends AppLocalizations { String get urlImage_possible => 'Image URL possible ; activez-la dans les Paramètres.'; + @override + String get urlImage_disabledInAppSettings => 'Turned off in app settings'; + @override String get common_reboot => 'Redémarrer'; @@ -1074,6 +1077,70 @@ class AppLocalizationsFr extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Nombre de tentatives avant de marquer un message comme ayant échoué.'; + @override + String get appSettings_ipfsImageLinks => 'IPFS provider configuration'; + + @override + String get appSettings_ipfsImageLinksSubtitle => + 'Upload for url Images (or Files) via IPFS provider and default gateway to receive'; + + @override + String get appSettings_loadLinkImages => 'Load images from links'; + + @override + String get appSettings_loadLinkImagesSubtitle => + 'Show pictures from links in messages. Loading an image shares your IP address with the site that hosts it.'; + + @override + String get appSettings_showLinkImagesByDefault => + 'Show link images in all chats by default'; + + @override + String get appSettings_showLinkImagesByDefaultSubtitle => + 'Load link images in every chat unless you turned them off there. This shares your IP address with image hosts in every chat.'; + + @override + String get appSettings_publicIpfsGateway => 'Public gateway'; + + @override + String get appSettings_ipfsGatewayDeactivated => 'Deactivated'; + + @override + String get appSettings_ipfsGatewayIpfsIo => 'ipfs.io'; + + @override + String get appSettings_ipfsGatewayPinata => 'Pinata'; + + @override + String get appSettings_ipfsGatewayFilebase => 'Filebase'; + + @override + String get appSettings_ipfsGatewayCustom => 'Custom (Kubo)'; + + @override + String get appSettings_uploadIpfsProvider => 'Upload provider'; + + @override + String get appSettings_uploadIpfsGateway => 'Upload gateway'; + + @override + String get appSettings_uploadIpfsGatewaySubtitle => + 'Gateway to share Image or File as url-link. Leave empty to use ipfs: format, which may not be opened by other clients.'; + + @override + String get appSettings_uploadIpfsEndpoint => 'Upload endpoint'; + + @override + String get appSettings_uploadIpfsEndpointSubtitle => + 'The API endpoint used to upload files'; + + @override + String get appSettings_uploadIpfsApiKey => 'Upload API key'; + + @override + String get appSettings_ipfsImageLinksDescription => + 'Public gateway downloads ipfs: format images. Upload gateway is used to generate share links for uploaded url images or files.'; + @override String get appSettings_battery => 'Batterie'; @@ -1791,6 +1858,45 @@ class AppLocalizationsFr extends AppLocalizations { @override String get chat_sendImageLora => 'Envoyer une image via MeshCore'; + @override + String get chat_sendImageIpfs => 'Send image or file via IPFS'; + + @override + String chat_ipfsUploadFailed(String error) { + return 'IPFS upload failed: $error'; + } + + @override + String get chat_ipfsUploadNotConfigured => + 'Configure an IPFS upload provider in App Settings first.'; + + @override + String get chat_ipfsSelectedFileEmpty => 'The selected file is empty.'; + + @override + String get chat_ipfsEndpointInvalid => + 'The IPFS upload endpoint must be a full http:// or https:// address. Check it in App Settings.'; + + @override + String get chat_ipfsPinataTokenMissing => + 'Pinata needs an API key or JWT. Add it in App Settings.'; + + @override + String get chat_ipfsFilebaseTokenMissing => + 'Filebase needs an API token. Add it in App Settings.'; + + @override + String get chat_ipfsKuboPathInvalid => + 'The Kubo upload endpoint must end with /api/v0/add. Check it in App Settings.'; + + @override + String get chat_ipfsLinkNoRoom => + 'Not enough room for the image link. Shorten your message, then try again.'; + + @override + String get chat_ipfsLinkOverLimit => + 'Image link added, but the message is now too long. Shorten it before sending.'; + @override String get chat_imagePickFailed => 'Je n\'ai pas pu ouvrir cette image'; diff --git a/lib/l10n/app_localizations_hu.dart b/lib/l10n/app_localizations_hu.dart index 97ac54d9..a13f5fdb 100644 --- a/lib/l10n/app_localizations_hu.dart +++ b/lib/l10n/app_localizations_hu.dart @@ -150,6 +150,9 @@ class AppLocalizationsHu extends AppLocalizations { String get urlImage_possible => 'Lehetséges URL-kép; engedélyezze a Beállításokban.'; + @override + String get urlImage_disabledInAppSettings => 'Turned off in app settings'; + @override String get common_reboot => 'Indítsa újra'; @@ -1063,6 +1066,70 @@ class AppLocalizationsHu extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Az üzenet sikertelenként való megjelölése előtti újrapróbálkozások száma'; + @override + String get appSettings_ipfsImageLinks => 'IPFS provider configuration'; + + @override + String get appSettings_ipfsImageLinksSubtitle => + 'Upload for url Images (or Files) via IPFS provider and default gateway to receive'; + + @override + String get appSettings_loadLinkImages => 'Load images from links'; + + @override + String get appSettings_loadLinkImagesSubtitle => + 'Show pictures from links in messages. Loading an image shares your IP address with the site that hosts it.'; + + @override + String get appSettings_showLinkImagesByDefault => + 'Show link images in all chats by default'; + + @override + String get appSettings_showLinkImagesByDefaultSubtitle => + 'Load link images in every chat unless you turned them off there. This shares your IP address with image hosts in every chat.'; + + @override + String get appSettings_publicIpfsGateway => 'Public gateway'; + + @override + String get appSettings_ipfsGatewayDeactivated => 'Deactivated'; + + @override + String get appSettings_ipfsGatewayIpfsIo => 'ipfs.io'; + + @override + String get appSettings_ipfsGatewayPinata => 'Pinata'; + + @override + String get appSettings_ipfsGatewayFilebase => 'Filebase'; + + @override + String get appSettings_ipfsGatewayCustom => 'Custom (Kubo)'; + + @override + String get appSettings_uploadIpfsProvider => 'Upload provider'; + + @override + String get appSettings_uploadIpfsGateway => 'Upload gateway'; + + @override + String get appSettings_uploadIpfsGatewaySubtitle => + 'Gateway to share Image or File as url-link. Leave empty to use ipfs: format, which may not be opened by other clients.'; + + @override + String get appSettings_uploadIpfsEndpoint => 'Upload endpoint'; + + @override + String get appSettings_uploadIpfsEndpointSubtitle => + 'The API endpoint used to upload files'; + + @override + String get appSettings_uploadIpfsApiKey => 'Upload API key'; + + @override + String get appSettings_ipfsImageLinksDescription => + 'Public gateway downloads ipfs: format images. Upload gateway is used to generate share links for uploaded url images or files.'; + @override String get appSettings_battery => 'Akkumulátor'; @@ -1781,6 +1848,45 @@ class AppLocalizationsHu extends AppLocalizations { @override String get chat_sendImageLora => 'Kép küldése MeshCore-on keresztül'; + @override + String get chat_sendImageIpfs => 'Send image or file via IPFS'; + + @override + String chat_ipfsUploadFailed(String error) { + return 'IPFS upload failed: $error'; + } + + @override + String get chat_ipfsUploadNotConfigured => + 'Configure an IPFS upload provider in App Settings first.'; + + @override + String get chat_ipfsSelectedFileEmpty => 'The selected file is empty.'; + + @override + String get chat_ipfsEndpointInvalid => + 'The IPFS upload endpoint must be a full http:// or https:// address. Check it in App Settings.'; + + @override + String get chat_ipfsPinataTokenMissing => + 'Pinata needs an API key or JWT. Add it in App Settings.'; + + @override + String get chat_ipfsFilebaseTokenMissing => + 'Filebase needs an API token. Add it in App Settings.'; + + @override + String get chat_ipfsKuboPathInvalid => + 'The Kubo upload endpoint must end with /api/v0/add. Check it in App Settings.'; + + @override + String get chat_ipfsLinkNoRoom => + 'Not enough room for the image link. Shorten your message, then try again.'; + + @override + String get chat_ipfsLinkOverLimit => + 'Image link added, but the message is now too long. Shorten it before sending.'; + @override String get chat_imagePickFailed => 'Nem tudtam ezt a fenti fényre kapni'; diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart index 43b33252..af088381 100644 --- a/lib/l10n/app_localizations_it.dart +++ b/lib/l10n/app_localizations_it.dart @@ -150,6 +150,9 @@ class AppLocalizationsIt extends AppLocalizations { String get urlImage_possible => 'Possibile immagine URL; abilitala nelle Impostazioni.'; + @override + String get urlImage_disabledInAppSettings => 'Turned off in app settings'; + @override String get common_reboot => 'Riavvia'; @@ -1074,6 +1077,70 @@ class AppLocalizationsIt extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Numero di tentativi di riprova prima di considerare un messaggio come fallito.'; + @override + String get appSettings_ipfsImageLinks => 'IPFS provider configuration'; + + @override + String get appSettings_ipfsImageLinksSubtitle => + 'Upload for url Images (or Files) via IPFS provider and default gateway to receive'; + + @override + String get appSettings_loadLinkImages => 'Load images from links'; + + @override + String get appSettings_loadLinkImagesSubtitle => + 'Show pictures from links in messages. Loading an image shares your IP address with the site that hosts it.'; + + @override + String get appSettings_showLinkImagesByDefault => + 'Show link images in all chats by default'; + + @override + String get appSettings_showLinkImagesByDefaultSubtitle => + 'Load link images in every chat unless you turned them off there. This shares your IP address with image hosts in every chat.'; + + @override + String get appSettings_publicIpfsGateway => 'Public gateway'; + + @override + String get appSettings_ipfsGatewayDeactivated => 'Deactivated'; + + @override + String get appSettings_ipfsGatewayIpfsIo => 'ipfs.io'; + + @override + String get appSettings_ipfsGatewayPinata => 'Pinata'; + + @override + String get appSettings_ipfsGatewayFilebase => 'Filebase'; + + @override + String get appSettings_ipfsGatewayCustom => 'Custom (Kubo)'; + + @override + String get appSettings_uploadIpfsProvider => 'Upload provider'; + + @override + String get appSettings_uploadIpfsGateway => 'Upload gateway'; + + @override + String get appSettings_uploadIpfsGatewaySubtitle => + 'Gateway to share Image or File as url-link. Leave empty to use ipfs: format, which may not be opened by other clients.'; + + @override + String get appSettings_uploadIpfsEndpoint => 'Upload endpoint'; + + @override + String get appSettings_uploadIpfsEndpointSubtitle => + 'The API endpoint used to upload files'; + + @override + String get appSettings_uploadIpfsApiKey => 'Upload API key'; + + @override + String get appSettings_ipfsImageLinksDescription => + 'Public gateway downloads ipfs: format images. Upload gateway is used to generate share links for uploaded url images or files.'; + @override String get appSettings_battery => 'Batteria'; @@ -1791,6 +1858,45 @@ class AppLocalizationsIt extends AppLocalizations { @override String get chat_sendImageLora => 'Invia immagine tramite MeshCore'; + @override + String get chat_sendImageIpfs => 'Send image or file via IPFS'; + + @override + String chat_ipfsUploadFailed(String error) { + return 'IPFS upload failed: $error'; + } + + @override + String get chat_ipfsUploadNotConfigured => + 'Configure an IPFS upload provider in App Settings first.'; + + @override + String get chat_ipfsSelectedFileEmpty => 'The selected file is empty.'; + + @override + String get chat_ipfsEndpointInvalid => + 'The IPFS upload endpoint must be a full http:// or https:// address. Check it in App Settings.'; + + @override + String get chat_ipfsPinataTokenMissing => + 'Pinata needs an API key or JWT. Add it in App Settings.'; + + @override + String get chat_ipfsFilebaseTokenMissing => + 'Filebase needs an API token. Add it in App Settings.'; + + @override + String get chat_ipfsKuboPathInvalid => + 'The Kubo upload endpoint must end with /api/v0/add. Check it in App Settings.'; + + @override + String get chat_ipfsLinkNoRoom => + 'Not enough room for the image link. Shorten your message, then try again.'; + + @override + String get chat_ipfsLinkOverLimit => + 'Image link added, but the message is now too long. Shorten it before sending.'; + @override String get chat_imagePickFailed => 'Non sono riuscito ad aprire quell\'immagine'; diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart index 18453e17..fa585b1e 100644 --- a/lib/l10n/app_localizations_ja.dart +++ b/lib/l10n/app_localizations_ja.dart @@ -147,6 +147,9 @@ class AppLocalizationsJa extends AppLocalizations { @override String get urlImage_possible => 'URL画像の可能性があります。設定で有効にしてください。'; + @override + String get urlImage_disabledInAppSettings => 'Turned off in app settings'; + @override String get common_reboot => '再起動'; @@ -1011,6 +1014,70 @@ class AppLocalizationsJa extends AppLocalizations { @override String get appSettings_maxMessageRetriesSubtitle => 'メッセージを失敗として扱うまでの再試行回数'; + @override + String get appSettings_ipfsImageLinks => 'IPFS provider configuration'; + + @override + String get appSettings_ipfsImageLinksSubtitle => + 'Upload for url Images (or Files) via IPFS provider and default gateway to receive'; + + @override + String get appSettings_loadLinkImages => 'Load images from links'; + + @override + String get appSettings_loadLinkImagesSubtitle => + 'Show pictures from links in messages. Loading an image shares your IP address with the site that hosts it.'; + + @override + String get appSettings_showLinkImagesByDefault => + 'Show link images in all chats by default'; + + @override + String get appSettings_showLinkImagesByDefaultSubtitle => + 'Load link images in every chat unless you turned them off there. This shares your IP address with image hosts in every chat.'; + + @override + String get appSettings_publicIpfsGateway => 'Public gateway'; + + @override + String get appSettings_ipfsGatewayDeactivated => 'Deactivated'; + + @override + String get appSettings_ipfsGatewayIpfsIo => 'ipfs.io'; + + @override + String get appSettings_ipfsGatewayPinata => 'Pinata'; + + @override + String get appSettings_ipfsGatewayFilebase => 'Filebase'; + + @override + String get appSettings_ipfsGatewayCustom => 'Custom (Kubo)'; + + @override + String get appSettings_uploadIpfsProvider => 'Upload provider'; + + @override + String get appSettings_uploadIpfsGateway => 'Upload gateway'; + + @override + String get appSettings_uploadIpfsGatewaySubtitle => + 'Gateway to share Image or File as url-link. Leave empty to use ipfs: format, which may not be opened by other clients.'; + + @override + String get appSettings_uploadIpfsEndpoint => 'Upload endpoint'; + + @override + String get appSettings_uploadIpfsEndpointSubtitle => + 'The API endpoint used to upload files'; + + @override + String get appSettings_uploadIpfsApiKey => 'Upload API key'; + + @override + String get appSettings_ipfsImageLinksDescription => + 'Public gateway downloads ipfs: format images. Upload gateway is used to generate share links for uploaded url images or files.'; + @override String get appSettings_battery => 'バッテリー'; @@ -1704,6 +1771,45 @@ class AppLocalizationsJa extends AppLocalizations { @override String get chat_sendImageLora => 'MeshCore経由で画像を送信'; + @override + String get chat_sendImageIpfs => 'Send image or file via IPFS'; + + @override + String chat_ipfsUploadFailed(String error) { + return 'IPFS upload failed: $error'; + } + + @override + String get chat_ipfsUploadNotConfigured => + 'Configure an IPFS upload provider in App Settings first.'; + + @override + String get chat_ipfsSelectedFileEmpty => 'The selected file is empty.'; + + @override + String get chat_ipfsEndpointInvalid => + 'The IPFS upload endpoint must be a full http:// or https:// address. Check it in App Settings.'; + + @override + String get chat_ipfsPinataTokenMissing => + 'Pinata needs an API key or JWT. Add it in App Settings.'; + + @override + String get chat_ipfsFilebaseTokenMissing => + 'Filebase needs an API token. Add it in App Settings.'; + + @override + String get chat_ipfsKuboPathInvalid => + 'The Kubo upload endpoint must end with /api/v0/add. Check it in App Settings.'; + + @override + String get chat_ipfsLinkNoRoom => + 'Not enough room for the image link. Shorten your message, then try again.'; + + @override + String get chat_ipfsLinkOverLimit => + 'Image link added, but the message is now too long. Shorten it before sending.'; + @override String get chat_imagePickFailed => 'その画像を開けませんでした'; diff --git a/lib/l10n/app_localizations_ko.dart b/lib/l10n/app_localizations_ko.dart index 7408ca42..e6286bdc 100644 --- a/lib/l10n/app_localizations_ko.dart +++ b/lib/l10n/app_localizations_ko.dart @@ -147,6 +147,9 @@ class AppLocalizationsKo extends AppLocalizations { @override String get urlImage_possible => 'URL 이미지일 수 있습니다. 설정에서 활성화하세요.'; + @override + String get urlImage_disabledInAppSettings => 'Turned off in app settings'; + @override String get common_reboot => '재부팅'; @@ -1015,6 +1018,70 @@ class AppLocalizationsKo extends AppLocalizations { @override String get appSettings_maxMessageRetriesSubtitle => '메시지를 실패로 처리하기 전 시도 횟수'; + @override + String get appSettings_ipfsImageLinks => 'IPFS provider configuration'; + + @override + String get appSettings_ipfsImageLinksSubtitle => + 'Upload for url Images (or Files) via IPFS provider and default gateway to receive'; + + @override + String get appSettings_loadLinkImages => 'Load images from links'; + + @override + String get appSettings_loadLinkImagesSubtitle => + 'Show pictures from links in messages. Loading an image shares your IP address with the site that hosts it.'; + + @override + String get appSettings_showLinkImagesByDefault => + 'Show link images in all chats by default'; + + @override + String get appSettings_showLinkImagesByDefaultSubtitle => + 'Load link images in every chat unless you turned them off there. This shares your IP address with image hosts in every chat.'; + + @override + String get appSettings_publicIpfsGateway => 'Public gateway'; + + @override + String get appSettings_ipfsGatewayDeactivated => 'Deactivated'; + + @override + String get appSettings_ipfsGatewayIpfsIo => 'ipfs.io'; + + @override + String get appSettings_ipfsGatewayPinata => 'Pinata'; + + @override + String get appSettings_ipfsGatewayFilebase => 'Filebase'; + + @override + String get appSettings_ipfsGatewayCustom => 'Custom (Kubo)'; + + @override + String get appSettings_uploadIpfsProvider => 'Upload provider'; + + @override + String get appSettings_uploadIpfsGateway => 'Upload gateway'; + + @override + String get appSettings_uploadIpfsGatewaySubtitle => + 'Gateway to share Image or File as url-link. Leave empty to use ipfs: format, which may not be opened by other clients.'; + + @override + String get appSettings_uploadIpfsEndpoint => 'Upload endpoint'; + + @override + String get appSettings_uploadIpfsEndpointSubtitle => + 'The API endpoint used to upload files'; + + @override + String get appSettings_uploadIpfsApiKey => 'Upload API key'; + + @override + String get appSettings_ipfsImageLinksDescription => + 'Public gateway downloads ipfs: format images. Upload gateway is used to generate share links for uploaded url images or files.'; + @override String get appSettings_battery => '배터리'; @@ -1709,6 +1776,45 @@ class AppLocalizationsKo extends AppLocalizations { @override String get chat_sendImageLora => 'MeshCore를 통해 이미지 보내기'; + @override + String get chat_sendImageIpfs => 'Send image or file via IPFS'; + + @override + String chat_ipfsUploadFailed(String error) { + return 'IPFS upload failed: $error'; + } + + @override + String get chat_ipfsUploadNotConfigured => + 'Configure an IPFS upload provider in App Settings first.'; + + @override + String get chat_ipfsSelectedFileEmpty => 'The selected file is empty.'; + + @override + String get chat_ipfsEndpointInvalid => + 'The IPFS upload endpoint must be a full http:// or https:// address. Check it in App Settings.'; + + @override + String get chat_ipfsPinataTokenMissing => + 'Pinata needs an API key or JWT. Add it in App Settings.'; + + @override + String get chat_ipfsFilebaseTokenMissing => + 'Filebase needs an API token. Add it in App Settings.'; + + @override + String get chat_ipfsKuboPathInvalid => + 'The Kubo upload endpoint must end with /api/v0/add. Check it in App Settings.'; + + @override + String get chat_ipfsLinkNoRoom => + 'Not enough room for the image link. Shorten your message, then try again.'; + + @override + String get chat_ipfsLinkOverLimit => + 'Image link added, but the message is now too long. Shorten it before sending.'; + @override String get chat_imagePickFailed => '그 이미지를 열 수 없었어요.'; diff --git a/lib/l10n/app_localizations_nl.dart b/lib/l10n/app_localizations_nl.dart index f1436517..9c6301cb 100644 --- a/lib/l10n/app_localizations_nl.dart +++ b/lib/l10n/app_localizations_nl.dart @@ -151,6 +151,9 @@ class AppLocalizationsNl extends AppLocalizations { String get urlImage_possible => 'Mogelijke URL-afbeelding; schakel dit in bij Instellingen.'; + @override + String get urlImage_disabledInAppSettings => 'Turned off in app settings'; + @override String get common_reboot => 'Herstarten'; @@ -1064,6 +1067,70 @@ class AppLocalizationsNl extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Aantal pogingen om een bericht opnieuw te versturen voordat het als mislukt wordt gemarkeerd'; + @override + String get appSettings_ipfsImageLinks => 'IPFS provider configuration'; + + @override + String get appSettings_ipfsImageLinksSubtitle => + 'Upload for url Images (or Files) via IPFS provider and default gateway to receive'; + + @override + String get appSettings_loadLinkImages => 'Load images from links'; + + @override + String get appSettings_loadLinkImagesSubtitle => + 'Show pictures from links in messages. Loading an image shares your IP address with the site that hosts it.'; + + @override + String get appSettings_showLinkImagesByDefault => + 'Show link images in all chats by default'; + + @override + String get appSettings_showLinkImagesByDefaultSubtitle => + 'Load link images in every chat unless you turned them off there. This shares your IP address with image hosts in every chat.'; + + @override + String get appSettings_publicIpfsGateway => 'Public gateway'; + + @override + String get appSettings_ipfsGatewayDeactivated => 'Deactivated'; + + @override + String get appSettings_ipfsGatewayIpfsIo => 'ipfs.io'; + + @override + String get appSettings_ipfsGatewayPinata => 'Pinata'; + + @override + String get appSettings_ipfsGatewayFilebase => 'Filebase'; + + @override + String get appSettings_ipfsGatewayCustom => 'Custom (Kubo)'; + + @override + String get appSettings_uploadIpfsProvider => 'Upload provider'; + + @override + String get appSettings_uploadIpfsGateway => 'Upload gateway'; + + @override + String get appSettings_uploadIpfsGatewaySubtitle => + 'Gateway to share Image or File as url-link. Leave empty to use ipfs: format, which may not be opened by other clients.'; + + @override + String get appSettings_uploadIpfsEndpoint => 'Upload endpoint'; + + @override + String get appSettings_uploadIpfsEndpointSubtitle => + 'The API endpoint used to upload files'; + + @override + String get appSettings_uploadIpfsApiKey => 'Upload API key'; + + @override + String get appSettings_ipfsImageLinksDescription => + 'Public gateway downloads ipfs: format images. Upload gateway is used to generate share links for uploaded url images or files.'; + @override String get appSettings_battery => 'Batterij'; @@ -1777,6 +1844,45 @@ class AppLocalizationsNl extends AppLocalizations { String get chat_sendImageLora => 'Afbeelding in lage resolutie via radio verzenden'; + @override + String get chat_sendImageIpfs => 'Send image or file via IPFS'; + + @override + String chat_ipfsUploadFailed(String error) { + return 'IPFS upload failed: $error'; + } + + @override + String get chat_ipfsUploadNotConfigured => + 'Configure an IPFS upload provider in App Settings first.'; + + @override + String get chat_ipfsSelectedFileEmpty => 'The selected file is empty.'; + + @override + String get chat_ipfsEndpointInvalid => + 'The IPFS upload endpoint must be a full http:// or https:// address. Check it in App Settings.'; + + @override + String get chat_ipfsPinataTokenMissing => + 'Pinata needs an API key or JWT. Add it in App Settings.'; + + @override + String get chat_ipfsFilebaseTokenMissing => + 'Filebase needs an API token. Add it in App Settings.'; + + @override + String get chat_ipfsKuboPathInvalid => + 'The Kubo upload endpoint must end with /api/v0/add. Check it in App Settings.'; + + @override + String get chat_ipfsLinkNoRoom => + 'Not enough room for the image link. Shorten your message, then try again.'; + + @override + String get chat_ipfsLinkOverLimit => + 'Image link added, but the message is now too long. Shorten it before sending.'; + @override String get chat_imagePickFailed => 'Kon die afbeelding niet openen'; diff --git a/lib/l10n/app_localizations_pl.dart b/lib/l10n/app_localizations_pl.dart index 201f07a1..88abdc15 100644 --- a/lib/l10n/app_localizations_pl.dart +++ b/lib/l10n/app_localizations_pl.dart @@ -152,6 +152,9 @@ class AppLocalizationsPl extends AppLocalizations { String get urlImage_possible => 'Możliwy obraz z URL; włącz go w Ustawieniach.'; + @override + String get urlImage_disabledInAppSettings => 'Turned off in app settings'; + @override String get common_reboot => 'Uruchom ponownie'; @@ -1080,6 +1083,70 @@ class AppLocalizationsPl extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Liczba prób ponownego wysłania wiadomości przed oznaczaniem jej jako nieudanej'; + @override + String get appSettings_ipfsImageLinks => 'IPFS provider configuration'; + + @override + String get appSettings_ipfsImageLinksSubtitle => + 'Upload for url Images (or Files) via IPFS provider and default gateway to receive'; + + @override + String get appSettings_loadLinkImages => 'Load images from links'; + + @override + String get appSettings_loadLinkImagesSubtitle => + 'Show pictures from links in messages. Loading an image shares your IP address with the site that hosts it.'; + + @override + String get appSettings_showLinkImagesByDefault => + 'Show link images in all chats by default'; + + @override + String get appSettings_showLinkImagesByDefaultSubtitle => + 'Load link images in every chat unless you turned them off there. This shares your IP address with image hosts in every chat.'; + + @override + String get appSettings_publicIpfsGateway => 'Public gateway'; + + @override + String get appSettings_ipfsGatewayDeactivated => 'Deactivated'; + + @override + String get appSettings_ipfsGatewayIpfsIo => 'ipfs.io'; + + @override + String get appSettings_ipfsGatewayPinata => 'Pinata'; + + @override + String get appSettings_ipfsGatewayFilebase => 'Filebase'; + + @override + String get appSettings_ipfsGatewayCustom => 'Custom (Kubo)'; + + @override + String get appSettings_uploadIpfsProvider => 'Upload provider'; + + @override + String get appSettings_uploadIpfsGateway => 'Upload gateway'; + + @override + String get appSettings_uploadIpfsGatewaySubtitle => + 'Gateway to share Image or File as url-link. Leave empty to use ipfs: format, which may not be opened by other clients.'; + + @override + String get appSettings_uploadIpfsEndpoint => 'Upload endpoint'; + + @override + String get appSettings_uploadIpfsEndpointSubtitle => + 'The API endpoint used to upload files'; + + @override + String get appSettings_uploadIpfsApiKey => 'Upload API key'; + + @override + String get appSettings_ipfsImageLinksDescription => + 'Public gateway downloads ipfs: format images. Upload gateway is used to generate share links for uploaded url images or files.'; + @override String get appSettings_battery => 'Bateria'; @@ -1806,6 +1873,45 @@ class AppLocalizationsPl extends AppLocalizations { @override String get chat_sendImageLora => 'Wyślij obraz przez MeshCore'; + @override + String get chat_sendImageIpfs => 'Send image or file via IPFS'; + + @override + String chat_ipfsUploadFailed(String error) { + return 'IPFS upload failed: $error'; + } + + @override + String get chat_ipfsUploadNotConfigured => + 'Configure an IPFS upload provider in App Settings first.'; + + @override + String get chat_ipfsSelectedFileEmpty => 'The selected file is empty.'; + + @override + String get chat_ipfsEndpointInvalid => + 'The IPFS upload endpoint must be a full http:// or https:// address. Check it in App Settings.'; + + @override + String get chat_ipfsPinataTokenMissing => + 'Pinata needs an API key or JWT. Add it in App Settings.'; + + @override + String get chat_ipfsFilebaseTokenMissing => + 'Filebase needs an API token. Add it in App Settings.'; + + @override + String get chat_ipfsKuboPathInvalid => + 'The Kubo upload endpoint must end with /api/v0/add. Check it in App Settings.'; + + @override + String get chat_ipfsLinkNoRoom => + 'Not enough room for the image link. Shorten your message, then try again.'; + + @override + String get chat_ipfsLinkOverLimit => + 'Image link added, but the message is now too long. Shorten it before sending.'; + @override String get chat_imagePickFailed => 'Nie mogłem otworzyć tego obrazu'; diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart index 55cc36b5..b19c71ae 100644 --- a/lib/l10n/app_localizations_pt.dart +++ b/lib/l10n/app_localizations_pt.dart @@ -150,6 +150,9 @@ class AppLocalizationsPt extends AppLocalizations { String get urlImage_possible => 'Possível imagem de URL; ative-a em Configurações.'; + @override + String get urlImage_disabledInAppSettings => 'Turned off in app settings'; + @override String get common_reboot => 'Reiniciar'; @@ -1072,6 +1075,70 @@ class AppLocalizationsPt extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Número de tentativas de reenvio antes de classificar uma mensagem como falha.'; + @override + String get appSettings_ipfsImageLinks => 'IPFS provider configuration'; + + @override + String get appSettings_ipfsImageLinksSubtitle => + 'Upload for url Images (or Files) via IPFS provider and default gateway to receive'; + + @override + String get appSettings_loadLinkImages => 'Load images from links'; + + @override + String get appSettings_loadLinkImagesSubtitle => + 'Show pictures from links in messages. Loading an image shares your IP address with the site that hosts it.'; + + @override + String get appSettings_showLinkImagesByDefault => + 'Show link images in all chats by default'; + + @override + String get appSettings_showLinkImagesByDefaultSubtitle => + 'Load link images in every chat unless you turned them off there. This shares your IP address with image hosts in every chat.'; + + @override + String get appSettings_publicIpfsGateway => 'Public gateway'; + + @override + String get appSettings_ipfsGatewayDeactivated => 'Deactivated'; + + @override + String get appSettings_ipfsGatewayIpfsIo => 'ipfs.io'; + + @override + String get appSettings_ipfsGatewayPinata => 'Pinata'; + + @override + String get appSettings_ipfsGatewayFilebase => 'Filebase'; + + @override + String get appSettings_ipfsGatewayCustom => 'Custom (Kubo)'; + + @override + String get appSettings_uploadIpfsProvider => 'Upload provider'; + + @override + String get appSettings_uploadIpfsGateway => 'Upload gateway'; + + @override + String get appSettings_uploadIpfsGatewaySubtitle => + 'Gateway to share Image or File as url-link. Leave empty to use ipfs: format, which may not be opened by other clients.'; + + @override + String get appSettings_uploadIpfsEndpoint => 'Upload endpoint'; + + @override + String get appSettings_uploadIpfsEndpointSubtitle => + 'The API endpoint used to upload files'; + + @override + String get appSettings_uploadIpfsApiKey => 'Upload API key'; + + @override + String get appSettings_ipfsImageLinksDescription => + 'Public gateway downloads ipfs: format images. Upload gateway is used to generate share links for uploaded url images or files.'; + @override String get appSettings_battery => 'Bateria'; @@ -1787,6 +1854,45 @@ class AppLocalizationsPt extends AppLocalizations { @override String get chat_sendImageLora => 'Enviar imagem via MeshCore'; + @override + String get chat_sendImageIpfs => 'Send image or file via IPFS'; + + @override + String chat_ipfsUploadFailed(String error) { + return 'IPFS upload failed: $error'; + } + + @override + String get chat_ipfsUploadNotConfigured => + 'Configure an IPFS upload provider in App Settings first.'; + + @override + String get chat_ipfsSelectedFileEmpty => 'The selected file is empty.'; + + @override + String get chat_ipfsEndpointInvalid => + 'The IPFS upload endpoint must be a full http:// or https:// address. Check it in App Settings.'; + + @override + String get chat_ipfsPinataTokenMissing => + 'Pinata needs an API key or JWT. Add it in App Settings.'; + + @override + String get chat_ipfsFilebaseTokenMissing => + 'Filebase needs an API token. Add it in App Settings.'; + + @override + String get chat_ipfsKuboPathInvalid => + 'The Kubo upload endpoint must end with /api/v0/add. Check it in App Settings.'; + + @override + String get chat_ipfsLinkNoRoom => + 'Not enough room for the image link. Shorten your message, then try again.'; + + @override + String get chat_ipfsLinkOverLimit => + 'Image link added, but the message is now too long. Shorten it before sending.'; + @override String get chat_imagePickFailed => 'Não consegui abrir essa imagem'; diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart index b19f25b9..166e17a6 100644 --- a/lib/l10n/app_localizations_ru.dart +++ b/lib/l10n/app_localizations_ru.dart @@ -150,6 +150,9 @@ class AppLocalizationsRu extends AppLocalizations { String get urlImage_possible => 'Возможно изображение по URL; включите это в настройках.'; + @override + String get urlImage_disabledInAppSettings => 'Turned off in app settings'; + @override String get common_reboot => 'Перезагрузить'; @@ -1077,6 +1080,70 @@ class AppLocalizationsRu extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Количество попыток повторной отправки сообщения перед тем, как пометить его как неудачное.'; + @override + String get appSettings_ipfsImageLinks => 'IPFS provider configuration'; + + @override + String get appSettings_ipfsImageLinksSubtitle => + 'Upload for url Images (or Files) via IPFS provider and default gateway to receive'; + + @override + String get appSettings_loadLinkImages => 'Load images from links'; + + @override + String get appSettings_loadLinkImagesSubtitle => + 'Show pictures from links in messages. Loading an image shares your IP address with the site that hosts it.'; + + @override + String get appSettings_showLinkImagesByDefault => + 'Show link images in all chats by default'; + + @override + String get appSettings_showLinkImagesByDefaultSubtitle => + 'Load link images in every chat unless you turned them off there. This shares your IP address with image hosts in every chat.'; + + @override + String get appSettings_publicIpfsGateway => 'Public gateway'; + + @override + String get appSettings_ipfsGatewayDeactivated => 'Deactivated'; + + @override + String get appSettings_ipfsGatewayIpfsIo => 'ipfs.io'; + + @override + String get appSettings_ipfsGatewayPinata => 'Pinata'; + + @override + String get appSettings_ipfsGatewayFilebase => 'Filebase'; + + @override + String get appSettings_ipfsGatewayCustom => 'Custom (Kubo)'; + + @override + String get appSettings_uploadIpfsProvider => 'Upload provider'; + + @override + String get appSettings_uploadIpfsGateway => 'Upload gateway'; + + @override + String get appSettings_uploadIpfsGatewaySubtitle => + 'Gateway to share Image or File as url-link. Leave empty to use ipfs: format, which may not be opened by other clients.'; + + @override + String get appSettings_uploadIpfsEndpoint => 'Upload endpoint'; + + @override + String get appSettings_uploadIpfsEndpointSubtitle => + 'The API endpoint used to upload files'; + + @override + String get appSettings_uploadIpfsApiKey => 'Upload API key'; + + @override + String get appSettings_ipfsImageLinksDescription => + 'Public gateway downloads ipfs: format images. Upload gateway is used to generate share links for uploaded url images or files.'; + @override String get appSettings_battery => 'Батарея'; @@ -1791,6 +1858,45 @@ class AppLocalizationsRu extends AppLocalizations { @override String get chat_sendImageLora => 'Отправить изображение через MeshCore'; + @override + String get chat_sendImageIpfs => 'Send image or file via IPFS'; + + @override + String chat_ipfsUploadFailed(String error) { + return 'IPFS upload failed: $error'; + } + + @override + String get chat_ipfsUploadNotConfigured => + 'Configure an IPFS upload provider in App Settings first.'; + + @override + String get chat_ipfsSelectedFileEmpty => 'The selected file is empty.'; + + @override + String get chat_ipfsEndpointInvalid => + 'The IPFS upload endpoint must be a full http:// or https:// address. Check it in App Settings.'; + + @override + String get chat_ipfsPinataTokenMissing => + 'Pinata needs an API key or JWT. Add it in App Settings.'; + + @override + String get chat_ipfsFilebaseTokenMissing => + 'Filebase needs an API token. Add it in App Settings.'; + + @override + String get chat_ipfsKuboPathInvalid => + 'The Kubo upload endpoint must end with /api/v0/add. Check it in App Settings.'; + + @override + String get chat_ipfsLinkNoRoom => + 'Not enough room for the image link. Shorten your message, then try again.'; + + @override + String get chat_ipfsLinkOverLimit => + 'Image link added, but the message is now too long. Shorten it before sending.'; + @override String get chat_imagePickFailed => 'Не удалось открыть это изображение'; diff --git a/lib/l10n/app_localizations_sk.dart b/lib/l10n/app_localizations_sk.dart index cbb398e6..cbe7c713 100644 --- a/lib/l10n/app_localizations_sk.dart +++ b/lib/l10n/app_localizations_sk.dart @@ -151,6 +151,9 @@ class AppLocalizationsSk extends AppLocalizations { String get urlImage_possible => 'Možný obrázok z URL; povoľte ho v Nastaveniach.'; + @override + String get urlImage_disabledInAppSettings => 'Turned off in app settings'; + @override String get common_reboot => 'Restartovať'; @@ -1063,6 +1066,70 @@ class AppLocalizationsSk extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Počet pokusov o odošleť pred označením správy ako neúspešnej'; + @override + String get appSettings_ipfsImageLinks => 'IPFS provider configuration'; + + @override + String get appSettings_ipfsImageLinksSubtitle => + 'Upload for url Images (or Files) via IPFS provider and default gateway to receive'; + + @override + String get appSettings_loadLinkImages => 'Load images from links'; + + @override + String get appSettings_loadLinkImagesSubtitle => + 'Show pictures from links in messages. Loading an image shares your IP address with the site that hosts it.'; + + @override + String get appSettings_showLinkImagesByDefault => + 'Show link images in all chats by default'; + + @override + String get appSettings_showLinkImagesByDefaultSubtitle => + 'Load link images in every chat unless you turned them off there. This shares your IP address with image hosts in every chat.'; + + @override + String get appSettings_publicIpfsGateway => 'Public gateway'; + + @override + String get appSettings_ipfsGatewayDeactivated => 'Deactivated'; + + @override + String get appSettings_ipfsGatewayIpfsIo => 'ipfs.io'; + + @override + String get appSettings_ipfsGatewayPinata => 'Pinata'; + + @override + String get appSettings_ipfsGatewayFilebase => 'Filebase'; + + @override + String get appSettings_ipfsGatewayCustom => 'Custom (Kubo)'; + + @override + String get appSettings_uploadIpfsProvider => 'Upload provider'; + + @override + String get appSettings_uploadIpfsGateway => 'Upload gateway'; + + @override + String get appSettings_uploadIpfsGatewaySubtitle => + 'Gateway to share Image or File as url-link. Leave empty to use ipfs: format, which may not be opened by other clients.'; + + @override + String get appSettings_uploadIpfsEndpoint => 'Upload endpoint'; + + @override + String get appSettings_uploadIpfsEndpointSubtitle => + 'The API endpoint used to upload files'; + + @override + String get appSettings_uploadIpfsApiKey => 'Upload API key'; + + @override + String get appSettings_ipfsImageLinksDescription => + 'Public gateway downloads ipfs: format images. Upload gateway is used to generate share links for uploaded url images or files.'; + @override String get appSettings_battery => 'Batéria'; @@ -1779,6 +1846,45 @@ class AppLocalizationsSk extends AppLocalizations { @override String get chat_sendImageLora => 'Odoslať obrázok cez MeshCore'; + @override + String get chat_sendImageIpfs => 'Send image or file via IPFS'; + + @override + String chat_ipfsUploadFailed(String error) { + return 'IPFS upload failed: $error'; + } + + @override + String get chat_ipfsUploadNotConfigured => + 'Configure an IPFS upload provider in App Settings first.'; + + @override + String get chat_ipfsSelectedFileEmpty => 'The selected file is empty.'; + + @override + String get chat_ipfsEndpointInvalid => + 'The IPFS upload endpoint must be a full http:// or https:// address. Check it in App Settings.'; + + @override + String get chat_ipfsPinataTokenMissing => + 'Pinata needs an API key or JWT. Add it in App Settings.'; + + @override + String get chat_ipfsFilebaseTokenMissing => + 'Filebase needs an API token. Add it in App Settings.'; + + @override + String get chat_ipfsKuboPathInvalid => + 'The Kubo upload endpoint must end with /api/v0/add. Check it in App Settings.'; + + @override + String get chat_ipfsLinkNoRoom => + 'Not enough room for the image link. Shorten your message, then try again.'; + + @override + String get chat_ipfsLinkOverLimit => + 'Image link added, but the message is now too long. Shorten it before sending.'; + @override String get chat_imagePickFailed => 'Nesmiela jsem otvoriť tento obrázok'; diff --git a/lib/l10n/app_localizations_sl.dart b/lib/l10n/app_localizations_sl.dart index 5a9f9145..8744afcb 100644 --- a/lib/l10n/app_localizations_sl.dart +++ b/lib/l10n/app_localizations_sl.dart @@ -152,6 +152,9 @@ class AppLocalizationsSl extends AppLocalizations { String get urlImage_possible => 'Mogoča slika iz URL; omogočite jo v Nastavitvah.'; + @override + String get urlImage_disabledInAppSettings => 'Turned off in app settings'; + @override String get common_reboot => 'Ponoviti'; @@ -1065,6 +1068,70 @@ class AppLocalizationsSl extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Število poskusov ponovnega poslanja, preden se sporočilo označuje kot neuspešno'; + @override + String get appSettings_ipfsImageLinks => 'IPFS provider configuration'; + + @override + String get appSettings_ipfsImageLinksSubtitle => + 'Upload for url Images (or Files) via IPFS provider and default gateway to receive'; + + @override + String get appSettings_loadLinkImages => 'Load images from links'; + + @override + String get appSettings_loadLinkImagesSubtitle => + 'Show pictures from links in messages. Loading an image shares your IP address with the site that hosts it.'; + + @override + String get appSettings_showLinkImagesByDefault => + 'Show link images in all chats by default'; + + @override + String get appSettings_showLinkImagesByDefaultSubtitle => + 'Load link images in every chat unless you turned them off there. This shares your IP address with image hosts in every chat.'; + + @override + String get appSettings_publicIpfsGateway => 'Public gateway'; + + @override + String get appSettings_ipfsGatewayDeactivated => 'Deactivated'; + + @override + String get appSettings_ipfsGatewayIpfsIo => 'ipfs.io'; + + @override + String get appSettings_ipfsGatewayPinata => 'Pinata'; + + @override + String get appSettings_ipfsGatewayFilebase => 'Filebase'; + + @override + String get appSettings_ipfsGatewayCustom => 'Custom (Kubo)'; + + @override + String get appSettings_uploadIpfsProvider => 'Upload provider'; + + @override + String get appSettings_uploadIpfsGateway => 'Upload gateway'; + + @override + String get appSettings_uploadIpfsGatewaySubtitle => + 'Gateway to share Image or File as url-link. Leave empty to use ipfs: format, which may not be opened by other clients.'; + + @override + String get appSettings_uploadIpfsEndpoint => 'Upload endpoint'; + + @override + String get appSettings_uploadIpfsEndpointSubtitle => + 'The API endpoint used to upload files'; + + @override + String get appSettings_uploadIpfsApiKey => 'Upload API key'; + + @override + String get appSettings_ipfsImageLinksDescription => + 'Public gateway downloads ipfs: format images. Upload gateway is used to generate share links for uploaded url images or files.'; + @override String get appSettings_battery => 'Baterija'; @@ -1778,6 +1845,45 @@ class AppLocalizationsSl extends AppLocalizations { @override String get chat_sendImageLora => 'Pošlji sliko prek MeshCore'; + @override + String get chat_sendImageIpfs => 'Send image or file via IPFS'; + + @override + String chat_ipfsUploadFailed(String error) { + return 'IPFS upload failed: $error'; + } + + @override + String get chat_ipfsUploadNotConfigured => + 'Configure an IPFS upload provider in App Settings first.'; + + @override + String get chat_ipfsSelectedFileEmpty => 'The selected file is empty.'; + + @override + String get chat_ipfsEndpointInvalid => + 'The IPFS upload endpoint must be a full http:// or https:// address. Check it in App Settings.'; + + @override + String get chat_ipfsPinataTokenMissing => + 'Pinata needs an API key or JWT. Add it in App Settings.'; + + @override + String get chat_ipfsFilebaseTokenMissing => + 'Filebase needs an API token. Add it in App Settings.'; + + @override + String get chat_ipfsKuboPathInvalid => + 'The Kubo upload endpoint must end with /api/v0/add. Check it in App Settings.'; + + @override + String get chat_ipfsLinkNoRoom => + 'Not enough room for the image link. Shorten your message, then try again.'; + + @override + String get chat_ipfsLinkOverLimit => + 'Image link added, but the message is now too long. Shorten it before sending.'; + @override String get chat_imagePickFailed => 'Nispeval sem tega ta slik'; diff --git a/lib/l10n/app_localizations_sv.dart b/lib/l10n/app_localizations_sv.dart index 9a493eb6..321b1cfe 100644 --- a/lib/l10n/app_localizations_sv.dart +++ b/lib/l10n/app_localizations_sv.dart @@ -150,6 +150,9 @@ class AppLocalizationsSv extends AppLocalizations { String get urlImage_possible => 'Möjlig URL-bild; aktivera den i Inställningar.'; + @override + String get urlImage_disabledInAppSettings => 'Turned off in app settings'; + @override String get common_reboot => 'Starta om'; @@ -1054,6 +1057,70 @@ class AppLocalizationsSv extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Antal försök att skicka om ett meddelande innan det markeras som misslyckat.'; + @override + String get appSettings_ipfsImageLinks => 'IPFS provider configuration'; + + @override + String get appSettings_ipfsImageLinksSubtitle => + 'Upload for url Images (or Files) via IPFS provider and default gateway to receive'; + + @override + String get appSettings_loadLinkImages => 'Load images from links'; + + @override + String get appSettings_loadLinkImagesSubtitle => + 'Show pictures from links in messages. Loading an image shares your IP address with the site that hosts it.'; + + @override + String get appSettings_showLinkImagesByDefault => + 'Show link images in all chats by default'; + + @override + String get appSettings_showLinkImagesByDefaultSubtitle => + 'Load link images in every chat unless you turned them off there. This shares your IP address with image hosts in every chat.'; + + @override + String get appSettings_publicIpfsGateway => 'Public gateway'; + + @override + String get appSettings_ipfsGatewayDeactivated => 'Deactivated'; + + @override + String get appSettings_ipfsGatewayIpfsIo => 'ipfs.io'; + + @override + String get appSettings_ipfsGatewayPinata => 'Pinata'; + + @override + String get appSettings_ipfsGatewayFilebase => 'Filebase'; + + @override + String get appSettings_ipfsGatewayCustom => 'Custom (Kubo)'; + + @override + String get appSettings_uploadIpfsProvider => 'Upload provider'; + + @override + String get appSettings_uploadIpfsGateway => 'Upload gateway'; + + @override + String get appSettings_uploadIpfsGatewaySubtitle => + 'Gateway to share Image or File as url-link. Leave empty to use ipfs: format, which may not be opened by other clients.'; + + @override + String get appSettings_uploadIpfsEndpoint => 'Upload endpoint'; + + @override + String get appSettings_uploadIpfsEndpointSubtitle => + 'The API endpoint used to upload files'; + + @override + String get appSettings_uploadIpfsApiKey => 'Upload API key'; + + @override + String get appSettings_ipfsImageLinksDescription => + 'Public gateway downloads ipfs: format images. Upload gateway is used to generate share links for uploaded url images or files.'; + @override String get appSettings_battery => 'Batteri'; @@ -1766,6 +1833,45 @@ class AppLocalizationsSv extends AppLocalizations { @override String get chat_sendImageLora => 'Skicka bild via MeshCore'; + @override + String get chat_sendImageIpfs => 'Send image or file via IPFS'; + + @override + String chat_ipfsUploadFailed(String error) { + return 'IPFS upload failed: $error'; + } + + @override + String get chat_ipfsUploadNotConfigured => + 'Configure an IPFS upload provider in App Settings first.'; + + @override + String get chat_ipfsSelectedFileEmpty => 'The selected file is empty.'; + + @override + String get chat_ipfsEndpointInvalid => + 'The IPFS upload endpoint must be a full http:// or https:// address. Check it in App Settings.'; + + @override + String get chat_ipfsPinataTokenMissing => + 'Pinata needs an API key or JWT. Add it in App Settings.'; + + @override + String get chat_ipfsFilebaseTokenMissing => + 'Filebase needs an API token. Add it in App Settings.'; + + @override + String get chat_ipfsKuboPathInvalid => + 'The Kubo upload endpoint must end with /api/v0/add. Check it in App Settings.'; + + @override + String get chat_ipfsLinkNoRoom => + 'Not enough room for the image link. Shorten your message, then try again.'; + + @override + String get chat_ipfsLinkOverLimit => + 'Image link added, but the message is now too long. Shorten it before sending.'; + @override String get chat_imagePickFailed => 'Kunde inte öppna bilden'; diff --git a/lib/l10n/app_localizations_uk.dart b/lib/l10n/app_localizations_uk.dart index 8db9bb55..97352355 100644 --- a/lib/l10n/app_localizations_uk.dart +++ b/lib/l10n/app_localizations_uk.dart @@ -150,6 +150,9 @@ class AppLocalizationsUk extends AppLocalizations { String get urlImage_possible => 'Можливе зображення за URL; увімкніть це в Налаштуваннях.'; + @override + String get urlImage_disabledInAppSettings => 'Turned off in app settings'; + @override String get common_reboot => 'Перезавантажити'; @@ -1067,6 +1070,70 @@ class AppLocalizationsUk extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Кількість спроб повторного відправлення повідомлення перед тим, як позначити його як невдале'; + @override + String get appSettings_ipfsImageLinks => 'IPFS provider configuration'; + + @override + String get appSettings_ipfsImageLinksSubtitle => + 'Upload for url Images (or Files) via IPFS provider and default gateway to receive'; + + @override + String get appSettings_loadLinkImages => 'Load images from links'; + + @override + String get appSettings_loadLinkImagesSubtitle => + 'Show pictures from links in messages. Loading an image shares your IP address with the site that hosts it.'; + + @override + String get appSettings_showLinkImagesByDefault => + 'Show link images in all chats by default'; + + @override + String get appSettings_showLinkImagesByDefaultSubtitle => + 'Load link images in every chat unless you turned them off there. This shares your IP address with image hosts in every chat.'; + + @override + String get appSettings_publicIpfsGateway => 'Public gateway'; + + @override + String get appSettings_ipfsGatewayDeactivated => 'Deactivated'; + + @override + String get appSettings_ipfsGatewayIpfsIo => 'ipfs.io'; + + @override + String get appSettings_ipfsGatewayPinata => 'Pinata'; + + @override + String get appSettings_ipfsGatewayFilebase => 'Filebase'; + + @override + String get appSettings_ipfsGatewayCustom => 'Custom (Kubo)'; + + @override + String get appSettings_uploadIpfsProvider => 'Upload provider'; + + @override + String get appSettings_uploadIpfsGateway => 'Upload gateway'; + + @override + String get appSettings_uploadIpfsGatewaySubtitle => + 'Gateway to share Image or File as url-link. Leave empty to use ipfs: format, which may not be opened by other clients.'; + + @override + String get appSettings_uploadIpfsEndpoint => 'Upload endpoint'; + + @override + String get appSettings_uploadIpfsEndpointSubtitle => + 'The API endpoint used to upload files'; + + @override + String get appSettings_uploadIpfsApiKey => 'Upload API key'; + + @override + String get appSettings_ipfsImageLinksDescription => + 'Public gateway downloads ipfs: format images. Upload gateway is used to generate share links for uploaded url images or files.'; + @override String get appSettings_battery => 'Батарея'; @@ -1781,6 +1848,45 @@ class AppLocalizationsUk extends AppLocalizations { @override String get chat_sendImageLora => 'Надіслати зображення через MeshCore'; + @override + String get chat_sendImageIpfs => 'Send image or file via IPFS'; + + @override + String chat_ipfsUploadFailed(String error) { + return 'IPFS upload failed: $error'; + } + + @override + String get chat_ipfsUploadNotConfigured => + 'Configure an IPFS upload provider in App Settings first.'; + + @override + String get chat_ipfsSelectedFileEmpty => 'The selected file is empty.'; + + @override + String get chat_ipfsEndpointInvalid => + 'The IPFS upload endpoint must be a full http:// or https:// address. Check it in App Settings.'; + + @override + String get chat_ipfsPinataTokenMissing => + 'Pinata needs an API key or JWT. Add it in App Settings.'; + + @override + String get chat_ipfsFilebaseTokenMissing => + 'Filebase needs an API token. Add it in App Settings.'; + + @override + String get chat_ipfsKuboPathInvalid => + 'The Kubo upload endpoint must end with /api/v0/add. Check it in App Settings.'; + + @override + String get chat_ipfsLinkNoRoom => + 'Not enough room for the image link. Shorten your message, then try again.'; + + @override + String get chat_ipfsLinkOverLimit => + 'Image link added, but the message is now too long. Shorten it before sending.'; + @override String get chat_imagePickFailed => 'Неможливо відкрити це изображення'; diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index bfb127d6..eafad225 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -146,6 +146,9 @@ class AppLocalizationsZh extends AppLocalizations { @override String get urlImage_possible => '可能是URL图片,请在设置中启用。'; + @override + String get urlImage_disabledInAppSettings => 'Turned off in app settings'; + @override String get common_reboot => '重启'; @@ -995,6 +998,70 @@ class AppLocalizationsZh extends AppLocalizations { @override String get appSettings_maxMessageRetriesSubtitle => '在将消息标记为失败之前,允许尝试的次数'; + @override + String get appSettings_ipfsImageLinks => 'IPFS provider configuration'; + + @override + String get appSettings_ipfsImageLinksSubtitle => + 'Upload for url Images (or Files) via IPFS provider and default gateway to receive'; + + @override + String get appSettings_loadLinkImages => 'Load images from links'; + + @override + String get appSettings_loadLinkImagesSubtitle => + 'Show pictures from links in messages. Loading an image shares your IP address with the site that hosts it.'; + + @override + String get appSettings_showLinkImagesByDefault => + 'Show link images in all chats by default'; + + @override + String get appSettings_showLinkImagesByDefaultSubtitle => + 'Load link images in every chat unless you turned them off there. This shares your IP address with image hosts in every chat.'; + + @override + String get appSettings_publicIpfsGateway => 'Public gateway'; + + @override + String get appSettings_ipfsGatewayDeactivated => 'Deactivated'; + + @override + String get appSettings_ipfsGatewayIpfsIo => 'ipfs.io'; + + @override + String get appSettings_ipfsGatewayPinata => 'Pinata'; + + @override + String get appSettings_ipfsGatewayFilebase => 'Filebase'; + + @override + String get appSettings_ipfsGatewayCustom => 'Custom (Kubo)'; + + @override + String get appSettings_uploadIpfsProvider => 'Upload provider'; + + @override + String get appSettings_uploadIpfsGateway => 'Upload gateway'; + + @override + String get appSettings_uploadIpfsGatewaySubtitle => + 'Gateway to share Image or File as url-link. Leave empty to use ipfs: format, which may not be opened by other clients.'; + + @override + String get appSettings_uploadIpfsEndpoint => 'Upload endpoint'; + + @override + String get appSettings_uploadIpfsEndpointSubtitle => + 'The API endpoint used to upload files'; + + @override + String get appSettings_uploadIpfsApiKey => 'Upload API key'; + + @override + String get appSettings_ipfsImageLinksDescription => + 'Public gateway downloads ipfs: format images. Upload gateway is used to generate share links for uploaded url images or files.'; + @override String get appSettings_battery => '电池'; @@ -1684,6 +1751,45 @@ class AppLocalizationsZh extends AppLocalizations { @override String get chat_sendImageLora => '通过 MeshCore 发送图片'; + @override + String get chat_sendImageIpfs => 'Send image or file via IPFS'; + + @override + String chat_ipfsUploadFailed(String error) { + return 'IPFS upload failed: $error'; + } + + @override + String get chat_ipfsUploadNotConfigured => + 'Configure an IPFS upload provider in App Settings first.'; + + @override + String get chat_ipfsSelectedFileEmpty => 'The selected file is empty.'; + + @override + String get chat_ipfsEndpointInvalid => + 'The IPFS upload endpoint must be a full http:// or https:// address. Check it in App Settings.'; + + @override + String get chat_ipfsPinataTokenMissing => + 'Pinata needs an API key or JWT. Add it in App Settings.'; + + @override + String get chat_ipfsFilebaseTokenMissing => + 'Filebase needs an API token. Add it in App Settings.'; + + @override + String get chat_ipfsKuboPathInvalid => + 'The Kubo upload endpoint must end with /api/v0/add. Check it in App Settings.'; + + @override + String get chat_ipfsLinkNoRoom => + 'Not enough room for the image link. Shorten your message, then try again.'; + + @override + String get chat_ipfsLinkOverLimit => + 'Image link added, but the message is now too long. Shorten it before sending.'; + @override String get chat_imagePickFailed => '无法打开该图片'; diff --git a/lib/main.dart b/lib/main.dart index 87456561..db10b0fb 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -12,6 +12,7 @@ import 'screens/chrome_required_screen.dart'; import 'utils/platform_info.dart'; import 'connector/meshcore_connector.dart'; +import 'helpers/message_url_image_helper.dart'; import 'models/image_codec_support.dart'; import 'screens/scanner_screen.dart'; import 'services/image_chunk_transport.dart'; @@ -136,6 +137,18 @@ void main() async { // Initialize notification service final notificationService = NotificationService(); + notificationService.setPublicIpfsGateway( + appSettingsService.settings.publicIpfsGateway, + ); + MessageUrlImageHelper.loadLinkImages.value = + appSettingsService.settings.loadLinkImages; + appSettingsService.addListener(() { + notificationService.setPublicIpfsGateway( + appSettingsService.settings.publicIpfsGateway, + ); + MessageUrlImageHelper.loadLinkImages.value = + appSettingsService.settings.loadLinkImages; + }); await notificationService.initialize(); await backgroundService.initialize(); backgroundService.setLanguageOverrideProvider( diff --git a/lib/models/app_settings.dart b/lib/models/app_settings.dart index f664f083..facc4fb5 100644 --- a/lib/models/app_settings.dart +++ b/lib/models/app_settings.dart @@ -3,6 +3,20 @@ import 'translation_support.dart'; enum UnitSystem { metric, imperial } +String normalizeIpfsGateway(String value) { + var gateway = value.trim(); + if (gateway.isEmpty) return gateway; + if (!gateway.startsWith('http://') && !gateway.startsWith('https://')) { + gateway = 'https://$gateway'; + } + gateway = gateway.replaceAll('{cid}', ''); + if (gateway.endsWith('/ipfs')) gateway = '$gateway/'; + if (!gateway.endsWith('/ipfs/')) { + gateway = '${gateway.endsWith('/') ? gateway : '$gateway/'}ipfs/'; + } + return gateway; +} + enum ChannelNotificationMode { all, mentionsOnly, muted } extension UnitSystemValue on UnitSystem { @@ -80,6 +94,7 @@ class Cyr2LatProfile { class AppSettings { static const Object _unset = Object(); static const String stadiaDemo = '51bd0381-4685-4666-bae8-48940f6d77c0'; + static const String defaultPublicIpfsGateway = 'https://ipfs.io/ipfs/'; final bool clearPathOnMaxRetry; final bool mapShowRepeaters; @@ -133,6 +148,16 @@ class AppSettings { final bool jumpToOldestUnread; final bool imageMessagesEnabled; + /// Master switch for fetching images behind links in messages. + final bool loadLinkImages; + + /// Chats with no saved link-image choice load link images when true. + final bool showLinkImagesByDefault; + final String publicIpfsGateway; + final String uploadIpfsGateway; + final String uploadIpfsEndpoint; + final String uploadIpfsApiKey; + /// Opt-in upload of header-only packet records to the network map. final bool networkMapUploadEnabled; @@ -188,6 +213,10 @@ class AppSettings { return apiKey; } + String get effectiveUploadIpfsGateway { + return uploadIpfsGateway.trim(); + } + bool get usesstadiaDemo => effectiveMapTileApiKey == stadiaDemo; Map get cyr2latCharMap { @@ -246,9 +275,15 @@ class AppSettings { this.tcpServerAddress = '', this.tcpServerPort = 0, this.jumpToOldestUnread = false, - this.imageMessagesEnabled = false, this.networkMapUploadEnabled = false, this.networkMapPromptShown = false, + this.loadLinkImages = true, + this.showLinkImagesByDefault = false, + this.publicIpfsGateway = defaultPublicIpfsGateway, + this.uploadIpfsGateway = '', + this.uploadIpfsEndpoint = '', + this.uploadIpfsApiKey = '', + this.imageMessagesEnabled = false, this.imageProcessAutomatically = false, this.imageCodecEnabled = false, this.imageCodecSelectedModelId, @@ -337,9 +372,15 @@ class AppSettings { 'tcp_server_address': tcpServerAddress, 'tcp_server_port': tcpServerPort, 'jump_to_oldest_unread': jumpToOldestUnread, - 'image_messages_enabled': imageMessagesEnabled, 'network_map_upload_enabled': networkMapUploadEnabled, 'network_map_prompt_shown': networkMapPromptShown, + 'load_link_images': loadLinkImages, + 'show_link_images_by_default': showLinkImagesByDefault, + 'public_ipfs_gateway': publicIpfsGateway, + 'upload_ipfs_gateway': uploadIpfsGateway, + 'upload_ipfs_endpoint': uploadIpfsEndpoint, + 'upload_ipfs_api_key': uploadIpfsApiKey, + 'image_messages_enabled': imageMessagesEnabled, 'image_process_automatically': imageProcessAutomatically, 'image_codec_enabled': imageCodecEnabled, 'image_codec_selected_model_id': imageCodecSelectedModelId, @@ -471,10 +512,18 @@ class AppSettings { tcpServerAddress: json['tcp_server_address'] as String? ?? '', tcpServerPort: json['tcp_server_port'] as int? ?? 0, jumpToOldestUnread: json['jump_to_oldest_unread'] as bool? ?? false, - imageMessagesEnabled: json['image_messages_enabled'] as bool? ?? false, networkMapUploadEnabled: json['network_map_upload_enabled'] as bool? ?? false, networkMapPromptShown: json['network_map_prompt_shown'] as bool? ?? false, + loadLinkImages: json['load_link_images'] as bool? ?? true, + showLinkImagesByDefault: + json['show_link_images_by_default'] as bool? ?? false, + publicIpfsGateway: + json['public_ipfs_gateway'] as String? ?? defaultPublicIpfsGateway, + uploadIpfsGateway: json['upload_ipfs_gateway'] as String? ?? '', + uploadIpfsEndpoint: json['upload_ipfs_endpoint'] as String? ?? '', + uploadIpfsApiKey: json['upload_ipfs_api_key'] as String? ?? '', + imageMessagesEnabled: json['image_messages_enabled'] as bool? ?? false, imageProcessAutomatically: json['image_process_automatically'] as bool? ?? false, imageCodecEnabled: json['image_codec_enabled'] as bool? ?? false, @@ -594,9 +643,15 @@ class AppSettings { String? tcpServerAddress, int? tcpServerPort, bool? jumpToOldestUnread, - bool? imageMessagesEnabled, bool? networkMapUploadEnabled, bool? networkMapPromptShown, + bool? loadLinkImages, + bool? showLinkImagesByDefault, + String? publicIpfsGateway, + String? uploadIpfsGateway, + String? uploadIpfsEndpoint, + String? uploadIpfsApiKey, + bool? imageMessagesEnabled, bool? imageProcessAutomatically, bool? imageCodecEnabled, Object? imageCodecSelectedModelId = _unset, @@ -682,11 +737,18 @@ class AppSettings { tcpServerAddress: tcpServerAddress ?? this.tcpServerAddress, tcpServerPort: tcpServerPort ?? this.tcpServerPort, jumpToOldestUnread: jumpToOldestUnread ?? this.jumpToOldestUnread, - imageMessagesEnabled: imageMessagesEnabled ?? this.imageMessagesEnabled, networkMapUploadEnabled: networkMapUploadEnabled ?? this.networkMapUploadEnabled, networkMapPromptShown: networkMapPromptShown ?? this.networkMapPromptShown, + loadLinkImages: loadLinkImages ?? this.loadLinkImages, + showLinkImagesByDefault: + showLinkImagesByDefault ?? this.showLinkImagesByDefault, + publicIpfsGateway: publicIpfsGateway ?? this.publicIpfsGateway, + uploadIpfsGateway: uploadIpfsGateway ?? this.uploadIpfsGateway, + uploadIpfsEndpoint: uploadIpfsEndpoint ?? this.uploadIpfsEndpoint, + uploadIpfsApiKey: uploadIpfsApiKey ?? this.uploadIpfsApiKey, + imageMessagesEnabled: imageMessagesEnabled ?? this.imageMessagesEnabled, imageProcessAutomatically: imageProcessAutomatically ?? this.imageProcessAutomatically, imageCodecEnabled: imageCodecEnabled ?? this.imageCodecEnabled, diff --git a/lib/screens/app_settings_screen.dart b/lib/screens/app_settings_screen.dart index 4516731c..75b556d4 100644 --- a/lib/screens/app_settings_screen.dart +++ b/lib/screens/app_settings_screen.dart @@ -685,6 +685,46 @@ class AppSettingsScreen extends StatelessWidget { ) { return Column( children: [ + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + secondary: const Icon(Icons.image_search_outlined, size: 24), + title: Text(context.l10n.appSettings_loadLinkImages), + subtitle: Text(context.l10n.appSettings_loadLinkImagesSubtitle), + value: settingsService.settings.loadLinkImages, + onChanged: settingsService.setLoadLinkImages, + ), + const Divider(height: 1, indent: 16), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + secondary: const Icon(Icons.collections_outlined, size: 24), + title: Text(context.l10n.appSettings_showLinkImagesByDefault), + subtitle: Text( + context.l10n.appSettings_showLinkImagesByDefaultSubtitle, + ), + value: settingsService.settings.showLinkImagesByDefault, + onChanged: settingsService.settings.loadLinkImages + ? settingsService.setShowLinkImagesByDefault + : null, + ), + const Divider(height: 1, indent: 16), + ListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + leading: const Icon(Icons.link_outlined, size: 20), + title: Text(context.l10n.appSettings_ipfsImageLinks), + subtitle: Text(context.l10n.appSettings_ipfsImageLinksSubtitle), + trailing: const Icon(Icons.chevron_right, size: 18), + onTap: () => _showIpfsImageLinksDialog(context, settingsService), + ), + const Divider(height: 1, indent: 16), _ScrollIntoViewOnce( enabled: focusImageMessages, child: SwitchListTile( @@ -707,7 +747,6 @@ class AppSettingsScreen extends StatelessWidget { ), ), if (settingsService.settings.imageMessagesEnabled) ...[ - const Divider(height: 1, indent: 16), SwitchListTile( contentPadding: const EdgeInsets.symmetric( horizontal: 16, @@ -735,6 +774,16 @@ class AppSettingsScreen extends StatelessWidget { } } + void _showIpfsImageLinksDialog( + BuildContext context, + AppSettingsService settingsService, + ) { + showDialog( + context: context, + builder: (_) => _IpfsImageLinksDialog(settingsService: settingsService), + ); + } + /// Model registry for image messages: the download entry point, the /// downloaded weights, and — when the build simply cannot run the codec — /// [ImageCodecService.unavailableReason] instead of a dead download button. @@ -1491,6 +1540,340 @@ class AppSettingsScreen extends StatelessWidget { } } +class _IpfsImageLinksDialog extends StatefulWidget { + const _IpfsImageLinksDialog({required this.settingsService}); + + final AppSettingsService settingsService; + + @override + State<_IpfsImageLinksDialog> createState() => _IpfsImageLinksDialogState(); +} + +class _IpfsImageLinksDialogState extends State<_IpfsImageLinksDialog> { + late final TextEditingController _publicController; + late final TextEditingController _uploadGatewayController; + late final TextEditingController _endpointController; + late final TextEditingController _apiKeyController; + final FocusNode _apiKeyFocus = FocusNode(); + late final String _currentApiKey; + late final String _maskedApiKey; + late String _selectedGateway; + late String _selectedUploadProvider; + bool _apiKeyChanged = false; + bool _apiKeyObscured = true; + + @override + void initState() { + super.initState(); + final settings = widget.settingsService.settings; + _publicController = TextEditingController( + text: normalizeIpfsGateway(settings.publicIpfsGateway), + ); + _uploadGatewayController = TextEditingController( + text: normalizeIpfsGateway(settings.uploadIpfsGateway), + ); + _endpointController = TextEditingController( + text: settings.uploadIpfsEndpoint, + ); + _currentApiKey = settings.uploadIpfsApiKey.trim(); + _maskedApiKey = _currentApiKey.isEmpty ? '' : _maskApiKey(_currentApiKey); + _apiKeyController = TextEditingController(text: _maskedApiKey); + _apiKeyFocus.addListener(_onApiKeyFocusChanged); + _selectedGateway = _gatewayPreset(_publicController.text); + _selectedUploadProvider = _uploadProvider( + _uploadGatewayController.text, + _endpointController.text, + _currentApiKey, + ); + } + + @override + void dispose() { + _publicController.dispose(); + _uploadGatewayController.dispose(); + _endpointController.dispose(); + _apiKeyController.dispose(); + _apiKeyFocus.dispose(); + super.dispose(); + } + + /// Swaps the masked key out while the field has focus (by tap, Tab or + /// keyboard) so typing never appends to the mask, and puts it back if the + /// user leaves without editing. + void _onApiKeyFocusChanged() { + if (_apiKeyChanged) return; + _apiKeyController.text = _apiKeyFocus.hasFocus ? '' : _maskedApiKey; + } + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + return AlertDialog( + title: Text(l10n.appSettings_ipfsImageLinks), + content: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text(l10n.appSettings_ipfsImageLinksDescription), + const SizedBox(height: 12), + DropdownButtonFormField( + initialValue: _selectedGateway, + isExpanded: true, + decoration: InputDecoration( + labelText: l10n.appSettings_publicIpfsGateway, + ), + items: [ + DropdownMenuItem( + value: 'deactivated', + child: Text(l10n.appSettings_ipfsGatewayDeactivated), + ), + DropdownMenuItem( + value: 'ipfsio', + child: Text(l10n.appSettings_ipfsGatewayIpfsIo), + ), + DropdownMenuItem( + value: 'pinata', + child: Text(l10n.appSettings_ipfsGatewayPinata), + ), + DropdownMenuItem( + value: 'filebase', + child: Text(l10n.appSettings_ipfsGatewayFilebase), + ), + DropdownMenuItem( + value: 'custom', + child: Text(l10n.appSettings_ipfsGatewayCustom), + ), + ], + onChanged: _selectGateway, + ), + const SizedBox(height: 10), + TextField( + controller: _publicController, + decoration: InputDecoration( + labelText: l10n.appSettings_publicIpfsGateway, + ), + keyboardType: TextInputType.url, + autocorrect: false, + onChanged: (_) { + if (_selectedGateway != 'custom') { + setState(() => _selectedGateway = 'custom'); + } + }, + ), + const Divider(height: 20), + DropdownButtonFormField( + initialValue: _selectedUploadProvider, + isExpanded: true, + decoration: InputDecoration( + labelText: l10n.appSettings_uploadIpfsProvider, + ), + items: [ + DropdownMenuItem( + value: 'pinata', + child: Text(l10n.appSettings_ipfsGatewayPinata), + ), + DropdownMenuItem( + value: 'filebase', + child: Text(l10n.appSettings_ipfsGatewayFilebase), + ), + DropdownMenuItem( + value: 'custom', + child: Text(l10n.appSettings_ipfsGatewayCustom), + ), + DropdownMenuItem( + value: 'deactivated', + child: Text(l10n.appSettings_ipfsGatewayDeactivated), + ), + ], + onChanged: _selectUploadProvider, + ), + const SizedBox(height: 10), + TextField( + controller: _uploadGatewayController, + decoration: InputDecoration( + labelText: l10n.appSettings_uploadIpfsGateway, + helperText: l10n.appSettings_uploadIpfsGatewaySubtitle, + helperMaxLines: 3, + ), + keyboardType: TextInputType.url, + autocorrect: false, + onChanged: (_) => _markCustomUploadProvider(), + ), + const SizedBox(height: 10), + TextField( + controller: _endpointController, + decoration: InputDecoration( + labelText: l10n.appSettings_uploadIpfsEndpoint, + helperText: l10n.appSettings_uploadIpfsEndpointSubtitle, + helperMaxLines: 3, + ), + keyboardType: TextInputType.url, + autocorrect: false, + onChanged: (_) => _markCustomUploadProvider(), + ), + const SizedBox(height: 10), + TextField( + controller: _apiKeyController, + focusNode: _apiKeyFocus, + decoration: InputDecoration( + labelText: l10n.appSettings_uploadIpfsApiKey, + suffixIcon: IconButton( + tooltip: _apiKeyObscured + ? l10n.appSettings_showApiKey + : l10n.appSettings_hideApiKey, + icon: Icon( + _apiKeyObscured + ? Icons.visibility_outlined + : Icons.visibility_off_outlined, + ), + onPressed: () => + setState(() => _apiKeyObscured = !_apiKeyObscured), + ), + ), + autocorrect: false, + enableSuggestions: false, + obscureText: _apiKeyObscured, + onChanged: (_) { + _apiKeyChanged = true; + _markCustomUploadProvider(); + }, + ), + ], + ), + ), + actions: [ + TextButton( + onPressed: () => Navigator.pop(context), + child: Text(l10n.common_cancel), + ), + TextButton(onPressed: _save, child: Text(l10n.common_save)), + ], + ); + } + + void _selectGateway(String? value) { + if (value == null) return; + setState(() { + _selectedGateway = value; + final preset = _gatewayValue(value); + if (preset != null) _publicController.text = preset; + }); + } + + void _selectUploadProvider(String? value) { + if (value == null) return; + setState(() { + _selectedUploadProvider = value; + final preset = _uploadPreset(value); + if (preset != null) { + _uploadGatewayController.text = preset.gateway; + _endpointController.text = preset.endpoint; + if (value == 'deactivated') _apiKeyController.clear(); + } + }); + } + + void _markCustomUploadProvider() { + if (_selectedUploadProvider != 'custom') { + setState(() => _selectedUploadProvider = 'custom'); + } + } + + Future _save() async { + final deactivated = _selectedUploadProvider == 'deactivated'; + final apiKey = _apiKeyController.text.trim(); + await widget.settingsService.setIpfsImageSettings( + publicGateway: _publicController.text, + uploadGateway: deactivated ? '' : _uploadGatewayController.text, + uploadEndpoint: deactivated ? '' : _endpointController.text, + uploadApiKey: deactivated + ? '' + : _apiKeyChanged && apiKey != _maskedApiKey + ? apiKey + : _currentApiKey, + ); + if (mounted) Navigator.pop(context); + } + + String _gatewayPreset(String value) { + if (value.isEmpty) return 'deactivated'; + if (value == AppSettings.defaultPublicIpfsGateway || + value == 'https://ipfs.io/ipfs') { + return 'ipfsio'; + } + if (value == 'https://gateway.pinata.cloud/ipfs/' || + value == 'https://gateway.pinata.cloud/ipfs') { + return 'pinata'; + } + if (value == 'https://ipfs.filebase.io/ipfs/' || + value == 'https://ipfs.filebase.io/ipfs') { + return 'filebase'; + } + return 'custom'; + } + + String? _gatewayValue(String preset) { + switch (preset) { + case 'deactivated': + return ''; + case 'ipfsio': + return AppSettings.defaultPublicIpfsGateway; + case 'pinata': + return 'https://gateway.pinata.cloud/ipfs/'; + case 'filebase': + return 'https://ipfs.filebase.io/ipfs/'; + case 'custom': + return 'http://127.0.0.1:8080/ipfs/'; + default: + return null; + } + } + + String _uploadProvider(String gateway, String endpoint, String apiKey) { + if (gateway.isEmpty && endpoint.isEmpty && apiKey.isEmpty) { + return 'deactivated'; + } + if (gateway == 'https://gateway.pinata.cloud/ipfs/' && + endpoint == 'https://api.pinata.cloud/pinning/pinFileToIPFS') { + return 'pinata'; + } + if (gateway == 'https://ipfs.filebase.io/ipfs/' && + endpoint == 'https://rpc.filebase.io/api/v0/add') { + return 'filebase'; + } + return 'custom'; + } + + ({String gateway, String endpoint})? _uploadPreset(String preset) { + switch (preset) { + case 'pinata': + return ( + gateway: 'https://gateway.pinata.cloud/ipfs/', + endpoint: 'https://api.pinata.cloud/pinning/pinFileToIPFS', + ); + case 'filebase': + return ( + gateway: 'https://ipfs.filebase.io/ipfs/', + endpoint: 'https://rpc.filebase.io/api/v0/add', + ); + case 'custom': + return ( + gateway: 'http://127.0.0.1:8080/ipfs/', + endpoint: 'http://127.0.0.1:5001/api/v0/add', + ); + case 'deactivated': + return (gateway: '', endpoint: ''); + default: + return null; + } + } + + String _maskApiKey(String value) { + if (value.length <= 8) return '********'; + return '${value.substring(0, 4)}...${value.substring(value.length - 4)}'; + } +} + /// Stadia API key editor. Owns (and disposes) its controller; the key is /// obscured by default with a visibility toggle. The field starts with the /// masked current key, and saving it unchanged keeps the current key. diff --git a/lib/screens/channel_chat_screen.dart b/lib/screens/channel_chat_screen.dart index 77a7a83e..06805668 100644 --- a/lib/screens/channel_chat_screen.dart +++ b/lib/screens/channel_chat_screen.dart @@ -18,6 +18,7 @@ import '../helpers/chat_scroll_controller.dart'; import '../connector/meshcore_protocol.dart'; import '../helpers/cyr2lat.dart'; import '../helpers/gif_helper.dart'; +import '../helpers/ipfs_link_attach_flow.dart'; import '../helpers/marker_message.dart'; import '../helpers/message_url_image_helper.dart'; import '../helpers/path_helper.dart'; @@ -41,7 +42,6 @@ import '../widgets/received_image_message.dart'; import '../widgets/channel_notification_mode_sheet.dart'; import '../widgets/chat_day_separator.dart'; import '../widgets/empty_state.dart'; - import '../widgets/chat_composer.dart'; import '../widgets/chat_send_pipeline.dart'; import '../widgets/chat_zoom_wrapper.dart'; @@ -618,6 +618,7 @@ class _ChannelChatScreenState extends State { bool urlImagesEnabled, ) { final settingsService = context.watch(); + final publicIpfsGateway = settingsService.settings.publicIpfsGateway; final enableTracing = settingsService.settings.enableMessageTracing; final regionOnHopsLine = settingsService.settings.regionOnHopsLine; final isOutgoing = message.isOutgoing; @@ -761,6 +762,7 @@ class _ChannelChatScreenState extends State { MessageUrlImageFutureBuilder( messageId: message.messageId, text: message.text, + publicGateway: publicIpfsGateway, builder: (context, snapshot) { final imageAttachment = snapshot.data; @@ -813,9 +815,10 @@ class _ChannelChatScreenState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (MessageUrlImageHelper.hasPotentialImageUrl( - message.text, - )) + if (settingsService.settings.loadLinkImages && + MessageUrlImageHelper.hasPotentialImageUrl( + message.text, + )) Padding( padding: const EdgeInsets.only(bottom: 4), child: Text( @@ -1310,6 +1313,23 @@ class _ChannelChatScreenState extends State { ); } + Future _sendImageViaIpfs() { + final connector = context.read(); + return attachIpfsLinkToDraft( + context: context, + controller: _textController, + focusNode: _textFieldFocusNode, + maxBytes: maxChannelMessageBytes(connector.selfName), + encodeOutbound: (text) { + final replyTo = _replyingToMessage; + return connector.prepareChannelOutboundText( + widget.channel.index, + replyTo == null ? text : '${_replyPrefix(replyTo)}$text', + ); + }, + ); + } + /// Takes no [BuildContext]: it uses the [State]'s own, so the `mounted` /// checks around each `await` are the ones that actually govern it. Future _showImageSendPreview() async { @@ -2029,8 +2049,10 @@ class _ChannelChatScreenState extends State { final showImageAction = context.select( (s) => s.settings.imageMessagesEnabled, ); + final showIpfsAction = context.select( + (s) => s.settings.uploadIpfsEndpoint.trim().isNotEmpty, + ); final replyTo = _replyingToMessage; - // A reply's prefix is sent too, so it counts against the limit. final replyPrefixBytes = replyTo == null ? 0 : utf8.encode(_replyPrefix(replyTo)).length; @@ -2070,6 +2092,12 @@ class _ChannelChatScreenState extends State { icon: Icons.gif_box, label: context.l10n.chat_sendGif, ), + if (showIpfsAction) + ChatComposerAction( + id: 'ipfs-image', + icon: Icons.cloud_upload_outlined, + label: context.l10n.chat_sendImageIpfs, + ), if (showImageAction) ChatComposerAction( id: 'meshcore-image', @@ -2092,6 +2120,8 @@ class _ChannelChatScreenState extends State { switch (action) { case 'gif': showChatGifPicker(context, _textController); + case 'ipfs-image': + _sendImageViaIpfs(); case 'meshcore-image': _showImageSendPreview(); case 'send-my-location': diff --git a/lib/screens/channels_screen.dart b/lib/screens/channels_screen.dart index 53d561ac..d4dab875 100644 --- a/lib/screens/channels_screen.dart +++ b/lib/screens/channels_screen.dart @@ -1649,7 +1649,11 @@ class _ChannelsScreenState extends State ); bool smazEnabled = connector.isChannelSmazEnabled(channel.index); bool cyr2latEnabled = connector.isChannelCyr2LatEnabled(channel.index); - bool urlImagesEnabled = connector.isChannelUrlImagesEnabled(channel.index); + final initialUrlImagesEnabled = connector.isChannelUrlImagesEnabled( + channel.index, + ); + bool urlImagesEnabled = initialUrlImagesEnabled; + final loadLinkImages = appSettingsService.settings.loadLinkImages; String? selectedCyr2LatProfileId = connector.getChannelCyr2LatProfileId( channel.index, ); @@ -1769,9 +1773,19 @@ class _ChannelsScreenState extends State SwitchListTile( contentPadding: EdgeInsets.zero, title: Text(sheetContext.l10n.urlImage_enable), + subtitle: loadLinkImages + ? null + : Text( + sheetContext + .l10n + .urlImage_disabledInAppSettings, + ), value: urlImagesEnabled, - onChanged: (value) => - setSheetState(() => urlImagesEnabled = value), + onChanged: loadLinkImages + ? (value) => setSheetState( + () => urlImagesEnabled = value, + ) + : null, ), const SizedBox(height: 24), ], @@ -1831,10 +1845,13 @@ class _ChannelsScreenState extends State channel.index, cyr2latEnabled, ); - await connector.setChannelUrlImagesEnabled( - channel.index, - urlImagesEnabled, - ); + if (urlImagesEnabled != + initialUrlImagesEnabled) { + await connector.setChannelUrlImagesEnabled( + channel.index, + urlImagesEnabled, + ); + } await connector.setChannelCyr2LatProfileId( channel.index, selectedCyr2LatProfileId, diff --git a/lib/screens/chat_screen.dart b/lib/screens/chat_screen.dart index 48b23801..43d30804 100644 --- a/lib/screens/chat_screen.dart +++ b/lib/screens/chat_screen.dart @@ -20,6 +20,7 @@ import '../widgets/message_status_icon.dart'; import '../widgets/empty_state.dart'; import '../helpers/chat_scroll_controller.dart'; import '../helpers/gif_helper.dart'; +import '../helpers/ipfs_link_attach_flow.dart'; import '../helpers/marker_message.dart'; import '../models/channel_message.dart'; import '../models/contact.dart'; @@ -521,26 +522,39 @@ class _ChatScreenState extends State { sendTooltip: context.l10n.chat_sendMessageTo( _resolveContact(connector).name, ), - // No image action here: the image wire format is GRP_DATA, a channel - // primitive with no DM equivalent (see the note at the top of this - // file). - actionsBuilder: () => [ - ChatComposerAction( - id: 'gif', - icon: Icons.gif_box, - label: context.l10n.chat_sendGif, - ), - ChatComposerAction( - id: 'send-my-location', - icon: Icons.my_location, - label: context.l10n.chat_shareMyLocation, - ), - ], + actionsBuilder: () { + final showIpfsAction = context + .read() + .settings + .uploadIpfsEndpoint + .trim() + .isNotEmpty; + return [ + ChatComposerAction( + id: 'gif', + icon: Icons.gif_box, + label: context.l10n.chat_sendGif, + ), + if (showIpfsAction) + ChatComposerAction( + id: 'ipfs-image', + icon: Icons.cloud_upload_outlined, + label: context.l10n.chat_sendImageIpfs, + ), + ChatComposerAction( + id: 'send-my-location', + icon: Icons.my_location, + label: context.l10n.chat_shareMyLocation, + ), + ]; + }, onAction: (action) { if (!mounted) return; switch (action) { case 'gif': showChatGifPicker(context, _textController); + case 'ipfs-image': + _sendImageViaIpfs(); case 'send-my-location': _shareMyLocation(context.read()); } @@ -548,6 +562,19 @@ class _ChatScreenState extends State { ); } + Future _sendImageViaIpfs() { + final connector = context.read(); + final contact = _resolveContact(connector); + return attachIpfsLinkToDraft( + context: context, + controller: _textController, + focusNode: _textFieldFocusNode, + maxBytes: maxContactMessageBytes(), + encodeOutbound: (text) => + connector.prepareContactOutboundText(contact, text), + ); + } + /// Shares the radio's own position as a map marker. Shares the text send /// guard and cooldown so it can't race or flood alongside typed messages. Future _shareMyLocation(MeshCoreConnector connector) { @@ -755,6 +782,10 @@ class _ChatScreenState extends State { bool urlImagesEnabled = connector.isContactUrlImagesEnabled( contact.publicKeyHex, ); + final loadLinkImages = context + .read() + .settings + .loadLinkImages; String? selectedCyr2LatProfileId = connector.getContactCyr2LatProfileId( contact.publicKeyHex, ); @@ -869,14 +900,19 @@ class _ChatScreenState extends State { SwitchListTile( contentPadding: EdgeInsets.zero, title: Text(context.l10n.urlImage_enable), + subtitle: loadLinkImages + ? null + : Text(context.l10n.urlImage_disabledInAppSettings), value: urlImagesEnabled, - onChanged: (value) { - connector.setContactUrlImagesEnabled( - contact.publicKeyHex, - value, - ); - setDialogState(() => urlImagesEnabled = value); - }, + onChanged: loadLinkImages + ? (value) { + connector.setContactUrlImagesEnabled( + contact.publicKeyHex, + value, + ); + setDialogState(() => urlImagesEnabled = value); + } + : null, ), const Divider(height: 8), SwitchListTile( @@ -1224,6 +1260,7 @@ class _MessageBubble extends StatelessWidget { final urlImagesEnabled = context.select( (connector) => connector.isContactUrlImagesEnabled(sourceId), ); + final publicIpfsGateway = settingsService.settings.publicIpfsGateway; final colors = MessageBubbleColors.of( scheme, @@ -1351,6 +1388,7 @@ class _MessageBubble extends StatelessWidget { MessageUrlImageFutureBuilder( messageId: message.messageId, text: message.text, + publicGateway: publicIpfsGateway, builder: (context, snapshot) { final imageAttachment = snapshot.data; @@ -1403,9 +1441,10 @@ class _MessageBubble extends StatelessWidget { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (MessageUrlImageHelper.hasPotentialImageUrl( - message.text, - )) + if (settingsService.settings.loadLinkImages && + MessageUrlImageHelper.hasPotentialImageUrl( + message.text, + )) Padding( padding: const EdgeInsets.only(bottom: 4), child: Text( diff --git a/lib/services/app_settings_service.dart b/lib/services/app_settings_service.dart index d5d4b433..2e9061d6 100644 --- a/lib/services/app_settings_service.dart +++ b/lib/services/app_settings_service.dart @@ -320,10 +320,6 @@ class AppSettingsService extends ChangeNotifier { await updateSettings(_settings.copyWith(jumpToOldestUnread: value)); } - Future setImageMessagesEnabled(bool value) async { - await updateSettings(_settings.copyWith(imageMessagesEnabled: value)); - } - Future setNetworkMapUploadEnabled(bool value) async { await updateSettings(_settings.copyWith(networkMapUploadEnabled: value)); } @@ -332,6 +328,36 @@ class AppSettingsService extends ChangeNotifier { await updateSettings(_settings.copyWith(networkMapPromptShown: value)); } + Future setLoadLinkImages(bool value) async { + await updateSettings(_settings.copyWith(loadLinkImages: value)); + } + + Future setShowLinkImagesByDefault(bool value) async { + await updateSettings(_settings.copyWith(showLinkImagesByDefault: value)); + } + + Future setIpfsImageSettings({ + required String publicGateway, + required String uploadGateway, + required String uploadEndpoint, + required String uploadApiKey, + }) async { + final normalizedPublicGateway = normalizeIpfsGateway(publicGateway); + final normalizedUploadGateway = normalizeIpfsGateway(uploadGateway); + await updateSettings( + _settings.copyWith( + publicIpfsGateway: normalizedPublicGateway, + uploadIpfsGateway: normalizedUploadGateway, + uploadIpfsEndpoint: uploadEndpoint.trim(), + uploadIpfsApiKey: uploadApiKey.trim(), + ), + ); + } + + Future setImageMessagesEnabled(bool value) async { + await updateSettings(_settings.copyWith(imageMessagesEnabled: value)); + } + /// See [AppSettings.imageProcessAutomatically]. `main.dart` mirrors this into /// `ReceivedImageStore.processAutomatically` on every settings change; the /// store applies it to future arrivals only, so flipping it does not diff --git a/lib/services/notification_service.dart b/lib/services/notification_service.dart index 56397c42..2277f99b 100644 --- a/lib/services/notification_service.dart +++ b/lib/services/notification_service.dart @@ -13,6 +13,7 @@ import '../helpers/marker_message.dart'; import '../helpers/message_url_image_helper.dart'; import '../helpers/reaction_helper.dart'; import '../l10n/app_localizations.dart'; +import '../models/app_settings.dart'; import '../storage/prefs_manager.dart'; import '../utils/platform_info.dart'; import 'notification_reply.dart'; @@ -29,6 +30,11 @@ class NotificationService { // Locale for localized notification strings Locale _locale = const Locale('en'); + String _publicIpfsGateway = AppSettings.defaultPublicIpfsGateway; + + void setPublicIpfsGateway(String gateway) { + _publicIpfsGateway = gateway.trim(); + } /// Set the locale for notification strings (call when app locale changes) void setLocale(Locale locale) { @@ -311,7 +317,10 @@ class NotificationService { }) async { if (!urlImagesEnabled) return null; - final imageUrl = await MessageUrlImageHelper.parseVerified(text); + final imageUrl = await MessageUrlImageHelper.parseVerified( + text, + publicGateway: _publicIpfsGateway, + ); if (imageUrl == null) return null; try { diff --git a/lib/storage/channel_settings_store.dart b/lib/storage/channel_settings_store.dart index c02e142e..be4986e7 100644 --- a/lib/storage/channel_settings_store.dart +++ b/lib/storage/channel_settings_store.dart @@ -60,14 +60,14 @@ class ChannelSettingsStore { await PrefsManager.instance.setBool(_cyr2LatKey(channelId), enabled); } - Future loadUrlImagesEnabled(String channelId) async { + Future loadUrlImagesEnabled(String channelId) async { if (publicKeyHex.isEmpty) { appLogger.warn( 'Public key hex is not set. Cannot load channel URL image settings.', ); - return false; + return null; } - return PrefsManager.instance.getBool(_urlImagesKey(channelId)) ?? false; + return PrefsManager.instance.getBool(_urlImagesKey(channelId)); } Future saveUrlImagesEnabled(String channelId, bool enabled) async { diff --git a/lib/storage/contact_settings_store.dart b/lib/storage/contact_settings_store.dart index 10ffaaee..49b1faa2 100644 --- a/lib/storage/contact_settings_store.dart +++ b/lib/storage/contact_settings_store.dart @@ -76,16 +76,16 @@ class ContactSettingsStore { await prefs.setBool(key, enabled); } - Future loadUrlImagesEnabled(String contactKeyHex) async { + Future loadUrlImagesEnabled(String contactKeyHex) async { if (publicKeyHex.isEmpty) { appLogger.warn( 'Public key hex is not set. Cannot load contact URL image settings.', ); - return false; + return null; } final prefs = PrefsManager.instance; final key = '$keyForUrlImages$contactKeyHex'; - return prefs.getBool(key) ?? false; + return prefs.getBool(key); } Future saveUrlImagesEnabled(String contactKeyHex, bool enabled) async { diff --git a/test/connector/channel_slot_map_test.dart b/test/connector/channel_slot_map_test.dart index 65097f67..d2f217ce 100644 --- a/test/connector/channel_slot_map_test.dart +++ b/test/connector/channel_slot_map_test.dart @@ -243,6 +243,40 @@ void main() { expect(_storedTexts(hikingId), isEmpty); }); + test('deleting a channel clears its history when the refresh cannot read ' + 'the slot', () async { + _connector.channelSyncTimeoutMs = 30; + var deleted = false; + final radio = _TestRadio( + swallow: (frame) { + if (frame[0] == cmdSetChannel && frame[1] == 1) deleted = true; + return deleted && frame[0] == cmdGetChannel && frame[1] == 1; + }, + ); + await _connect(radio); + await _waitFor(() => _texts(1).contains(_queuedHikingText)); + + await _connector.deleteChannel(1); + expect(_connector.channelIdForSlot(1), hikingId); + expect(_storedTexts(hikingId), isEmpty); + }); + + test( + 'deleting one of two slots with the same PSK keeps the history', + () async { + final radio = _TestRadio(); + await _connect( + radio, + seed: () => + radio.handle(buildSetChannelFrame(5, 'Hiking Twin', _psk(1))), + ); + await _waitFor(() => _texts(1).contains(_queuedHikingText)); + + await _connector.deleteChannel(1); + expect(_storedTexts(hikingId), contains(_queuedHikingText)); + }, + ); + test('a channel frame that arrives before the slot map is held, then filed ' 'by the confirmed map', () async { final radio = _TestRadio( diff --git a/test/connector/link_images_default_test.dart b/test/connector/link_images_default_test.dart new file mode 100644 index 00000000..3ec74ece --- /dev/null +++ b/test/connector/link_images_default_test.dart @@ -0,0 +1,64 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:meshcore_open/connector/meshcore_connector.dart'; +import 'package:meshcore_open/services/app_settings_service.dart'; +import 'package:meshcore_open/services/message_retry_service.dart'; +import 'package:meshcore_open/services/path_history_service.dart'; +import 'package:meshcore_open/services/storage_service.dart'; +import 'package:meshcore_open/storage/channel_settings_store.dart'; +import 'package:meshcore_open/storage/contact_settings_store.dart'; +import 'package:meshcore_open/storage/prefs_manager.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + + setUp(() async { + SharedPreferences.setMockInitialValues({}); + PrefsManager.reset(); + await PrefsManager.initialize(); + }); + + test('stores return null for chats that were never set', () async { + final channels = ChannelSettingsStore()..setPublicKeyHex = 'aabbccddeeff'; + final contacts = ContactSettingsStore()..setPublicKeyHex = 'aabbccddeeff'; + expect(await channels.loadUrlImagesEnabled('chan'), isNull); + expect(await contacts.loadUrlImagesEnabled('c1'), isNull); + + await channels.saveUrlImagesEnabled('chan', false); + await contacts.saveUrlImagesEnabled('c1', false); + expect(await channels.loadUrlImagesEnabled('chan'), isFalse); + expect(await contacts.loadUrlImagesEnabled('c1'), isFalse); + }); + + test('effective value is the per-chat choice, else the default', () async { + final settings = AppSettingsService(); + final connector = MeshCoreConnector(); + addTearDown(connector.dispose); + final retryService = MessageRetryService(); + addTearDown(retryService.dispose); + connector.initialize( + retryService: retryService, + pathHistoryService: PathHistoryService(StorageService()), + appSettingsService: settings, + ); + var notified = 0; + connector.addListener(() => notified++); + + expect(connector.isContactUrlImagesEnabled('c1'), isFalse); + expect(connector.isChannelUrlImagesEnabled(0), isFalse); + + await settings.setShowLinkImagesByDefault(true); + await Future.delayed(const Duration(milliseconds: 100)); + expect(notified, greaterThan(0)); + expect(connector.isContactUrlImagesEnabled('c1'), isTrue); + expect(connector.isChannelUrlImagesEnabled(0), isTrue); + + await connector.setContactUrlImagesEnabled('c2', false); + expect(connector.isContactUrlImagesEnabled('c2'), isFalse); + + await settings.setShowLinkImagesByDefault(false); + await connector.setContactUrlImagesEnabled('c3', true); + expect(connector.isContactUrlImagesEnabled('c1'), isFalse); + expect(connector.isContactUrlImagesEnabled('c3'), isTrue); + }); +} diff --git a/test/connector/tcp_auto_reconnect_test.dart b/test/connector/tcp_auto_reconnect_test.dart index 7a14297e..9d63ab17 100644 --- a/test/connector/tcp_auto_reconnect_test.dart +++ b/test/connector/tcp_auto_reconnect_test.dart @@ -12,11 +12,15 @@ import 'package:meshcore_open/services/usb_serial_frame_codec.dart'; import 'package:meshcore_open/storage/prefs_manager.dart'; import 'package:shared_preferences/shared_preferences.dart'; -Future _waitFor(bool Function() condition, {int seconds = 10}) async { +Future _waitFor( + bool Function() condition, { + int seconds = 10, + Duration pollInterval = const Duration(milliseconds: 25), +}) async { final end = DateTime.now().add(Duration(seconds: seconds)); while (!condition()) { if (DateTime.now().isAfter(end)) fail('Timed out waiting for condition'); - await Future.delayed(const Duration(milliseconds: 25)); + await Future.delayed(pollInterval); } } @@ -200,11 +204,22 @@ void main() { // The companion goes away entirely: attempts fail and are rescheduled. await companion.close(); await _waitFor( - () => _connector.state == MeshCoreConnectionState.disconnected, + () => + _connector.state == MeshCoreConnectionState.disconnected && + _connector.isAutoReconnectScheduled, + ); + await _waitFor( + () => !_connector.isAutoReconnectScheduled, + pollInterval: const Duration(milliseconds: 1), + ); + // The timer firing proves an attempt started; wait for its failure to + // finish and the next backoff to become active. + await _waitFor( + () => + _connector.state == MeshCoreConnectionState.disconnected && + _connector.isAutoReconnectScheduled, ); - await Future.delayed(const Duration(milliseconds: 1500)); expect(_connector.isTcpTransportConnected, isFalse); - expect(_connector.isAutoReconnectScheduled, isTrue); }, ); } diff --git a/test/helpers/ipfs_link_attach_flow_test.dart b/test/helpers/ipfs_link_attach_flow_test.dart new file mode 100644 index 00000000..2859752e --- /dev/null +++ b/test/helpers/ipfs_link_attach_flow_test.dart @@ -0,0 +1,100 @@ +import 'package:flutter/widgets.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:meshcore_open/helpers/ipfs_link_attach_flow.dart'; +import 'package:meshcore_open/helpers/ipfs_upload_helper.dart'; +import 'package:meshcore_open/l10n/app_localizations.dart'; + +void main() { + const url = 'ipfs://cid'; + String identity(String text) => text; + + group('composeIpfsLinkDraft', () { + test('puts the link before an empty draft with a trailing space', () { + expect(composeIpfsLinkDraft(messageUrl: url, existingText: ''), '$url '); + }); + + test('keeps the whole draft after the link', () { + final draft = 'x' * 500; + expect( + composeIpfsLinkDraft(messageUrl: url, existingText: draft), + '$url\n$draft', + ); + }); + }); + + group('ipfsLinkDraftFits', () { + test('accepts a draft at the limit and rejects one byte over', () { + expect( + ipfsLinkDraftFits('$url\nhi', maxBytes: 13, encodeOutbound: identity), + isTrue, + ); + expect( + ipfsLinkDraftFits('$url\nhi', maxBytes: 12, encodeOutbound: identity), + isFalse, + ); + }); + + test('measures the encoded form, including a reply prefix', () { + String withReply(String text) => '@[Alice] $text'; + expect( + ipfsLinkDraftFits('$url\nhi', maxBytes: 13, encodeOutbound: withReply), + isFalse, + ); + expect( + ipfsLinkDraftFits('$url\nhi', maxBytes: 22, encodeOutbound: withReply), + isTrue, + ); + }); + + test('ignores the trailing space the send path trims', () { + expect( + ipfsLinkDraftFits( + '$url ', + maxBytes: url.length, + encodeOutbound: identity, + ), + isTrue, + ); + }); + }); + + group('IpfsUploadHelper.linkForCid', () { + test('uses ipfs:// without a gateway', () { + expect( + IpfsUploadHelper.linkForCid(uploadGateway: '', cid: 'abc'), + 'ipfs://abc', + ); + }); + + test('sample CID is CIDv1 base32 length', () { + expect(IpfsUploadHelper.sampleCid.length, 59); + }); + }); + + group('ipfsUploadErrorText', () { + final l10n = lookupAppLocalizations(const Locale('en')); + + test('gives every config reason its own localized message', () { + final texts = { + for (final reason in IpfsUploadConfigError.values) + reason: ipfsUploadErrorText(l10n, IpfsUploadConfigException(reason)), + }; + expect( + texts[IpfsUploadConfigError.emptyEndpoint], + l10n.chat_ipfsUploadNotConfigured, + ); + expect( + texts[IpfsUploadConfigError.kuboPathInvalid], + l10n.chat_ipfsKuboPathInvalid, + ); + expect(texts.values.toSet(), hasLength(texts.length)); + }); + + test('wraps other errors in the generic message without the prefix', () { + expect( + ipfsUploadErrorText(l10n, Exception('IPFS upload failed (500): x')), + l10n.chat_ipfsUploadFailed('IPFS upload failed (500): x'), + ); + }); + }); +} diff --git a/test/helpers/ipfs_upload_helper_test.dart b/test/helpers/ipfs_upload_helper_test.dart new file mode 100644 index 00000000..e9cb4cc4 --- /dev/null +++ b/test/helpers/ipfs_upload_helper_test.dart @@ -0,0 +1,190 @@ +import 'dart:typed_data'; + +import 'package:flutter_test/flutter_test.dart'; +import 'package:http/http.dart' as http; +import 'package:http/testing.dart'; +import 'package:meshcore_open/helpers/ipfs_upload_helper.dart'; + +void main() { + group('IpfsUploadHelper', () { + tearDown(() => IpfsUploadHelper.httpClient = null); + + test('does not upload when the upload endpoint is empty', () async { + var requestCount = 0; + IpfsUploadHelper.httpClient = MockClient((request) async { + requestCount++; + return http.Response('{}', 200); + }); + + await expectLater( + IpfsUploadHelper.uploadImage( + bytes: Uint8List.fromList([1, 2, 3]), + fileName: 'image.png', + mimeType: 'image/png', + uploadEndpoint: '', + uploadApiKey: '', + ), + throwsException, + ); + expect(requestCount, 0); + }); + + for (final endpoint in [ + 'not a url', + 'ftp://host/api/v0/add', + 'https://host/ipfs-upload', + 'https://uploads.example.com/v1/files', + ]) { + test('rejects $endpoint before uploading', () async { + var requestCount = 0; + IpfsUploadHelper.httpClient = MockClient((request) async { + requestCount++; + return http.Response('{"Hash":"bafytest"}', 200); + }); + + await expectLater( + IpfsUploadHelper.uploadImage( + bytes: Uint8List.fromList([1, 2, 3]), + fileName: 'image.png', + mimeType: 'image/png', + uploadEndpoint: endpoint, + uploadApiKey: 'token', + ), + throwsA(isA()), + ); + expect(requestCount, 0); + }); + } + + test('copies to MFS through a proxied Kubo endpoint', () async { + final urls = []; + IpfsUploadHelper.httpClient = MockClient((request) async { + urls.add(request.url); + return http.Response('{"Hash":"bafytest"}', 200); + }); + + final message = await IpfsUploadHelper.uploadImage( + bytes: Uint8List.fromList([1, 2, 3]), + fileName: 'image.png', + mimeType: 'image/png', + uploadEndpoint: 'https://host/ipfs-upload/api/v0/add', + uploadApiKey: '', + ); + + expect(message, 'ipfs://bafytest'); + expect(urls.map((url) => url.path), [ + '/ipfs-upload/api/v0/add', + '/ipfs-upload/api/v0/files/cp', + ]); + expect(urls.last.queryParametersAll['arg'], [ + '/ipfs/bafytest', + '/meshcore_uploads/bafytest-image.png', + ]); + }); + + test( + 'uploads and returns an ipfs scheme when upload gateway is empty', + () async { + final requests = []; + IpfsUploadHelper.httpClient = MockClient((request) async { + requests.add(request); + expect(request.method, 'POST'); + return http.Response( + '{"Hash":"bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly"}', + 200, + ); + }); + + final message = await IpfsUploadHelper.uploadImage( + bytes: Uint8List.fromList([1, 2, 3]), + fileName: 'image.png', + mimeType: 'image/png', + uploadEndpoint: 'http://127.0.0.1:5001/api/v0/add', + uploadApiKey: '', + ); + + expect( + message, + 'ipfs://bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly', + ); + expect(requests.first.url.path, '/api/v0/add'); + expect(requests.first.url.queryParameters, { + 'cid-version': '1', + 'pin': 'true', + }); + }, + ); + + test( + 're-sharing a file already in Kubo MFS still returns the link', + () async { + final paths = []; + IpfsUploadHelper.httpClient = MockClient((request) async { + paths.add(request.url.path); + if (request.url.path.endsWith('/files/cp')) { + return http.Response( + '{"Message":"cp: cannot put node in path /meshcore_uploads/bafytest-image.png: directory already has entry by that name","Code":0,"Type":"error"}', + 500, + ); + } + return http.Response('{"Hash":"bafytest"}', 200); + }); + + final message = await IpfsUploadHelper.uploadImage( + bytes: Uint8List.fromList([1, 2, 3]), + fileName: 'image.png', + mimeType: 'image/png', + uploadEndpoint: 'http://127.0.0.1:5001/api/v0/add', + uploadApiKey: '', + ); + + expect(message, 'ipfs://bafytest'); + expect(paths, ['/api/v0/add', '/api/v0/files/cp']); + }, + ); + + test('other Kubo MFS errors still fail the upload', () async { + IpfsUploadHelper.httpClient = MockClient((request) async { + if (request.url.path.endsWith('/files/cp')) { + return http.Response('{"Message":"permission denied"}', 500); + } + return http.Response('{"Hash":"bafytest"}', 200); + }); + + await expectLater( + IpfsUploadHelper.uploadImage( + bytes: Uint8List.fromList([1, 2, 3]), + fileName: 'image.png', + mimeType: 'image/png', + uploadEndpoint: 'http://127.0.0.1:5001/api/v0/add', + uploadApiKey: '', + ), + throwsException, + ); + }); + + test('sends the Pinata request to the endpoint unchanged', () async { + late http.BaseRequest upload; + IpfsUploadHelper.httpClient = MockClient((request) async { + upload = request; + return http.Response('{"IpfsHash":"bafytest"}', 200); + }); + + final message = await IpfsUploadHelper.uploadImage( + bytes: Uint8List.fromList([1, 2, 3]), + fileName: 'image.png', + mimeType: 'image/png', + uploadEndpoint: 'https://api.pinata.cloud/pinning/pinFileToIPFS', + uploadApiKey: 'jwt', + uploadGateway: 'https://gateway.example.com', + ); + + expect( + upload.url.toString(), + 'https://api.pinata.cloud/pinning/pinFileToIPFS', + ); + expect(upload.headers['Authorization'], 'Bearer jwt'); + expect(message, 'https://gateway.example.com/ipfs/bafytest'); + }); + }); +} diff --git a/test/helpers/message_url_image_helper_test.dart b/test/helpers/message_url_image_helper_test.dart index 11e1b022..a8a21a2e 100644 --- a/test/helpers/message_url_image_helper_test.dart +++ b/test/helpers/message_url_image_helper_test.dart @@ -5,7 +5,10 @@ import 'package:meshcore_open/helpers/message_url_image_helper.dart'; void main() { group('MessageUrlImageHelper', () { - tearDown(() => MessageUrlImageHelper.httpClient = null); + tearDown(() { + MessageUrlImageHelper.httpClient = null; + MessageUrlImageHelper.loadLinkImages.value = true; + }); void mockPyxPage(String id) { MessageUrlImageHelper.httpClient = MockClient((request) async { @@ -48,29 +51,45 @@ void main() { ); }); - test('parses direct ipfs cid urls', () async { - final attachment = await MessageUrlImageHelper.parse( - 'my picture: ipfs://bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly text', - ); - - expect(attachment, isNotNull); + test('resolves ipfs cid links with the default ipfs.io gateway', () async { expect( - attachment, + await MessageUrlImageHelper.parse( + 'my picture: ipfs://bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly text', + ), + 'https://ipfs.io/ipfs/bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly', + ); + expect( + await MessageUrlImageHelper.parse( + 'my picture: ipfs:bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly text', + ), 'https://ipfs.io/ipfs/bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly', ); }); - test('parses direct ipfs cid urls without double slashes', () async { + test('uses the configured public gateway for direct ipfs cid urls', () async { final attachment = await MessageUrlImageHelper.parse( - 'my picture: ipfs:bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly text', + 'ipfs://bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly', + publicGateway: 'https://gateway.example.com', ); expect( attachment, - 'https://ipfs.io/ipfs/bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly', + 'https://gateway.example.com/ipfs/bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly', ); }); + test( + 'does not resolve ipfs cid links when the download gateway is empty', + () async { + final attachment = await MessageUrlImageHelper.parse( + 'ipfs://bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly', + publicGateway: '', + ); + + expect(attachment, isNull); + }, + ); + test('parses http image urls', () async { final attachment = await MessageUrlImageHelper.parse( 'see this image https://example.com/picture.png?size=large additional text', @@ -104,5 +123,26 @@ void main() { expect(attachment, isNull); }); + + test('fetches nothing when loading link images is off', () async { + MessageUrlImageHelper.loadLinkImages.value = false; + MessageUrlImageHelper.httpClient = MockClient((request) async { + fail('Unexpected request to ${request.url}'); + }); + + for (final text in [ + 'https://pyx.li/?i=RzmdkTsE', + 'https://ibb.co/abc123', + 'ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi', + 'https://example.com/photo.png', + ]) { + expect(await MessageUrlImageHelper.parse(text), isNull); + expect(await MessageUrlImageHelper.parseVerified(text), isNull); + expect( + await MessageUrlImageHelper.parseVerifiedForMessage('m1', text), + isNull, + ); + } + }); }); } diff --git a/test/models/model_changes_test.dart b/test/models/model_changes_test.dart index b2c8d698..874a5d8b 100644 --- a/test/models/model_changes_test.dart +++ b/test/models/model_changes_test.dart @@ -443,6 +443,53 @@ void main() { expect(settings.evictDiscoveredContactsEnabled, isFalse); }); + test('load link images defaults on and round-trips through JSON', () { + expect(AppSettings().loadLinkImages, isTrue); + expect(AppSettings.fromJson({}).loadLinkImages, isTrue); + final saved = AppSettings(loadLinkImages: false).toJson(); + expect(AppSettings.fromJson(saved).loadLinkImages, isFalse); + }); + + test('show link images by default is off and round-trips', () { + expect(AppSettings().showLinkImagesByDefault, isFalse); + expect(AppSettings.fromJson({}).showLinkImagesByDefault, isFalse); + final saved = AppSettings(showLinkImagesByDefault: true).toJson(); + expect(AppSettings.fromJson(saved).showLinkImagesByDefault, isTrue); + }); + + test('public IPFS gateway defaults to ipfs.io when never set', () { + expect( + AppSettings.fromJson({}).publicIpfsGateway, + 'https://ipfs.io/ipfs/', + ); + expect(AppSettings().publicIpfsGateway, 'https://ipfs.io/ipfs/'); + }); + + test('public IPFS gateway keeps a saved empty value as deactivated', () { + final saved = AppSettings(publicIpfsGateway: '').toJson(); + expect(AppSettings.fromJson(saved).publicIpfsGateway, isEmpty); + }); + + test('public IPFS gateway keeps saved ipfs.io and dweb.link values', () { + for (final gateway in [ + 'https://ipfs.io/ipfs/', + 'https://dweb.link/ipfs/', + 'https://gateway.example.com/ipfs/', + ]) { + final saved = AppSettings(publicIpfsGateway: gateway).toJson(); + expect(AppSettings.fromJson(saved).publicIpfsGateway, gateway); + } + }); + + test('empty upload gateway does not fall back to the download gateway', () { + final settings = AppSettings( + publicIpfsGateway: 'https://gateway.example.com/ipfs/', + uploadIpfsGateway: '', + ); + + expect(settings.effectiveUploadIpfsGateway, isEmpty); + }); + test( 'fromJson with missing new fields uses defaults (backward compat)', () { diff --git a/untranslated.json b/untranslated.json index ce6e3e47..2dac94ff 100644 --- a/untranslated.json +++ b/untranslated.json @@ -1,12 +1,39 @@ { "bg": [ + "urlImage_disabledInAppSettings", "settings_pathHashModeNotApplied", - "channels_notificationModeTooltip", - "notification_lowBatteryTitle", - "notification_lowBatteryBody" + "appSettings_ipfsImageLinks", + "appSettings_ipfsImageLinksSubtitle", + "appSettings_loadLinkImages", + "appSettings_loadLinkImagesSubtitle", + "appSettings_showLinkImagesByDefault", + "appSettings_showLinkImagesByDefaultSubtitle", + "appSettings_publicIpfsGateway", + "appSettings_ipfsGatewayDeactivated", + "appSettings_ipfsGatewayIpfsIo", + "appSettings_ipfsGatewayPinata", + "appSettings_ipfsGatewayFilebase", + "appSettings_ipfsGatewayCustom", + "appSettings_uploadIpfsProvider", + "appSettings_uploadIpfsGateway", + "appSettings_uploadIpfsGatewaySubtitle", + "appSettings_uploadIpfsEndpoint", + "appSettings_uploadIpfsEndpointSubtitle", + "appSettings_uploadIpfsApiKey", + "appSettings_ipfsImageLinksDescription", "contacts_removeAutoAddNote", "contacts_removeFailed", "channels_notificationModeTooltip", + "chat_sendImageIpfs", + "chat_ipfsUploadFailed", + "chat_ipfsUploadNotConfigured", + "chat_ipfsSelectedFileEmpty", + "chat_ipfsEndpointInvalid", + "chat_ipfsPinataTokenMissing", + "chat_ipfsFilebaseTokenMissing", + "chat_ipfsKuboPathInvalid", + "chat_ipfsLinkNoRoom", + "chat_ipfsLinkOverLimit", "map_pathTraceAddMoreHint", "map_pathTraceModeRoundTrip", "map_pathTraceModeRoundTripHint", @@ -29,13 +56,40 @@ ], "de": [ + "urlImage_disabledInAppSettings", "settings_pathHashModeNotApplied", - "channels_notificationModeTooltip", - "notification_lowBatteryTitle", - "notification_lowBatteryBody" + "appSettings_ipfsImageLinks", + "appSettings_ipfsImageLinksSubtitle", + "appSettings_loadLinkImages", + "appSettings_loadLinkImagesSubtitle", + "appSettings_showLinkImagesByDefault", + "appSettings_showLinkImagesByDefaultSubtitle", + "appSettings_publicIpfsGateway", + "appSettings_ipfsGatewayDeactivated", + "appSettings_ipfsGatewayIpfsIo", + "appSettings_ipfsGatewayPinata", + "appSettings_ipfsGatewayFilebase", + "appSettings_ipfsGatewayCustom", + "appSettings_uploadIpfsProvider", + "appSettings_uploadIpfsGateway", + "appSettings_uploadIpfsGatewaySubtitle", + "appSettings_uploadIpfsEndpoint", + "appSettings_uploadIpfsEndpointSubtitle", + "appSettings_uploadIpfsApiKey", + "appSettings_ipfsImageLinksDescription", "contacts_removeAutoAddNote", "contacts_removeFailed", "channels_notificationModeTooltip", + "chat_sendImageIpfs", + "chat_ipfsUploadFailed", + "chat_ipfsUploadNotConfigured", + "chat_ipfsSelectedFileEmpty", + "chat_ipfsEndpointInvalid", + "chat_ipfsPinataTokenMissing", + "chat_ipfsFilebaseTokenMissing", + "chat_ipfsKuboPathInvalid", + "chat_ipfsLinkNoRoom", + "chat_ipfsLinkOverLimit", "map_pathTraceAddMoreHint", "map_pathTraceModeRoundTrip", "map_pathTraceModeRoundTripHint", @@ -58,13 +112,40 @@ ], "es": [ + "urlImage_disabledInAppSettings", "settings_pathHashModeNotApplied", - "channels_notificationModeTooltip", - "notification_lowBatteryTitle", - "notification_lowBatteryBody" + "appSettings_ipfsImageLinks", + "appSettings_ipfsImageLinksSubtitle", + "appSettings_loadLinkImages", + "appSettings_loadLinkImagesSubtitle", + "appSettings_showLinkImagesByDefault", + "appSettings_showLinkImagesByDefaultSubtitle", + "appSettings_publicIpfsGateway", + "appSettings_ipfsGatewayDeactivated", + "appSettings_ipfsGatewayIpfsIo", + "appSettings_ipfsGatewayPinata", + "appSettings_ipfsGatewayFilebase", + "appSettings_ipfsGatewayCustom", + "appSettings_uploadIpfsProvider", + "appSettings_uploadIpfsGateway", + "appSettings_uploadIpfsGatewaySubtitle", + "appSettings_uploadIpfsEndpoint", + "appSettings_uploadIpfsEndpointSubtitle", + "appSettings_uploadIpfsApiKey", + "appSettings_ipfsImageLinksDescription", "contacts_removeAutoAddNote", "contacts_removeFailed", "channels_notificationModeTooltip", + "chat_sendImageIpfs", + "chat_ipfsUploadFailed", + "chat_ipfsUploadNotConfigured", + "chat_ipfsSelectedFileEmpty", + "chat_ipfsEndpointInvalid", + "chat_ipfsPinataTokenMissing", + "chat_ipfsFilebaseTokenMissing", + "chat_ipfsKuboPathInvalid", + "chat_ipfsLinkNoRoom", + "chat_ipfsLinkOverLimit", "map_pathTraceAddMoreHint", "map_pathTraceModeRoundTrip", "map_pathTraceModeRoundTripHint", @@ -87,13 +168,40 @@ ], "fr": [ + "urlImage_disabledInAppSettings", "settings_pathHashModeNotApplied", - "channels_notificationModeTooltip", - "notification_lowBatteryTitle", - "notification_lowBatteryBody" + "appSettings_ipfsImageLinks", + "appSettings_ipfsImageLinksSubtitle", + "appSettings_loadLinkImages", + "appSettings_loadLinkImagesSubtitle", + "appSettings_showLinkImagesByDefault", + "appSettings_showLinkImagesByDefaultSubtitle", + "appSettings_publicIpfsGateway", + "appSettings_ipfsGatewayDeactivated", + "appSettings_ipfsGatewayIpfsIo", + "appSettings_ipfsGatewayPinata", + "appSettings_ipfsGatewayFilebase", + "appSettings_ipfsGatewayCustom", + "appSettings_uploadIpfsProvider", + "appSettings_uploadIpfsGateway", + "appSettings_uploadIpfsGatewaySubtitle", + "appSettings_uploadIpfsEndpoint", + "appSettings_uploadIpfsEndpointSubtitle", + "appSettings_uploadIpfsApiKey", + "appSettings_ipfsImageLinksDescription", "contacts_removeAutoAddNote", "contacts_removeFailed", "channels_notificationModeTooltip", + "chat_sendImageIpfs", + "chat_ipfsUploadFailed", + "chat_ipfsUploadNotConfigured", + "chat_ipfsSelectedFileEmpty", + "chat_ipfsEndpointInvalid", + "chat_ipfsPinataTokenMissing", + "chat_ipfsFilebaseTokenMissing", + "chat_ipfsKuboPathInvalid", + "chat_ipfsLinkNoRoom", + "chat_ipfsLinkOverLimit", "map_pathTraceAddMoreHint", "map_pathTraceModeRoundTrip", "map_pathTraceModeRoundTripHint", @@ -116,13 +224,40 @@ ], "hu": [ + "urlImage_disabledInAppSettings", "settings_pathHashModeNotApplied", - "channels_notificationModeTooltip", - "notification_lowBatteryTitle", - "notification_lowBatteryBody" + "appSettings_ipfsImageLinks", + "appSettings_ipfsImageLinksSubtitle", + "appSettings_loadLinkImages", + "appSettings_loadLinkImagesSubtitle", + "appSettings_showLinkImagesByDefault", + "appSettings_showLinkImagesByDefaultSubtitle", + "appSettings_publicIpfsGateway", + "appSettings_ipfsGatewayDeactivated", + "appSettings_ipfsGatewayIpfsIo", + "appSettings_ipfsGatewayPinata", + "appSettings_ipfsGatewayFilebase", + "appSettings_ipfsGatewayCustom", + "appSettings_uploadIpfsProvider", + "appSettings_uploadIpfsGateway", + "appSettings_uploadIpfsGatewaySubtitle", + "appSettings_uploadIpfsEndpoint", + "appSettings_uploadIpfsEndpointSubtitle", + "appSettings_uploadIpfsApiKey", + "appSettings_ipfsImageLinksDescription", "contacts_removeAutoAddNote", "contacts_removeFailed", "channels_notificationModeTooltip", + "chat_sendImageIpfs", + "chat_ipfsUploadFailed", + "chat_ipfsUploadNotConfigured", + "chat_ipfsSelectedFileEmpty", + "chat_ipfsEndpointInvalid", + "chat_ipfsPinataTokenMissing", + "chat_ipfsFilebaseTokenMissing", + "chat_ipfsKuboPathInvalid", + "chat_ipfsLinkNoRoom", + "chat_ipfsLinkOverLimit", "map_pathTraceAddMoreHint", "map_pathTraceModeRoundTrip", "map_pathTraceModeRoundTripHint", @@ -145,13 +280,40 @@ ], "it": [ + "urlImage_disabledInAppSettings", "settings_pathHashModeNotApplied", - "channels_notificationModeTooltip", - "notification_lowBatteryTitle", - "notification_lowBatteryBody" + "appSettings_ipfsImageLinks", + "appSettings_ipfsImageLinksSubtitle", + "appSettings_loadLinkImages", + "appSettings_loadLinkImagesSubtitle", + "appSettings_showLinkImagesByDefault", + "appSettings_showLinkImagesByDefaultSubtitle", + "appSettings_publicIpfsGateway", + "appSettings_ipfsGatewayDeactivated", + "appSettings_ipfsGatewayIpfsIo", + "appSettings_ipfsGatewayPinata", + "appSettings_ipfsGatewayFilebase", + "appSettings_ipfsGatewayCustom", + "appSettings_uploadIpfsProvider", + "appSettings_uploadIpfsGateway", + "appSettings_uploadIpfsGatewaySubtitle", + "appSettings_uploadIpfsEndpoint", + "appSettings_uploadIpfsEndpointSubtitle", + "appSettings_uploadIpfsApiKey", + "appSettings_ipfsImageLinksDescription", "contacts_removeAutoAddNote", "contacts_removeFailed", "channels_notificationModeTooltip", + "chat_sendImageIpfs", + "chat_ipfsUploadFailed", + "chat_ipfsUploadNotConfigured", + "chat_ipfsSelectedFileEmpty", + "chat_ipfsEndpointInvalid", + "chat_ipfsPinataTokenMissing", + "chat_ipfsFilebaseTokenMissing", + "chat_ipfsKuboPathInvalid", + "chat_ipfsLinkNoRoom", + "chat_ipfsLinkOverLimit", "map_pathTraceAddMoreHint", "map_pathTraceModeRoundTrip", "map_pathTraceModeRoundTripHint", @@ -174,13 +336,40 @@ ], "ja": [ + "urlImage_disabledInAppSettings", "settings_pathHashModeNotApplied", - "channels_notificationModeTooltip", - "notification_lowBatteryTitle", - "notification_lowBatteryBody" + "appSettings_ipfsImageLinks", + "appSettings_ipfsImageLinksSubtitle", + "appSettings_loadLinkImages", + "appSettings_loadLinkImagesSubtitle", + "appSettings_showLinkImagesByDefault", + "appSettings_showLinkImagesByDefaultSubtitle", + "appSettings_publicIpfsGateway", + "appSettings_ipfsGatewayDeactivated", + "appSettings_ipfsGatewayIpfsIo", + "appSettings_ipfsGatewayPinata", + "appSettings_ipfsGatewayFilebase", + "appSettings_ipfsGatewayCustom", + "appSettings_uploadIpfsProvider", + "appSettings_uploadIpfsGateway", + "appSettings_uploadIpfsGatewaySubtitle", + "appSettings_uploadIpfsEndpoint", + "appSettings_uploadIpfsEndpointSubtitle", + "appSettings_uploadIpfsApiKey", + "appSettings_ipfsImageLinksDescription", "contacts_removeAutoAddNote", "contacts_removeFailed", "channels_notificationModeTooltip", + "chat_sendImageIpfs", + "chat_ipfsUploadFailed", + "chat_ipfsUploadNotConfigured", + "chat_ipfsSelectedFileEmpty", + "chat_ipfsEndpointInvalid", + "chat_ipfsPinataTokenMissing", + "chat_ipfsFilebaseTokenMissing", + "chat_ipfsKuboPathInvalid", + "chat_ipfsLinkNoRoom", + "chat_ipfsLinkOverLimit", "map_pathTraceAddMoreHint", "map_pathTraceModeRoundTrip", "map_pathTraceModeRoundTripHint", @@ -203,13 +392,40 @@ ], "ko": [ + "urlImage_disabledInAppSettings", "settings_pathHashModeNotApplied", - "channels_notificationModeTooltip", - "notification_lowBatteryTitle", - "notification_lowBatteryBody" + "appSettings_ipfsImageLinks", + "appSettings_ipfsImageLinksSubtitle", + "appSettings_loadLinkImages", + "appSettings_loadLinkImagesSubtitle", + "appSettings_showLinkImagesByDefault", + "appSettings_showLinkImagesByDefaultSubtitle", + "appSettings_publicIpfsGateway", + "appSettings_ipfsGatewayDeactivated", + "appSettings_ipfsGatewayIpfsIo", + "appSettings_ipfsGatewayPinata", + "appSettings_ipfsGatewayFilebase", + "appSettings_ipfsGatewayCustom", + "appSettings_uploadIpfsProvider", + "appSettings_uploadIpfsGateway", + "appSettings_uploadIpfsGatewaySubtitle", + "appSettings_uploadIpfsEndpoint", + "appSettings_uploadIpfsEndpointSubtitle", + "appSettings_uploadIpfsApiKey", + "appSettings_ipfsImageLinksDescription", "contacts_removeAutoAddNote", "contacts_removeFailed", "channels_notificationModeTooltip", + "chat_sendImageIpfs", + "chat_ipfsUploadFailed", + "chat_ipfsUploadNotConfigured", + "chat_ipfsSelectedFileEmpty", + "chat_ipfsEndpointInvalid", + "chat_ipfsPinataTokenMissing", + "chat_ipfsFilebaseTokenMissing", + "chat_ipfsKuboPathInvalid", + "chat_ipfsLinkNoRoom", + "chat_ipfsLinkOverLimit", "map_pathTraceAddMoreHint", "map_pathTraceModeRoundTrip", "map_pathTraceModeRoundTripHint", @@ -232,13 +448,40 @@ ], "nl": [ + "urlImage_disabledInAppSettings", "settings_pathHashModeNotApplied", - "channels_notificationModeTooltip", - "notification_lowBatteryTitle", - "notification_lowBatteryBody" + "appSettings_ipfsImageLinks", + "appSettings_ipfsImageLinksSubtitle", + "appSettings_loadLinkImages", + "appSettings_loadLinkImagesSubtitle", + "appSettings_showLinkImagesByDefault", + "appSettings_showLinkImagesByDefaultSubtitle", + "appSettings_publicIpfsGateway", + "appSettings_ipfsGatewayDeactivated", + "appSettings_ipfsGatewayIpfsIo", + "appSettings_ipfsGatewayPinata", + "appSettings_ipfsGatewayFilebase", + "appSettings_ipfsGatewayCustom", + "appSettings_uploadIpfsProvider", + "appSettings_uploadIpfsGateway", + "appSettings_uploadIpfsGatewaySubtitle", + "appSettings_uploadIpfsEndpoint", + "appSettings_uploadIpfsEndpointSubtitle", + "appSettings_uploadIpfsApiKey", + "appSettings_ipfsImageLinksDescription", "contacts_removeAutoAddNote", "contacts_removeFailed", "channels_notificationModeTooltip", + "chat_sendImageIpfs", + "chat_ipfsUploadFailed", + "chat_ipfsUploadNotConfigured", + "chat_ipfsSelectedFileEmpty", + "chat_ipfsEndpointInvalid", + "chat_ipfsPinataTokenMissing", + "chat_ipfsFilebaseTokenMissing", + "chat_ipfsKuboPathInvalid", + "chat_ipfsLinkNoRoom", + "chat_ipfsLinkOverLimit", "map_pathTraceAddMoreHint", "map_pathTraceModeRoundTrip", "map_pathTraceModeRoundTripHint", @@ -261,13 +504,40 @@ ], "pl": [ + "urlImage_disabledInAppSettings", "settings_pathHashModeNotApplied", - "channels_notificationModeTooltip", - "notification_lowBatteryTitle", - "notification_lowBatteryBody" + "appSettings_ipfsImageLinks", + "appSettings_ipfsImageLinksSubtitle", + "appSettings_loadLinkImages", + "appSettings_loadLinkImagesSubtitle", + "appSettings_showLinkImagesByDefault", + "appSettings_showLinkImagesByDefaultSubtitle", + "appSettings_publicIpfsGateway", + "appSettings_ipfsGatewayDeactivated", + "appSettings_ipfsGatewayIpfsIo", + "appSettings_ipfsGatewayPinata", + "appSettings_ipfsGatewayFilebase", + "appSettings_ipfsGatewayCustom", + "appSettings_uploadIpfsProvider", + "appSettings_uploadIpfsGateway", + "appSettings_uploadIpfsGatewaySubtitle", + "appSettings_uploadIpfsEndpoint", + "appSettings_uploadIpfsEndpointSubtitle", + "appSettings_uploadIpfsApiKey", + "appSettings_ipfsImageLinksDescription", "contacts_removeAutoAddNote", "contacts_removeFailed", "channels_notificationModeTooltip", + "chat_sendImageIpfs", + "chat_ipfsUploadFailed", + "chat_ipfsUploadNotConfigured", + "chat_ipfsSelectedFileEmpty", + "chat_ipfsEndpointInvalid", + "chat_ipfsPinataTokenMissing", + "chat_ipfsFilebaseTokenMissing", + "chat_ipfsKuboPathInvalid", + "chat_ipfsLinkNoRoom", + "chat_ipfsLinkOverLimit", "map_pathTraceAddMoreHint", "map_pathTraceModeRoundTrip", "map_pathTraceModeRoundTripHint", @@ -290,13 +560,40 @@ ], "pt": [ + "urlImage_disabledInAppSettings", "settings_pathHashModeNotApplied", - "channels_notificationModeTooltip", - "notification_lowBatteryTitle", - "notification_lowBatteryBody" + "appSettings_ipfsImageLinks", + "appSettings_ipfsImageLinksSubtitle", + "appSettings_loadLinkImages", + "appSettings_loadLinkImagesSubtitle", + "appSettings_showLinkImagesByDefault", + "appSettings_showLinkImagesByDefaultSubtitle", + "appSettings_publicIpfsGateway", + "appSettings_ipfsGatewayDeactivated", + "appSettings_ipfsGatewayIpfsIo", + "appSettings_ipfsGatewayPinata", + "appSettings_ipfsGatewayFilebase", + "appSettings_ipfsGatewayCustom", + "appSettings_uploadIpfsProvider", + "appSettings_uploadIpfsGateway", + "appSettings_uploadIpfsGatewaySubtitle", + "appSettings_uploadIpfsEndpoint", + "appSettings_uploadIpfsEndpointSubtitle", + "appSettings_uploadIpfsApiKey", + "appSettings_ipfsImageLinksDescription", "contacts_removeAutoAddNote", "contacts_removeFailed", "channels_notificationModeTooltip", + "chat_sendImageIpfs", + "chat_ipfsUploadFailed", + "chat_ipfsUploadNotConfigured", + "chat_ipfsSelectedFileEmpty", + "chat_ipfsEndpointInvalid", + "chat_ipfsPinataTokenMissing", + "chat_ipfsFilebaseTokenMissing", + "chat_ipfsKuboPathInvalid", + "chat_ipfsLinkNoRoom", + "chat_ipfsLinkOverLimit", "map_pathTraceAddMoreHint", "map_pathTraceModeRoundTrip", "map_pathTraceModeRoundTripHint", @@ -319,13 +616,40 @@ ], "ru": [ + "urlImage_disabledInAppSettings", "settings_pathHashModeNotApplied", - "channels_notificationModeTooltip", - "notification_lowBatteryTitle", - "notification_lowBatteryBody" + "appSettings_ipfsImageLinks", + "appSettings_ipfsImageLinksSubtitle", + "appSettings_loadLinkImages", + "appSettings_loadLinkImagesSubtitle", + "appSettings_showLinkImagesByDefault", + "appSettings_showLinkImagesByDefaultSubtitle", + "appSettings_publicIpfsGateway", + "appSettings_ipfsGatewayDeactivated", + "appSettings_ipfsGatewayIpfsIo", + "appSettings_ipfsGatewayPinata", + "appSettings_ipfsGatewayFilebase", + "appSettings_ipfsGatewayCustom", + "appSettings_uploadIpfsProvider", + "appSettings_uploadIpfsGateway", + "appSettings_uploadIpfsGatewaySubtitle", + "appSettings_uploadIpfsEndpoint", + "appSettings_uploadIpfsEndpointSubtitle", + "appSettings_uploadIpfsApiKey", + "appSettings_ipfsImageLinksDescription", "contacts_removeAutoAddNote", "contacts_removeFailed", "channels_notificationModeTooltip", + "chat_sendImageIpfs", + "chat_ipfsUploadFailed", + "chat_ipfsUploadNotConfigured", + "chat_ipfsSelectedFileEmpty", + "chat_ipfsEndpointInvalid", + "chat_ipfsPinataTokenMissing", + "chat_ipfsFilebaseTokenMissing", + "chat_ipfsKuboPathInvalid", + "chat_ipfsLinkNoRoom", + "chat_ipfsLinkOverLimit", "map_pathTraceAddMoreHint", "map_pathTraceModeRoundTrip", "map_pathTraceModeRoundTripHint", @@ -348,13 +672,40 @@ ], "sk": [ + "urlImage_disabledInAppSettings", "settings_pathHashModeNotApplied", - "channels_notificationModeTooltip", - "notification_lowBatteryTitle", - "notification_lowBatteryBody" + "appSettings_ipfsImageLinks", + "appSettings_ipfsImageLinksSubtitle", + "appSettings_loadLinkImages", + "appSettings_loadLinkImagesSubtitle", + "appSettings_showLinkImagesByDefault", + "appSettings_showLinkImagesByDefaultSubtitle", + "appSettings_publicIpfsGateway", + "appSettings_ipfsGatewayDeactivated", + "appSettings_ipfsGatewayIpfsIo", + "appSettings_ipfsGatewayPinata", + "appSettings_ipfsGatewayFilebase", + "appSettings_ipfsGatewayCustom", + "appSettings_uploadIpfsProvider", + "appSettings_uploadIpfsGateway", + "appSettings_uploadIpfsGatewaySubtitle", + "appSettings_uploadIpfsEndpoint", + "appSettings_uploadIpfsEndpointSubtitle", + "appSettings_uploadIpfsApiKey", + "appSettings_ipfsImageLinksDescription", "contacts_removeAutoAddNote", "contacts_removeFailed", "channels_notificationModeTooltip", + "chat_sendImageIpfs", + "chat_ipfsUploadFailed", + "chat_ipfsUploadNotConfigured", + "chat_ipfsSelectedFileEmpty", + "chat_ipfsEndpointInvalid", + "chat_ipfsPinataTokenMissing", + "chat_ipfsFilebaseTokenMissing", + "chat_ipfsKuboPathInvalid", + "chat_ipfsLinkNoRoom", + "chat_ipfsLinkOverLimit", "map_pathTraceAddMoreHint", "map_pathTraceModeRoundTrip", "map_pathTraceModeRoundTripHint", @@ -377,13 +728,40 @@ ], "sl": [ + "urlImage_disabledInAppSettings", "settings_pathHashModeNotApplied", - "channels_notificationModeTooltip", - "notification_lowBatteryTitle", - "notification_lowBatteryBody" + "appSettings_ipfsImageLinks", + "appSettings_ipfsImageLinksSubtitle", + "appSettings_loadLinkImages", + "appSettings_loadLinkImagesSubtitle", + "appSettings_showLinkImagesByDefault", + "appSettings_showLinkImagesByDefaultSubtitle", + "appSettings_publicIpfsGateway", + "appSettings_ipfsGatewayDeactivated", + "appSettings_ipfsGatewayIpfsIo", + "appSettings_ipfsGatewayPinata", + "appSettings_ipfsGatewayFilebase", + "appSettings_ipfsGatewayCustom", + "appSettings_uploadIpfsProvider", + "appSettings_uploadIpfsGateway", + "appSettings_uploadIpfsGatewaySubtitle", + "appSettings_uploadIpfsEndpoint", + "appSettings_uploadIpfsEndpointSubtitle", + "appSettings_uploadIpfsApiKey", + "appSettings_ipfsImageLinksDescription", "contacts_removeAutoAddNote", "contacts_removeFailed", "channels_notificationModeTooltip", + "chat_sendImageIpfs", + "chat_ipfsUploadFailed", + "chat_ipfsUploadNotConfigured", + "chat_ipfsSelectedFileEmpty", + "chat_ipfsEndpointInvalid", + "chat_ipfsPinataTokenMissing", + "chat_ipfsFilebaseTokenMissing", + "chat_ipfsKuboPathInvalid", + "chat_ipfsLinkNoRoom", + "chat_ipfsLinkOverLimit", "map_pathTraceAddMoreHint", "map_pathTraceModeRoundTrip", "map_pathTraceModeRoundTripHint", @@ -406,13 +784,40 @@ ], "sv": [ + "urlImage_disabledInAppSettings", "settings_pathHashModeNotApplied", - "channels_notificationModeTooltip", - "notification_lowBatteryTitle", - "notification_lowBatteryBody" + "appSettings_ipfsImageLinks", + "appSettings_ipfsImageLinksSubtitle", + "appSettings_loadLinkImages", + "appSettings_loadLinkImagesSubtitle", + "appSettings_showLinkImagesByDefault", + "appSettings_showLinkImagesByDefaultSubtitle", + "appSettings_publicIpfsGateway", + "appSettings_ipfsGatewayDeactivated", + "appSettings_ipfsGatewayIpfsIo", + "appSettings_ipfsGatewayPinata", + "appSettings_ipfsGatewayFilebase", + "appSettings_ipfsGatewayCustom", + "appSettings_uploadIpfsProvider", + "appSettings_uploadIpfsGateway", + "appSettings_uploadIpfsGatewaySubtitle", + "appSettings_uploadIpfsEndpoint", + "appSettings_uploadIpfsEndpointSubtitle", + "appSettings_uploadIpfsApiKey", + "appSettings_ipfsImageLinksDescription", "contacts_removeAutoAddNote", "contacts_removeFailed", "channels_notificationModeTooltip", + "chat_sendImageIpfs", + "chat_ipfsUploadFailed", + "chat_ipfsUploadNotConfigured", + "chat_ipfsSelectedFileEmpty", + "chat_ipfsEndpointInvalid", + "chat_ipfsPinataTokenMissing", + "chat_ipfsFilebaseTokenMissing", + "chat_ipfsKuboPathInvalid", + "chat_ipfsLinkNoRoom", + "chat_ipfsLinkOverLimit", "map_pathTraceAddMoreHint", "map_pathTraceModeRoundTrip", "map_pathTraceModeRoundTripHint", @@ -435,13 +840,40 @@ ], "uk": [ + "urlImage_disabledInAppSettings", "settings_pathHashModeNotApplied", - "channels_notificationModeTooltip", - "notification_lowBatteryTitle", - "notification_lowBatteryBody" + "appSettings_ipfsImageLinks", + "appSettings_ipfsImageLinksSubtitle", + "appSettings_loadLinkImages", + "appSettings_loadLinkImagesSubtitle", + "appSettings_showLinkImagesByDefault", + "appSettings_showLinkImagesByDefaultSubtitle", + "appSettings_publicIpfsGateway", + "appSettings_ipfsGatewayDeactivated", + "appSettings_ipfsGatewayIpfsIo", + "appSettings_ipfsGatewayPinata", + "appSettings_ipfsGatewayFilebase", + "appSettings_ipfsGatewayCustom", + "appSettings_uploadIpfsProvider", + "appSettings_uploadIpfsGateway", + "appSettings_uploadIpfsGatewaySubtitle", + "appSettings_uploadIpfsEndpoint", + "appSettings_uploadIpfsEndpointSubtitle", + "appSettings_uploadIpfsApiKey", + "appSettings_ipfsImageLinksDescription", "contacts_removeAutoAddNote", "contacts_removeFailed", "channels_notificationModeTooltip", + "chat_sendImageIpfs", + "chat_ipfsUploadFailed", + "chat_ipfsUploadNotConfigured", + "chat_ipfsSelectedFileEmpty", + "chat_ipfsEndpointInvalid", + "chat_ipfsPinataTokenMissing", + "chat_ipfsFilebaseTokenMissing", + "chat_ipfsKuboPathInvalid", + "chat_ipfsLinkNoRoom", + "chat_ipfsLinkOverLimit", "map_pathTraceAddMoreHint", "map_pathTraceModeRoundTrip", "map_pathTraceModeRoundTripHint", @@ -464,13 +896,40 @@ ], "zh": [ + "urlImage_disabledInAppSettings", "settings_pathHashModeNotApplied", - "channels_notificationModeTooltip", - "notification_lowBatteryTitle", - "notification_lowBatteryBody" + "appSettings_ipfsImageLinks", + "appSettings_ipfsImageLinksSubtitle", + "appSettings_loadLinkImages", + "appSettings_loadLinkImagesSubtitle", + "appSettings_showLinkImagesByDefault", + "appSettings_showLinkImagesByDefaultSubtitle", + "appSettings_publicIpfsGateway", + "appSettings_ipfsGatewayDeactivated", + "appSettings_ipfsGatewayIpfsIo", + "appSettings_ipfsGatewayPinata", + "appSettings_ipfsGatewayFilebase", + "appSettings_ipfsGatewayCustom", + "appSettings_uploadIpfsProvider", + "appSettings_uploadIpfsGateway", + "appSettings_uploadIpfsGatewaySubtitle", + "appSettings_uploadIpfsEndpoint", + "appSettings_uploadIpfsEndpointSubtitle", + "appSettings_uploadIpfsApiKey", + "appSettings_ipfsImageLinksDescription", "contacts_removeAutoAddNote", "contacts_removeFailed", "channels_notificationModeTooltip", + "chat_sendImageIpfs", + "chat_ipfsUploadFailed", + "chat_ipfsUploadNotConfigured", + "chat_ipfsSelectedFileEmpty", + "chat_ipfsEndpointInvalid", + "chat_ipfsPinataTokenMissing", + "chat_ipfsFilebaseTokenMissing", + "chat_ipfsKuboPathInvalid", + "chat_ipfsLinkNoRoom", + "chat_ipfsLinkOverLimit", "map_pathTraceAddMoreHint", "map_pathTraceModeRoundTrip", "map_pathTraceModeRoundTripHint",