fix some lints

This commit is contained in:
Fabian Freund
2025-09-19 12:02:19 +02:00
parent 79da47d11b
commit 6ab481d188
18 changed files with 55 additions and 65 deletions
-1
View File
@@ -18,7 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:riverpod/riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'defaults.g.dart'; part 'defaults.g.dart';
-1
View File
@@ -18,7 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:weblibre/core/routing/routes.dart'; import 'package:weblibre/core/routing/routes.dart';
import 'package:weblibre/features/user/domain/repositories/onboarding.dart'; import 'package:weblibre/features/user/domain/repositories/onboarding.dart';
@@ -18,7 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import 'package:package_info_plus/package_info_plus.dart'; import 'package:package_info_plus/package_info_plus.dart';
import 'package:riverpod/riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'package_info_repository.g.dart'; part 'package_info_repository.g.dart';
@@ -18,7 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import 'package:home_widget/home_widget.dart'; import 'package:home_widget/home_widget.dart';
import 'package:riverpod/riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:rxdart/rxdart.dart'; import 'package:rxdart/rxdart.dart';
import 'package:weblibre/data/models/received_intent_parameter.dart'; import 'package:weblibre/data/models/received_intent_parameter.dart';
@@ -21,7 +21,6 @@ import 'package:drift/drift.dart';
import 'package:drift/native.dart'; import 'package:drift/native.dart';
import 'package:path/path.dart' as p; import 'package:path/path.dart' as p;
import 'package:path_provider/path_provider.dart' as path_provider; import 'package:path_provider/path_provider.dart' as path_provider;
import 'package:riverpod/riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:sqlite3/sqlite3.dart'; import 'package:sqlite3/sqlite3.dart';
import 'package:sqlite3_flutter_libs/sqlite3_flutter_libs.dart'; import 'package:sqlite3_flutter_libs/sqlite3_flutter_libs.dart';
@@ -19,7 +19,6 @@
*/ */
import 'package:drift/isolate.dart'; import 'package:drift/isolate.dart';
import 'package:exceptions/exceptions.dart'; import 'package:exceptions/exceptions.dart';
import 'package:riverpod/riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:weblibre/features/bangs/data/database/database.dart'; import 'package:weblibre/features/bangs/data/database/database.dart';
import 'package:weblibre/features/bangs/data/models/bang_group.dart'; import 'package:weblibre/features/bangs/data/models/bang_group.dart';
@@ -20,7 +20,6 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter_mozilla_components/flutter_mozilla_components.dart'; import 'package:flutter_mozilla_components/flutter_mozilla_components.dart';
import 'package:riverpod/riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:share_plus/share_plus.dart'; import 'package:share_plus/share_plus.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
@@ -18,7 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import 'package:flutter_mozilla_components/flutter_mozilla_components.dart'; import 'package:flutter_mozilla_components/flutter_mozilla_components.dart';
import 'package:riverpod/riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'browser_extension.g.dart'; part 'browser_extension.g.dart';
@@ -20,7 +20,6 @@
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:flutter_mozilla_components/flutter_mozilla_components.dart'; import 'package:flutter_mozilla_components/flutter_mozilla_components.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'tab_session.g.dart'; part 'tab_session.g.dart';
@@ -19,7 +19,6 @@
*/ */
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_mozilla_components/flutter_mozilla_components.dart'; import 'package:flutter_mozilla_components/flutter_mozilla_components.dart';
import 'package:riverpod/riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:weblibre/features/geckoview/features/history/domain/entities/history_filter_options.dart'; import 'package:weblibre/features/geckoview/features/history/domain/entities/history_filter_options.dart';
@@ -23,7 +23,6 @@ import 'dart:convert';
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_mozilla_components/flutter_mozilla_components.dart'; import 'package:flutter_mozilla_components/flutter_mozilla_components.dart';
import 'package:riverpod/riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:rxdart/rxdart.dart'; import 'package:rxdart/rxdart.dart';
import 'package:weblibre/features/geckoview/features/preferences/data/models/preference_setting.dart'; import 'package:weblibre/features/geckoview/features/preferences/data/models/preference_setting.dart';
@@ -18,7 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import 'package:flutter_mozilla_components/flutter_mozilla_components.dart'; import 'package:flutter_mozilla_components/flutter_mozilla_components.dart';
import 'package:riverpod/riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'readerable.g.dart'; part 'readerable.g.dart';
@@ -21,7 +21,6 @@ import 'package:drift/drift.dart';
import 'package:drift/native.dart'; import 'package:drift/native.dart';
import 'package:path/path.dart' as p; import 'package:path/path.dart' as p;
import 'package:path_provider/path_provider.dart' as path_provider; import 'package:path_provider/path_provider.dart' as path_provider;
import 'package:riverpod/riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:sqlite3/sqlite3.dart'; import 'package:sqlite3/sqlite3.dart';
import 'package:sqlite3_flutter_libs/sqlite3_flutter_libs.dart'; import 'package:sqlite3_flutter_libs/sqlite3_flutter_libs.dart';
@@ -18,7 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import 'package:flutter_mozilla_components/flutter_mozilla_components.dart'; import 'package:flutter_mozilla_components/flutter_mozilla_components.dart';
import 'package:riverpod/riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:weblibre/core/logger.dart'; import 'package:weblibre/core/logger.dart';
import 'package:weblibre/features/geckoview/domain/providers/selected_tab.dart'; import 'package:weblibre/features/geckoview/domain/providers/selected_tab.dart';
@@ -22,7 +22,6 @@ import 'dart:async';
import 'package:mime/mime.dart' as mime; import 'package:mime/mime.dart' as mime;
import 'package:nullability/nullability.dart'; import 'package:nullability/nullability.dart';
import 'package:path/path.dart' as p; import 'package:path/path.dart' as p;
import 'package:riverpod/riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:simple_intent_receiver/simple_intent_receiver.dart'; import 'package:simple_intent_receiver/simple_intent_receiver.dart';
import 'package:uri_to_file/uri_to_file.dart' as uri_to_file; import 'package:uri_to_file/uri_to_file.dart' as uri_to_file;
@@ -21,7 +21,6 @@ import 'package:drift/drift.dart';
import 'package:drift/native.dart'; import 'package:drift/native.dart';
import 'package:path/path.dart' as p; import 'package:path/path.dart' as p;
import 'package:path_provider/path_provider.dart' as path_provider; import 'package:path_provider/path_provider.dart' as path_provider;
import 'package:riverpod/riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:sqlite3/sqlite3.dart'; import 'package:sqlite3/sqlite3.dart';
import 'package:sqlite3_flutter_libs/sqlite3_flutter_libs.dart'; import 'package:sqlite3_flutter_libs/sqlite3_flutter_libs.dart';
@@ -19,7 +19,6 @@
*/ */
import 'package:drift/drift.dart'; import 'package:drift/drift.dart';
import 'package:drift/native.dart'; import 'package:drift/native.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:path/path.dart' as p; import 'package:path/path.dart' as p;
import 'package:path_provider/path_provider.dart' as path_provider; import 'package:path_provider/path_provider.dart' as path_provider;
import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart';
+55 -48
View File
@@ -24,9 +24,7 @@ class MyApp extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return const MaterialApp( return const MaterialApp(home: Home());
home: Home(),
);
} }
} }
@@ -47,8 +45,9 @@ class _MyAppState extends State<Home> {
// Set the default text for the onion input field. // Set the default text for the onion input field.
final onionController = TextEditingController( final onionController = TextEditingController(
text: text:
'https://cflarexljc3rw355ysrkrzwapozws6nre6xsy3n4yrj7taye3uiby3ad.onion'); 'https://cflarexljc3rw355ysrkrzwapozws6nre6xsy3n4yrj7taye3uiby3ad.onion',
);
// See https://blog.cloudflare.com/cloudflare-onion-service/ for more options: // See https://blog.cloudflare.com/cloudflare-onion-service/ for more options:
// cflarexljc3rw355ysrkrzwapozws6nre6xsy3n4yrj7taye3uiby3ad.onion // cflarexljc3rw355ysrkrzwapozws6nre6xsy3n4yrj7taye3uiby3ad.onion
// cflarenuttlfuyn7imozr4atzvfbiw3ezgbdjdldmdx7srterayaozid.onion // cflarenuttlfuyn7imozr4atzvfbiw3ezgbdjdldmdx7srterayaozid.onion
@@ -62,14 +61,16 @@ class _MyAppState extends State<Home> {
// cflare2nge4h4yqr3574crrd7k66lil3torzbisz6uciyuzqc2h2ykyd.onion // cflare2nge4h4yqr3574crrd7k66lil3torzbisz6uciyuzqc2h2ykyd.onion
final bitcoinOnionController = TextEditingController( final bitcoinOnionController = TextEditingController(
text: text:
'qly7g5n5t3f3h23xvbp44vs6vpmayurno4basuu5rcvrupli7y2jmgid.onion:50001'); 'qly7g5n5t3f3h23xvbp44vs6vpmayurno4basuu5rcvrupli7y2jmgid.onion:50001',
);
// For more options, see https://bitnodes.io/nodes/addresses/?q=onion and // For more options, see https://bitnodes.io/nodes/addresses/?q=onion and
// https://sethforprivacy.com/about/ // https://sethforprivacy.com/about/
final moneroOnionController = TextEditingController( final moneroOnionController = TextEditingController(
text: text:
'ucdouiihzwvb5edg3ezeufcs4yp26gq4x64n6b4kuffb7s7jxynnk7qd.onion:18081/json_rpc'); 'ucdouiihzwvb5edg3ezeufcs4yp26gq4x64n6b4kuffb7s7jxynnk7qd.onion:18081/json_rpc',
);
Future<void> startTor() async { Future<void> startTor() async {
await Tor.init(); await Tor.init();
@@ -96,9 +97,7 @@ class _MyAppState extends State<Home> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
const spacerSmall = SizedBox(height: 10); const spacerSmall = SizedBox(height: 10);
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(title: const Text('Tor example')),
title: const Text('Tor example'),
),
body: SingleChildScrollView( body: SingleChildScrollView(
child: Container( child: Container(
padding: const EdgeInsets.all(10), padding: const EdgeInsets.all(10),
@@ -129,11 +128,13 @@ class _MyAppState extends State<Home> {
await startTor(); await startTor();
print("Starting tor took " print(
"${DateTime.now().difference(time).inSeconds} " "Starting tor took "
"seconds. Proxy running on port ${Tor.instance.port}"); "${DateTime.now().difference(time).inSeconds} "
"seconds. Proxy running on port ${Tor.instance.port}",
);
if (mounted) { if (context.mounted) {
Navigator.of(context).pop(); Navigator.of(context).pop();
} }
}, },
@@ -176,10 +177,11 @@ class _MyAppState extends State<Home> {
// Assign connection factory. // Assign connection factory.
SocksTCPClient.assignToHttpClient(client, [ SocksTCPClient.assignToHttpClient(client, [
ProxySettings(InternetAddress.loopbackIPv4, ProxySettings(
Tor.instance.port, InternetAddress.loopbackIPv4,
password: Tor.instance.port,
null), // TODO Need to get from tor config file. password: null,
), // TODO Need to get from tor config file.
]); ]);
// GET request. // GET request.
@@ -188,8 +190,9 @@ class _MyAppState extends State<Home> {
final response = await request.close(); final response = await request.close();
// Print response. // Print response.
var responseString = var responseString = await utf8.decodeStream(
await utf8.decodeStream(response); response,
);
print(responseString); print(responseString);
// If host input left to default icanhazip.com, a Tor // If host input left to default icanhazip.com, a Tor
// exit node IP should be printed to the console. // exit node IP should be printed to the console.
@@ -223,7 +226,9 @@ class _MyAppState extends State<Home> {
// //
// Note that this is an SSL example. // Note that this is an SSL example.
await socksSocket.connectTo( await socksSocket.connectTo(
'bitcoin.stackwallet.com', 50002); 'bitcoin.stackwallet.com',
50002,
);
// Send a server features command to the connected socket, see method for more specific usage example.. // Send a server features command to the connected socket, see method for more specific usage example..
await socksSocket.sendServerFeaturesCommand(); await socksSocket.sendServerFeaturesCommand();
@@ -288,17 +293,20 @@ class _MyAppState extends State<Home> {
return; return;
} }
String domain = String domain = bitcoinOnionController.text
bitcoinOnionController.text.split(":").first; .split(":")
.first;
int port = int.parse( int port = int.parse(
bitcoinOnionController.text.split(":").last); bitcoinOnionController.text.split(":").last,
);
// Instantiate a socks socket at localhost and on the port selected by the tor service. // Instantiate a socks socket at localhost and on the port selected by the tor service.
var socksSocket = await SOCKSSocket.create( var socksSocket = await SOCKSSocket.create(
proxyHost: InternetAddress.loopbackIPv4.address, proxyHost: InternetAddress.loopbackIPv4.address,
proxyPort: Tor.instance.port, proxyPort: Tor.instance.port,
sslEnabled: !domain sslEnabled: !domain.endsWith(
.endsWith(".onion"), // For SSL connections. ".onion",
), // For SSL connections.
); );
// Connect to the socks instantiated above. // Connect to the socks instantiated above.
@@ -341,13 +349,10 @@ class _MyAppState extends State<Home> {
// Close the socket. // Close the socket.
await socksSocket.close(); await socksSocket.close();
} }
// A mutex should be added to this example to prevent // A mutex should be added to this example to prevent
// multiple connections from being made at once. TODO // multiple connections from being made at once. TODO
: null, : null,
child: const Text( child: const Text("Test Bitcoin onion node connection"),
"Test Bitcoin onion node connection",
),
), ),
], ],
), ),
@@ -369,24 +374,28 @@ class _MyAppState extends State<Home> {
onPressed: torStarted onPressed: torStarted
? () async { ? () async {
// Validate the onion address. // Validate the onion address.
if (!moneroOnionController.text if (!moneroOnionController.text.contains(
.contains(".onion")) { ".onion",
)) {
print("Invalid onion address"); print("Invalid onion address");
return; return;
} else if (!moneroOnionController.text } else if (!moneroOnionController.text.contains(
.contains(":")) { ":",
)) {
print("Invalid onion address (needs port)"); print("Invalid onion address (needs port)");
return; return;
} }
final String host = final String host = moneroOnionController.text
moneroOnionController.text.split(":").first;
final int port = int.parse(moneroOnionController
.text
.split(":") .split(":")
.last .first;
.split("/") final int port = int.parse(
.first); moneroOnionController.text
.split(":")
.last
.split("/")
.first,
);
final String path = moneroOnionController.text final String path = moneroOnionController.text
.split(":") .split(":")
.last .last
@@ -408,7 +417,8 @@ class _MyAppState extends State<Home> {
"method": "get_info", "method": "get_info",
}); });
final request = 'POST /$path HTTP/1.1\r\n' final request =
'POST /$path HTTP/1.1\r\n'
'Host: $host\r\n' 'Host: $host\r\n'
'Content-Type: application/json\r\n' 'Content-Type: application/json\r\n'
'Content-Length: ${body.length}\r\n' 'Content-Length: ${body.length}\r\n'
@@ -449,13 +459,10 @@ class _MyAppState extends State<Home> {
await socksSocket.close(); await socksSocket.close();
} }
// A mutex should be added to this example to prevent // A mutex should be added to this example to prevent
// multiple connections from being made at once. TODO // multiple connections from being made at once. TODO
: null, : null,
child: const Text( child: const Text("Test Monero onion node connection"),
"Test Monero onion node connection",
),
), ),
], ],
), ),