branding fixes
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:fast_equatable/fast_equatable.dart';
|
||||
import 'package:weblibre/core/branding/proxy_brands.dart';
|
||||
import 'package:weblibre/features/proxy/data/parsers/host_port.dart';
|
||||
|
||||
class WireguardConfigImport with FastEquatable {
|
||||
@@ -42,7 +43,7 @@ class WireguardConfigImport with FastEquatable {
|
||||
final peer = sections['peer'];
|
||||
if (interface == null || peer == null) {
|
||||
throw const FormatException(
|
||||
'WireGuard config must contain [Interface] and [Peer] sections.',
|
||||
'$wireGuardBrand config must contain [Interface] and [Peer] sections.',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -51,7 +52,7 @@ class WireguardConfigImport with FastEquatable {
|
||||
? (host: '', port: '')
|
||||
: parseHostPort(
|
||||
rawEndpoint,
|
||||
invalidMessage: 'WireGuard endpoint must be host:port.',
|
||||
invalidMessage: '$wireGuardBrand endpoint must be host:port.',
|
||||
);
|
||||
final mtu = interface['mtu']?.trim();
|
||||
|
||||
@@ -103,7 +104,9 @@ Map<String, Map<String, String>> _parseWireguardConfig(String configText) {
|
||||
if (line.startsWith('[') && line.endsWith(']')) {
|
||||
currentSection = line.substring(1, line.length - 1).trim().toLowerCase();
|
||||
if (currentSection.isEmpty) {
|
||||
throw const FormatException('WireGuard config contains empty section.');
|
||||
throw const FormatException(
|
||||
'$wireGuardBrand config contains empty section.',
|
||||
);
|
||||
}
|
||||
sections.putIfAbsent(currentSection, () => <String, String>{});
|
||||
continue;
|
||||
@@ -111,19 +114,19 @@ Map<String, Map<String, String>> _parseWireguardConfig(String configText) {
|
||||
|
||||
if (currentSection == null) {
|
||||
throw const FormatException(
|
||||
'WireGuard config entries must be inside a section.',
|
||||
'$wireGuardBrand config entries must be inside a section.',
|
||||
);
|
||||
}
|
||||
|
||||
final separatorIndex = line.indexOf('=');
|
||||
if (separatorIndex < 1) {
|
||||
throw FormatException('Invalid WireGuard config line: $rawLine');
|
||||
throw FormatException('Invalid $wireGuardBrand config line: $rawLine');
|
||||
}
|
||||
|
||||
final key = line.substring(0, separatorIndex).trim().toLowerCase();
|
||||
final value = line.substring(separatorIndex + 1).trim();
|
||||
if (key.isEmpty) {
|
||||
throw FormatException('Invalid WireGuard config line: $rawLine');
|
||||
throw FormatException('Invalid $wireGuardBrand config line: $rawLine');
|
||||
}
|
||||
sections[currentSection]![key] = value;
|
||||
}
|
||||
|
||||
+3
-1
@@ -19,6 +19,8 @@
|
||||
*/
|
||||
import 'package:flutter_singbox_proxy/flutter_singbox_proxy.dart';
|
||||
|
||||
import 'package:weblibre/core/branding/proxy_brands.dart';
|
||||
|
||||
extension SingboxProxyProfileTypeExt on SingboxProxyProfileType {
|
||||
/// Long human label for menus, dialogs, subtitles.
|
||||
String get label => switch (this) {
|
||||
@@ -33,7 +35,7 @@ extension SingboxProxyProfileTypeExt on SingboxProxyProfileType {
|
||||
SingboxProxyProfileType.hysteria2 => 'Hysteria2',
|
||||
SingboxProxyProfileType.tuic => 'TUIC',
|
||||
SingboxProxyProfileType.ssh => 'SSH',
|
||||
SingboxProxyProfileType.wireguard => 'WireGuard',
|
||||
SingboxProxyProfileType.wireguard => wireGuardBrand,
|
||||
SingboxProxyProfileType.shadowTls => 'ShadowTLS',
|
||||
SingboxProxyProfileType.anyTls => 'AnyTLS',
|
||||
SingboxProxyProfileType.customOutbound => 'Custom Outbound',
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*/
|
||||
import 'package:fast_equatable/fast_equatable.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:weblibre/core/branding/proxy_brands.dart';
|
||||
import 'package:weblibre/core/logger.dart';
|
||||
import 'package:weblibre/features/proxy/data/models/singbox_proxy_profile.dart';
|
||||
import 'package:weblibre/features/proxy/data/proxy_connection.dart';
|
||||
@@ -61,8 +62,8 @@ List<ProxyConnectionOption> proxyConnectionOptions(Ref ref) {
|
||||
return [
|
||||
ProxyConnectionOption(
|
||||
id: const TorProxyConnectionId(),
|
||||
title: 'Tor',
|
||||
subtitle: 'Route through the Tor network',
|
||||
title: torBrand,
|
||||
subtitle: 'Route through the $torNetworkLabel',
|
||||
),
|
||||
for (final profile in singboxProfiles)
|
||||
ProxyConnectionOption(
|
||||
|
||||
@@ -22,6 +22,7 @@ import 'dart:async';
|
||||
import 'package:flutter_mozilla_components/flutter_mozilla_components.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:synchronized/synchronized.dart';
|
||||
import 'package:weblibre/core/branding/proxy_brands.dart';
|
||||
import 'package:weblibre/features/geckoview/features/tabs/data/models/site_assignment.dart';
|
||||
import 'package:weblibre/features/proxy/data/proxy_connection.dart';
|
||||
|
||||
@@ -57,7 +58,7 @@ class ContainerProxyRepository extends _$ContainerProxyRepository {
|
||||
return _service.upsertProxy(
|
||||
GeckoProxySettings(
|
||||
id: const TorProxyConnectionId().encode(),
|
||||
title: 'Tor',
|
||||
title: torBrand,
|
||||
type: 'socks',
|
||||
host: '127.0.0.1',
|
||||
port: port,
|
||||
|
||||
@@ -22,6 +22,7 @@ import 'dart:convert';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter_singbox_proxy/flutter_singbox_proxy.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:weblibre/core/branding/proxy_brands.dart';
|
||||
import 'package:weblibre/core/logger.dart';
|
||||
import 'package:weblibre/features/proxy/data/forms/singbox_form_specs.dart';
|
||||
import 'package:weblibre/features/proxy/data/models/proxy_profile_seed.dart';
|
||||
@@ -70,8 +71,8 @@ class ProxyInputConsumer extends _$ProxyInputConsumer {
|
||||
|
||||
if (_looksLikeWireguardConf(trimmed)) {
|
||||
return _seedOutcome(
|
||||
() => _seedFromWireguardConf(trimmed, fileName: 'WireGuard'),
|
||||
logMessage: 'Failed to parse WireGuard configuration',
|
||||
() => _seedFromWireguardConf(trimmed, fileName: wireGuardBrand),
|
||||
logMessage: 'Failed to parse $wireGuardBrand configuration',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_singbox_proxy/flutter_singbox_proxy.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:socks5_proxy/socks_client.dart';
|
||||
import 'package:weblibre/core/branding/proxy_brands.dart';
|
||||
import 'package:weblibre/features/proxy/data/proxy_connection.dart';
|
||||
import 'package:weblibre/features/proxy/domain/repositories/singbox_proxy_runtime.dart';
|
||||
import 'package:weblibre/features/tor/domain/extensions/tor_status_x.dart';
|
||||
@@ -118,7 +119,7 @@ class ProxyLatencyResults extends _$ProxyLatencyResults {
|
||||
if (socksPort == null) {
|
||||
_set(
|
||||
const TorProxyConnectionId(),
|
||||
AsyncError('Tor is not ready', StackTrace.current),
|
||||
AsyncError('$torBrand is not ready', StackTrace.current),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
import 'package:weblibre/core/branding/proxy_brands.dart';
|
||||
import 'package:weblibre/features/proxy/data/models/proxy_log_message.dart';
|
||||
import 'package:weblibre/features/proxy/domain/repositories/singbox_proxy_logs.dart';
|
||||
import 'package:weblibre/utils/ui_helper.dart';
|
||||
@@ -202,7 +203,7 @@ class _EmptyLogs extends StatelessWidget {
|
||||
child: Text(
|
||||
hasFilter
|
||||
? 'No log lines match the current filter.'
|
||||
: 'No log lines yet. Start a proxy or Tor to see output here.',
|
||||
: 'No log lines yet. Start a proxy or $torBrand to see output here.',
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
|
||||
+26
@@ -22,6 +22,8 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:flutter_singbox_proxy/flutter_singbox_proxy.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
|
||||
import 'package:weblibre/core/branding/proxy_brands.dart';
|
||||
import 'package:weblibre/features/proxy/data/forms/singbox_form_specs.dart';
|
||||
import 'package:weblibre/features/proxy/data/models/proxy_profile_seed.dart';
|
||||
import 'package:weblibre/features/proxy/domain/extensions/singbox_proxy_profile_type_x.dart';
|
||||
@@ -161,6 +163,10 @@ class _Editor extends ConsumerWidget {
|
||||
?.copyWith(color: scheme.onSurfaceVariant),
|
||||
),
|
||||
),
|
||||
if (draft.type == SingboxProxyProfileType.wireguard) ...[
|
||||
const SizedBox(height: 12),
|
||||
const _WireGuardDisclaimer(),
|
||||
],
|
||||
]),
|
||||
),
|
||||
),
|
||||
@@ -173,6 +179,26 @@ class _Editor extends ConsumerWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class _WireGuardDisclaimer extends StatelessWidget {
|
||||
const _WireGuardDisclaimer();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Text(
|
||||
'$wireGuardBrand is a registered trademark of Jason A. Donenfeld; all '
|
||||
'rights reserved. WebLibre is not endorsed or sponsored by, or '
|
||||
'affiliated with, Jason A. Donenfeld.',
|
||||
style: Theme.of(
|
||||
context,
|
||||
).textTheme.bodySmall?.copyWith(color: scheme.onSurfaceVariant),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _GeneralSection extends HookConsumerWidget {
|
||||
final ProxyProfileDraftProvider draftProvider;
|
||||
final ProxyProfileDraftState draft;
|
||||
|
||||
@@ -22,6 +22,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:qr_code_scanner_plus/qr_code_scanner_plus.dart';
|
||||
import 'package:weblibre/core/branding/proxy_brands.dart';
|
||||
import 'package:weblibre/features/proxy/data/models/proxy_profile_seed.dart';
|
||||
import 'package:weblibre/features/proxy/domain/services/proxy_input_consumer.dart';
|
||||
import 'package:weblibre/features/qr_scanner/presentation/dialogs/qr_scanner_dialog.dart';
|
||||
@@ -274,7 +275,7 @@ class _FileKindPicker extends StatelessWidget {
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.vpn_lock),
|
||||
title: const Text('WireGuard config'),
|
||||
title: const Text(wireGuardConfigLabel),
|
||||
subtitle: const Text('.conf file with [Interface]/[Peer]'),
|
||||
onTap: () =>
|
||||
Navigator.of(context).pop(ProxyFileImportKind.wireguardConf),
|
||||
|
||||
+2
-1
@@ -22,6 +22,7 @@ import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:weblibre/core/branding/proxy_brands.dart';
|
||||
import 'package:weblibre/features/proxy/presentation/controllers/proxy_profile_draft_controller.dart';
|
||||
import 'package:weblibre/features/user/data/models/proxy_dns_override.dart';
|
||||
|
||||
@@ -87,7 +88,7 @@ class ProfileDnsOverrideSection extends HookConsumerWidget {
|
||||
children: [
|
||||
Text(
|
||||
'Resolve names through a server reachable inside this profile '
|
||||
'(e.g. an internal DoH server behind a corporate WireGuard). '
|
||||
'(e.g. an internal DoH server behind a corporate $wireGuardBrand tunnel). '
|
||||
'Leave off to use automatic DNS handling.',
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*/
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:weblibre/core/branding/proxy_brands.dart';
|
||||
import 'package:weblibre/core/logger.dart';
|
||||
import 'package:weblibre/core/routing/routes.dart';
|
||||
import 'package:weblibre/features/proxy/data/proxy_connection.dart';
|
||||
@@ -72,7 +73,7 @@ class TorProfileTile extends ConsumerWidget {
|
||||
child: Icon(TorIcons.onionAlt, color: foreground, size: 24),
|
||||
),
|
||||
title: Text(
|
||||
'Tor',
|
||||
torBrand,
|
||||
style: TextStyle(
|
||||
fontWeight: isRunning ? FontWeight.w600 : FontWeight.w500,
|
||||
),
|
||||
@@ -145,8 +146,8 @@ class TorProfileTile extends ConsumerWidget {
|
||||
showErrorMessage(
|
||||
context,
|
||||
isRunning
|
||||
? 'Failed to stop Tor: $error'
|
||||
: 'Failed to start Tor: $error',
|
||||
? 'Failed to stop $torBrand: $error'
|
||||
: 'Failed to start $torBrand: $error',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user