Add proxy routing and sing-box support
This commit is contained in:
@@ -28,9 +28,10 @@ import 'package:weblibre/features/geckoview/domain/entities/states/tab.dart';
|
||||
import 'package:weblibre/features/geckoview/domain/providers/tab_state.dart';
|
||||
import 'package:weblibre/features/geckoview/features/tabs/data/entities/tab_mode.dart';
|
||||
import 'package:weblibre/features/geckoview/features/tabs/domain/repositories/tab.dart';
|
||||
import 'package:weblibre/features/proxy/data/proxy_connection.dart';
|
||||
import 'package:weblibre/features/tor/domain/services/tor_proxy.dart';
|
||||
import 'package:weblibre/features/user/data/models/tor_settings.dart';
|
||||
import 'package:weblibre/features/user/domain/repositories/tor_settings.dart';
|
||||
import 'package:weblibre/features/user/data/models/proxy_routing_settings.dart';
|
||||
import 'package:weblibre/features/user/domain/repositories/proxy_routing_settings.dart';
|
||||
|
||||
part 'website_title.g.dart';
|
||||
|
||||
@@ -86,13 +87,19 @@ Future<WebPageInfo> pageInfo(
|
||||
.read(tabDataRepositoryProvider.notifier)
|
||||
.getTabContainerData(tabState!.id);
|
||||
|
||||
final torSettings = ref.read(torSettingsWithDefaultsProvider);
|
||||
final proxyRoutingSettings = ref.read(
|
||||
proxyRoutingSettingsWithDefaultsProvider,
|
||||
);
|
||||
|
||||
if (containerData?.metadata.useProxy == true ||
|
||||
if (containerData?.metadata.proxyConnectionId is TorProxyConnectionId ||
|
||||
(tabState.tabMode is! PrivateTabMode &&
|
||||
torSettings.proxyRegularTabsMode == TorRegularTabProxyMode.all) ||
|
||||
proxyRoutingSettings.regularTabsMode ==
|
||||
ProxyRegularTabRoutingMode.all &&
|
||||
proxyRoutingSettings.regularTabsProxyConnectionId
|
||||
is TorProxyConnectionId) ||
|
||||
(tabState.tabMode is PrivateTabMode &&
|
||||
torSettings.proxyPrivateTabsTor)) {
|
||||
proxyRoutingSettings.privateTabsProxyConnectionId
|
||||
is TorProxyConnectionId)) {
|
||||
proxyPort = await ref.read(
|
||||
torProxyServiceProvider.selectAsync((value) => value.socksPort),
|
||||
);
|
||||
|
||||
@@ -162,7 +162,7 @@ final class PageInfoProvider
|
||||
}
|
||||
}
|
||||
|
||||
String _$pageInfoHash() => r'9a379657c8a3f353aba1dfb0f66b9100ce494fc5';
|
||||
String _$pageInfoHash() => r'1dedc23d2420c950c7cec57500e99c5c221ed6e2';
|
||||
|
||||
final class PageInfoFamily extends $Family
|
||||
with
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2024-2026 Fabian Freund.
|
||||
*
|
||||
* This file is part of WebLibre
|
||||
* (see https://weblibre.eu).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ButtonSpinner extends StatelessWidget {
|
||||
final double dimension;
|
||||
|
||||
const ButtonSpinner({super.key, this.dimension = 18});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox.square(
|
||||
dimension: dimension,
|
||||
child: const CircularProgressIndicator(strokeWidth: 2),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (c) 2024-2026 Fabian Freund.
|
||||
*
|
||||
* This file is part of WebLibre
|
||||
* (see https://weblibre.eu).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
|
||||
/// A [TextField] for secret values. Hidden by default; tap the trailing eye
|
||||
/// icon to reveal. Obscuring forces single-line; [revealedMinLines] and
|
||||
/// [revealedMaxLines] control how the field expands once revealed.
|
||||
class ObscurableTextField extends HookWidget {
|
||||
final TextEditingController? controller;
|
||||
final bool enabled;
|
||||
final InputDecoration decoration;
|
||||
final TextInputAction? textInputAction;
|
||||
final TextInputType? keyboardType;
|
||||
final int? revealedMinLines;
|
||||
final int? revealedMaxLines;
|
||||
final ValueChanged<String>? onChanged;
|
||||
|
||||
const ObscurableTextField({
|
||||
super.key,
|
||||
this.controller,
|
||||
this.enabled = true,
|
||||
this.decoration = const InputDecoration(),
|
||||
this.textInputAction,
|
||||
this.keyboardType,
|
||||
this.revealedMinLines,
|
||||
this.revealedMaxLines,
|
||||
this.onChanged,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final obscured = useState(true);
|
||||
|
||||
final suffix = IconButton(
|
||||
tooltip: obscured.value ? 'Show' : 'Hide',
|
||||
icon: Icon(
|
||||
obscured.value
|
||||
? Icons.visibility_outlined
|
||||
: Icons.visibility_off_outlined,
|
||||
),
|
||||
onPressed: enabled ? () => obscured.value = !obscured.value : null,
|
||||
);
|
||||
|
||||
return TextField(
|
||||
controller: controller,
|
||||
enabled: enabled,
|
||||
obscureText: obscured.value,
|
||||
keyboardType: keyboardType,
|
||||
textInputAction: textInputAction,
|
||||
minLines: obscured.value ? 1 : revealedMinLines,
|
||||
maxLines: obscured.value ? 1 : (revealedMaxLines ?? 1),
|
||||
autocorrect: false,
|
||||
enableSuggestions: false,
|
||||
decoration: decoration.copyWith(suffixIcon: suffix),
|
||||
onChanged: onChanged,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user