fix proxy auto start issue
This commit is contained in:
@@ -139,23 +139,6 @@ class SingboxProxyRuntimeRepository extends _$SingboxProxyRuntimeRepository {
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> ensureProxyConnectionAvailable(
|
||||
SingboxProxyConnectionId connectionId,
|
||||
) async {
|
||||
await _lock.synchronized(() async {
|
||||
final currentState = await _stateSnapshotUnlocked();
|
||||
final isRunning = currentState.endpoints.any(
|
||||
(endpoint) => endpoint.profileId == connectionId.encode(),
|
||||
);
|
||||
if (isRunning) return;
|
||||
|
||||
final activeProfileIds = _activeProfileIds(currentState);
|
||||
await _startProfilesUnlocked(
|
||||
{...activeProfileIds, connectionId.profileId}.toList(),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Set<String> _activeProfileIds(SingboxProxyRuntimeState runtimeState) {
|
||||
return runtimeState.endpoints
|
||||
.map((endpoint) => ProxyConnectionId.decode(endpoint.profileId))
|
||||
|
||||
@@ -87,7 +87,7 @@ final class SingboxProxyRuntimeRepositoryProvider
|
||||
}
|
||||
|
||||
String _$singboxProxyRuntimeRepositoryHash() =>
|
||||
r'665908eaff34569f7a19dc5328a067711d1937f2';
|
||||
r'bb84ab57abd3b7261105da85d3e047cef1b31a44';
|
||||
|
||||
abstract class _$SingboxProxyRuntimeRepository
|
||||
extends $AsyncNotifier<SingboxProxyRuntimeState> {
|
||||
|
||||
@@ -42,7 +42,7 @@ final class ProxyInputConsumerProvider
|
||||
}
|
||||
|
||||
String _$proxyInputConsumerHash() =>
|
||||
r'fed529f253a9bdf72d0b1c23a298765b681d07b8';
|
||||
r'8958cb3ff089779c1991390a7d6062cef74b0588';
|
||||
|
||||
abstract class _$ProxyInputConsumer extends $Notifier<void> {
|
||||
void build();
|
||||
|
||||
@@ -81,7 +81,7 @@ final class SingboxProxyEndpointSyncProvider
|
||||
}
|
||||
|
||||
String _$singboxProxyEndpointSyncHash() =>
|
||||
r'2d6b0641db33638b0b339b510dd63cdddab7f7cf';
|
||||
r'8aeb4097d02c2f6ea37fdb2de26b399d2e6042c2';
|
||||
|
||||
/// Mirrors the sing-box runtime's active SOCKS endpoints into Gecko's
|
||||
/// container-proxy registry. Listens to [singboxProxyRuntimeRepositoryProvider]
|
||||
|
||||
Reference in New Issue
Block a user