Merge zjs81/dev into ez_share_urlimage_PR
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
commit
4000c49213
152 files changed
+28635
-8600
No files matched your search
@@ -162,6 +162,12 @@ class AppSettings {
|
||||
final String uploadIpfsEndpoint;
|
||||
final String uploadIpfsApiKey;
|
||||
|
||||
/// Opt-in upload of header-only packet records to the network map.
|
||||
final bool networkMapUploadEnabled;
|
||||
|
||||
/// Whether the one-time network map opt-in dialog has been shown.
|
||||
final bool networkMapPromptShown;
|
||||
|
||||
/// Whether a received image is decoded as soon as it is reassembled.
|
||||
///
|
||||
/// Off by default and deliberately so: a decode peaks around 2.16 GiB
|
||||
@@ -273,11 +279,13 @@ class AppSettings {
|
||||
this.tcpServerAddress = '',
|
||||
this.tcpServerPort = 0,
|
||||
this.jumpToOldestUnread = false,
|
||||
this.imageMessagesEnabled = false,
|
||||
this.networkMapUploadEnabled = false,
|
||||
this.networkMapPromptShown = false,
|
||||
this.publicIpfsGateway = defaultPublicIpfsGateway,
|
||||
this.uploadIpfsGateway = '',
|
||||
this.uploadIpfsEndpoint = '',
|
||||
this.uploadIpfsApiKey = '',
|
||||
this.imageMessagesEnabled = false,
|
||||
this.imageProcessAutomatically = false,
|
||||
this.imageCodecEnabled = false,
|
||||
this.imageCodecSelectedModelId,
|
||||
@@ -359,11 +367,13 @@ 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,
|
||||
'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,
|
||||
@@ -470,13 +480,16 @@ 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,
|
||||
publicIpfsGateway: migratePublicIpfsGateway(
|
||||
json['public_ipfs_gateway'] as String?,
|
||||
),
|
||||
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,
|
||||
@@ -596,11 +609,13 @@ class AppSettings {
|
||||
String? tcpServerAddress,
|
||||
int? tcpServerPort,
|
||||
bool? jumpToOldestUnread,
|
||||
bool? imageMessagesEnabled,
|
||||
bool? networkMapUploadEnabled,
|
||||
bool? networkMapPromptShown,
|
||||
String? publicIpfsGateway,
|
||||
String? uploadIpfsGateway,
|
||||
String? uploadIpfsEndpoint,
|
||||
String? uploadIpfsApiKey,
|
||||
bool? imageMessagesEnabled,
|
||||
bool? imageProcessAutomatically,
|
||||
bool? imageCodecEnabled,
|
||||
Object? imageCodecSelectedModelId = _unset,
|
||||
@@ -685,11 +700,15 @@ 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,
|
||||
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,
|
||||
|
||||
@@ -25,6 +25,25 @@ class Channel {
|
||||
|
||||
bool get isEmpty => name.isEmpty && psk.every((b) => b == 0);
|
||||
|
||||
/// Key for this channel's persisted data (messages, settings, region,
|
||||
/// order, images). Derived from the PSK so it follows the channel across
|
||||
/// radio slots; null for an empty slot.
|
||||
late final String? storageId = storageIdForPsk(psk);
|
||||
|
||||
static const String _storageIdDomain = 'meshcore-channel:';
|
||||
|
||||
/// First 8 bytes of SHA-256("meshcore-channel:" + psk) as 16 hex chars, or
|
||||
/// null for an all-zero PSK. Not the 1-byte on-air channel hash, which
|
||||
/// collides.
|
||||
static String? storageIdForPsk(Uint8List psk) {
|
||||
if (psk.every((b) => b == 0)) return null;
|
||||
final digest = crypto.sha256.convert([
|
||||
...utf8.encode(_storageIdDomain),
|
||||
...psk,
|
||||
]);
|
||||
return _bytesToHex(Uint8List.fromList(digest.bytes.sublist(0, 8)));
|
||||
}
|
||||
|
||||
/// Key used for per-channel notification muting.
|
||||
String get muteKey => name.isEmpty ? 'Channel $index' : name;
|
||||
|
||||
|
||||
@@ -124,6 +124,7 @@ class ChannelMessage {
|
||||
MessageTranslationStatus? translationStatus,
|
||||
Object? translationModelId = _unset,
|
||||
Map<String, List<String?>>? reactions,
|
||||
int? channelIndex,
|
||||
}) {
|
||||
return ChannelMessage(
|
||||
senderKey: senderKey,
|
||||
@@ -152,7 +153,7 @@ class ChannelMessage {
|
||||
pathHashWidth: pathHashWidth ?? this.pathHashWidth,
|
||||
pathBytes: pathBytes ?? this.pathBytes,
|
||||
pathVariants: pathVariants ?? this.pathVariants,
|
||||
channelIndex: channelIndex,
|
||||
channelIndex: channelIndex ?? this.channelIndex,
|
||||
region: region == _unset ? this.region : region as String?,
|
||||
messageId: messageId,
|
||||
packetHash: packetHash ?? this.packetHash,
|
||||
|
||||
Reference in new issue
Block a user