mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-07-25 02:25:21 +00:00
wip: select bridges
This commit is contained in:
@@ -77,6 +77,9 @@ object TorManager {
|
|||||||
fun init(application: Application) {
|
fun init(application: Application) {
|
||||||
if (initialized) return
|
if (initialized) return
|
||||||
synchronized(this) {
|
synchronized(this) {
|
||||||
|
// Initialize bridge prefs once
|
||||||
|
try { TorBridgePreferenceManager.init(application) } catch (_: Throwable) {}
|
||||||
|
|
||||||
if (initialized) return
|
if (initialized) return
|
||||||
initialized = true
|
initialized = true
|
||||||
currentApplication = application
|
currentApplication = application
|
||||||
@@ -178,6 +181,17 @@ object TorManager {
|
|||||||
.setSocksPort(currentSocksPort)
|
.setSocksPort(currentSocksPort)
|
||||||
.setDnsPort(currentSocksPort + 1)
|
.setDnsPort(currentSocksPort + 1)
|
||||||
.setLogListener(logListener)
|
.setLogListener(logListener)
|
||||||
|
.apply {
|
||||||
|
// Apply bridge settings
|
||||||
|
val bridgesEnabled = TorBridgePreferenceManager.isEnabled(application)
|
||||||
|
if (bridgesEnabled) {
|
||||||
|
val bridgeLines = TorBridgePreferenceManager.getLines(application)
|
||||||
|
if (bridgeLines.isNotEmpty()) {
|
||||||
|
setBridgeLines(bridgeLines)
|
||||||
|
Log.i(TAG, "Using ${bridgeLines.size} bridge(s): ${bridgeLines.joinToString("; ")}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
artiProxyRef.set(proxy)
|
artiProxyRef.set(proxy)
|
||||||
|
|||||||
@@ -108,6 +108,43 @@ fun AboutSheet(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tor Bridges section (minimal)
|
||||||
|
item {
|
||||||
|
var showBridgeSheet by remember { mutableStateOf(false) }
|
||||||
|
if (showBridgeSheet) {
|
||||||
|
TorBridgeSheet(
|
||||||
|
isPresented = true,
|
||||||
|
onDismiss = { showBridgeSheet = false }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Column(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = "tor bridges",
|
||||||
|
fontSize = 12.sp,
|
||||||
|
fontFamily = FontFamily.Monospace,
|
||||||
|
fontWeight = FontWeight.Medium,
|
||||||
|
color = colorScheme.onSurface.copy(alpha = 0.8f)
|
||||||
|
)
|
||||||
|
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||||
|
Button(
|
||||||
|
onClick = { showBridgeSheet = true },
|
||||||
|
colors = ButtonDefaults.buttonColors(containerColor = Color(0xFFFF9500).copy(alpha = 0.15f)),
|
||||||
|
) {
|
||||||
|
Text("manage bridges", fontFamily = FontFamily.Monospace, color = colorScheme.onSurface)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Text(
|
||||||
|
text = "add custom bridge lines for censored networks.",
|
||||||
|
fontSize = 10.sp,
|
||||||
|
fontFamily = FontFamily.Monospace,
|
||||||
|
color = colorScheme.onSurface.copy(alpha = 0.6f)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Features section
|
// Features section
|
||||||
item {
|
item {
|
||||||
Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {
|
Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user