Add proxy routing and sing-box support

This commit is contained in:
Fabian Freund
2026-05-22 18:16:31 +02:00
parent 51289f1266
commit a5974617aa
262 changed files with 32003 additions and 3962 deletions
@@ -61,6 +61,12 @@ import 'package:weblibre/features/geckoview/features/tabs/presentation/screens/c
import 'package:weblibre/features/geckoview/features/tabs/presentation/screens/container_list.dart';
import 'package:weblibre/features/geckoview/features/tabs/presentation/screens/container_selection.dart';
import 'package:weblibre/features/onboarding/presentation/onboarding.dart';
import 'package:weblibre/features/proxy/data/models/proxy_profile_seed.dart';
import 'package:weblibre/features/proxy/presentation/screens/proxy_routing_settings.dart';
import 'package:weblibre/features/proxy/presentation/screens/singbox_proxy_logs.dart';
import 'package:weblibre/features/proxy/presentation/screens/singbox_proxy_profile_editor.dart';
import 'package:weblibre/features/proxy/presentation/screens/singbox_proxy_profiles.dart';
import 'package:weblibre/features/proxy/presentation/screens/subscription_import.dart';
import 'package:weblibre/features/settings/presentation/screens/addon_collection.dart';
import 'package:weblibre/features/settings/presentation/screens/advanced_settings.dart';
import 'package:weblibre/features/settings/presentation/screens/bang_settings.dart';
@@ -75,6 +81,7 @@ import 'package:weblibre/features/settings/presentation/screens/fingerprint_sett
import 'package:weblibre/features/settings/presentation/screens/general_settings.dart';
import 'package:weblibre/features/settings/presentation/screens/locale_settings.dart';
import 'package:weblibre/features/settings/presentation/screens/privacy_security_settings.dart';
import 'package:weblibre/features/settings/presentation/screens/proxy_settings.dart';
import 'package:weblibre/features/settings/presentation/screens/search_settings.dart';
import 'package:weblibre/features/settings/presentation/screens/settings.dart';
import 'package:weblibre/features/settings/presentation/screens/toolbar_layout_settings.dart';
@@ -1660,6 +1660,38 @@ RouteBase get $settingsRoute => GoRouteData.$route(
name: 'ContextualToolbarSettingsRoute',
factory: $ContextualToolbarSettingsRoute._fromState,
),
GoRouteData.$route(
path: 'singbox_proxy_profiles',
name: 'SingboxProxyProfilesRoute',
factory: $SingboxProxyProfilesRoute._fromState,
routes: [
GoRouteData.$route(
path: 'editor',
name: 'SingboxProxyProfileEditorRoute',
factory: $SingboxProxyProfileEditorRoute._fromState,
),
GoRouteData.$route(
path: 'logs',
name: 'SingboxProxyLogsRoute',
factory: $SingboxProxyLogsRoute._fromState,
),
GoRouteData.$route(
path: 'subscription',
name: 'SubscriptionImportRoute',
factory: $SubscriptionImportRoute._fromState,
),
],
),
GoRouteData.$route(
path: 'proxy_routing',
name: 'ProxyRoutingSettingsRoute',
factory: $ProxyRoutingSettingsRoute._fromState,
),
GoRouteData.$route(
path: 'proxy',
name: 'ProxySettingsRoute',
factory: $ProxySettingsRoute._fromState,
),
],
);
@@ -2213,6 +2245,146 @@ mixin $ContextualToolbarSettingsRoute on GoRouteData {
void replace(BuildContext context) => context.replace(location);
}
mixin $SingboxProxyProfilesRoute on GoRouteData {
static SingboxProxyProfilesRoute _fromState(GoRouterState state) =>
const SingboxProxyProfilesRoute();
@override
String get location =>
GoRouteData.$location('/settings/singbox_proxy_profiles');
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
mixin $SingboxProxyProfileEditorRoute on GoRouteData {
static SingboxProxyProfileEditorRoute _fromState(GoRouterState state) =>
SingboxProxyProfileEditorRoute(
profileId: state.uri.queryParameters['profile-id'],
$extra: state.extra as ProxyProfileSeed?,
);
SingboxProxyProfileEditorRoute get _self =>
this as SingboxProxyProfileEditorRoute;
@override
String get location => GoRouteData.$location(
'/settings/singbox_proxy_profiles/editor',
queryParams: {if (_self.profileId != null) 'profile-id': _self.profileId},
);
@override
void go(BuildContext context) => context.go(location, extra: _self.$extra);
@override
Future<T?> push<T>(BuildContext context) =>
context.push<T>(location, extra: _self.$extra);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location, extra: _self.$extra);
@override
void replace(BuildContext context) =>
context.replace(location, extra: _self.$extra);
}
mixin $SingboxProxyLogsRoute on GoRouteData {
static SingboxProxyLogsRoute _fromState(GoRouterState state) =>
const SingboxProxyLogsRoute();
@override
String get location =>
GoRouteData.$location('/settings/singbox_proxy_profiles/logs');
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
mixin $SubscriptionImportRoute on GoRouteData {
static SubscriptionImportRoute _fromState(GoRouterState state) =>
const SubscriptionImportRoute();
@override
String get location =>
GoRouteData.$location('/settings/singbox_proxy_profiles/subscription');
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
mixin $ProxyRoutingSettingsRoute on GoRouteData {
static ProxyRoutingSettingsRoute _fromState(GoRouterState state) =>
const ProxyRoutingSettingsRoute();
@override
String get location => GoRouteData.$location('/settings/proxy_routing');
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
mixin $ProxySettingsRoute on GoRouteData {
static ProxySettingsRoute _fromState(GoRouterState state) =>
const ProxySettingsRoute();
@override
String get location => GoRouteData.$location('/settings/proxy');
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
RouteBase get $torProxyRoute => GoRouteData.$route(
path: '/tor',
name: 'TorProxyRoute',
@@ -113,6 +113,29 @@ part of 'routes.dart';
name: 'ContextualToolbarSettingsRoute',
path: 'contextual_toolbar',
),
TypedGoRoute<SingboxProxyProfilesRoute>(
name: 'SingboxProxyProfilesRoute',
path: 'singbox_proxy_profiles',
routes: [
TypedGoRoute<SingboxProxyProfileEditorRoute>(
name: 'SingboxProxyProfileEditorRoute',
path: 'editor',
),
TypedGoRoute<SingboxProxyLogsRoute>(
name: 'SingboxProxyLogsRoute',
path: 'logs',
),
TypedGoRoute<SubscriptionImportRoute>(
name: 'SubscriptionImportRoute',
path: 'subscription',
),
],
),
TypedGoRoute<ProxyRoutingSettingsRoute>(
name: 'ProxyRoutingSettingsRoute',
path: 'proxy_routing',
),
TypedGoRoute<ProxySettingsRoute>(name: 'ProxySettingsRoute', path: 'proxy'),
],
)
class SettingsRoute extends GoRouteData with $SettingsRoute {
@@ -315,3 +338,64 @@ class ContextualToolbarSettingsRoute extends GoRouteData
return const ContextualToolbarSettingsScreen();
}
}
class SingboxProxyProfilesRoute extends GoRouteData
with $SingboxProxyProfilesRoute {
const SingboxProxyProfilesRoute();
@override
Widget build(BuildContext context, GoRouterState state) {
return const SingboxProxyProfilesScreen();
}
}
class SingboxProxyProfileEditorRoute extends GoRouteData
with $SingboxProxyProfileEditorRoute {
final String? profileId;
final ProxyProfileSeed? $extra;
const SingboxProxyProfileEditorRoute({this.profileId, this.$extra});
@override
Widget build(BuildContext context, GoRouterState state) {
return SingboxProxyProfileEditorScreen(profileId: profileId, seed: $extra);
}
}
class SingboxProxyLogsRoute extends GoRouteData with $SingboxProxyLogsRoute {
const SingboxProxyLogsRoute();
@override
Widget build(BuildContext context, GoRouterState state) {
return const SingboxProxyLogsScreen();
}
}
class SubscriptionImportRoute extends GoRouteData
with $SubscriptionImportRoute {
const SubscriptionImportRoute();
@override
Widget build(BuildContext context, GoRouterState state) {
return const SubscriptionImportScreen();
}
}
class ProxyRoutingSettingsRoute extends GoRouteData
with $ProxyRoutingSettingsRoute {
const ProxyRoutingSettingsRoute();
@override
Widget build(BuildContext context, GoRouterState state) {
return const ProxyRoutingSettingsScreen();
}
}
class ProxySettingsRoute extends GoRouteData with $ProxySettingsRoute {
const ProxySettingsRoute();
@override
Widget build(BuildContext context, GoRouterState state) {
return const ProxySettingsScreen();
}
}