Two-box throttle system + support top-up
- Server: two Xray inbounds (vless-normal / vless-throttled), 4GB threshold, management loop moves users between boxes instead of hard-killing. /session/status returns dynamic vless_path + is_throttled. Support ad callback (ad_type: support) extends session +30min +2GB. No hard quota kill — only 60-min expiry removes sessions. - App: session_timer detects vless_path change in 5s poll, triggers silent reconnect (skipCleanup, skipAdBypass, quickReconnect). New support_button.dart for top-up rewarded ads. hivemind_service uses server vless_path instead of hardcoded constant. vpn_connection: skipAdBypass, quickReconnect, skipCleanup params. - Config: Xray two-inbound template, nginx /tunnel-throttled with limit_rate 187k (1.5 Mbps). Updated AGENTS.md + SERVER_SETUP.md.
This commit is contained in:
1 parent
6825a264a5
commit
efcfe6e706
6 files changed
+282
-63
No files matched your search
@@ -24,6 +24,8 @@ class HivemindService {
|
||||
/// has usually already fired.
|
||||
static Future<String> fetchConfigWithPolling({
|
||||
void Function(int attempt, int total)? onAttempt,
|
||||
bool skipAdBypass = false,
|
||||
bool quickReconnect = false,
|
||||
}) async {
|
||||
final deviceId = await CryptoService.getDeviceId();
|
||||
|
||||
@@ -35,7 +37,7 @@ class HivemindService {
|
||||
final url = Uri.parse('${AppConfig.hivemindApiBase}/session/status?device_id=$deviceId');
|
||||
|
||||
// ── AD BYPASS (debug only) ────────────────────────────────────────
|
||||
if (kDebugMode) {
|
||||
if (kDebugMode && !skipAdBypass) {
|
||||
try {
|
||||
final customData = jsonEncode({'device_id': deviceId, 'nonce': nonce});
|
||||
final fakeUrl = Uri.parse(
|
||||
@@ -44,7 +46,7 @@ class HivemindService {
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
const maxAttempts = 5;
|
||||
final maxAttempts = quickReconnect ? 1 : 5;
|
||||
for (int i = 1; i <= maxAttempts; i++) {
|
||||
if (_currentCallId != callId) throw Exception('Cancelled');
|
||||
|
||||
@@ -59,8 +61,9 @@ class HivemindService {
|
||||
debugPrint('[HivemindService] Nonce mismatch — retrying…');
|
||||
} else if (data['active'] == true && data['vless_uuid'] != null) {
|
||||
final vlessUuid = data['vless_uuid'];
|
||||
final vlessPath = data['vless_path'] ?? AppConfig.vlessPath;
|
||||
final vlessUrl = 'vless://$vlessUuid@${AppConfig.serverDomain}:${AppConfig.serverPort}'
|
||||
'?path=${Uri.encodeComponent(AppConfig.vlessPath)}'
|
||||
'?path=${Uri.encodeComponent(vlessPath)}'
|
||||
'&security=${AppConfig.vlessSecurity}'
|
||||
'&type=${AppConfig.vlessType}'
|
||||
'#ReVoltVPN';
|
||||
|
||||
Reference in new issue
Block a user