mudular code ready to fork

This commit is contained in:
gitea
2025-11-08 12:54:40 +01:00
parent 5f8d8330f5
commit 8c6bf598f5
21 changed files with 288 additions and 519 deletions
+4 -15
View File
@@ -1,26 +1,15 @@
import 'dart:async';
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:web_socket_channel/web_socket_channel.dart';
import 'package:nostr_tools/nostr_tools.dart';
import 'package:http/http.dart' as http;
import '../../core/logger.dart';
import '../../core/exceptions/nostr_exception.dart';
import 'models/nostr_keypair.dart';
import 'models/nostr_event.dart';
import 'models/nostr_relay.dart';
import 'models/nostr_profile.dart';
/// Exception thrown when Nostr operations fail.
class NostrException implements Exception {
/// Error message.
final String message;
/// Creates a [NostrException] with the provided message.
NostrException(this.message);
@override
String toString() => 'NostrException: $message';
}
/// Service for interacting with Nostr protocol.
///
/// This service provides:
@@ -492,7 +481,7 @@ class NostrService {
}
} catch (e) {
// Ignore parsing errors
debugPrint('Error parsing profile event: $e');
Logger.warning('Error parsing profile event: $e');
}
} else if (message['type'] == 'EOSE' &&
message['subscription_id'] == reqId) {
@@ -634,7 +623,7 @@ class NostrService {
addedCount++;
} catch (e) {
// Skip invalid relay URLs
debugPrint('Warning: Invalid relay URL from NIP-05: $relayUrl');
Logger.warning('Invalid relay URL from NIP-05: $relayUrl');
}
}