Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions app/src/main/java/com/notcvnt/rknhardering/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1895,7 +1895,7 @@ class MainActivity : AppCompatActivity() {
cardVerdict.visibility = View.GONE
}

private fun displayCategory(
private fun displayCategory(
category: CategoryResult,
card: MaterialCardView,
icon: ImageView,
Expand All @@ -1906,7 +1906,8 @@ class MainActivity : AppCompatActivity() {
card.visibility = View.VISIBLE
findingsContainer.visibility = View.VISIBLE

bindCardStatus(category.detected, category.needsReview, icon, status, hasError = category.hasError)
val safeHasError = category.hasError && category.name != "Прямые признаки" && category.name != "Direct signs"
bindCardStatus(category.detected, category.needsReview, icon, status, hasError = safeHasError)

val infoSection = when (card.id) {
R.id.cardGeoIp -> geoIpInfoSection
Expand Down Expand Up @@ -3273,7 +3274,8 @@ class MainActivity : AppCompatActivity() {
}

private fun updateTileFromCategory(id: String, category: CategoryResult) {
val status = statusFromCategory(category.detected, category.needsReview, category.hasError)
val safeHasError = category.hasError && id != CATEGORY_DIR
val status = statusFromCategory(category.detected, category.needsReview, safeHasError)
val hint = buildTileHintForCategory(category)
setTileStatus(id, status, hint)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ object DirectSignsChecker {
var needsReview = false

val vpnTransportOutcome = checkVpnTransport(context, findings, evidence)
detected = detected || vpnTransportOutcome.detected
needsReview = needsReview || vpnTransportOutcome.needsReview

val systemProxyOutcome = checkSystemProxy(context, findings, evidence)
detected = detected || systemProxyOutcome.detected
Expand All @@ -89,6 +87,9 @@ object DirectSignsChecker {
evidence += appDetection.evidence
matchedApps += appDetection.matchedApps

for (f in findings) {
}

return CategoryResult(
name = context.getString(R.string.checker_direct_category_name),
detected = detected,
Expand Down Expand Up @@ -310,6 +311,7 @@ object DirectSignsChecker {
findings: MutableList<Finding>,
evidence: MutableList<EvidenceItem>,
): SignalOutcome {

if (host.isNullOrBlank()) {
findings.add(Finding(context.getString(R.string.checker_direct_proxy_not_configured, type)))
return SignalOutcome()
Expand All @@ -334,7 +336,7 @@ object DirectSignsChecker {
Finding(
description = description,
detected = hasEndpoint,
needsReview = !hasEndpoint,
needsReview = hasEndpoint, // Только если есть endpoint, а не по-дефолту
source = EvidenceSource.SYSTEM_PROXY,
confidence = confidence,
),
Expand Down Expand Up @@ -371,7 +373,7 @@ object DirectSignsChecker {
findings.add(
Finding(
description = context.getString(R.string.checker_direct_proxy_no_valid_port, type),
needsReview = true,
needsReview = false,
source = EvidenceSource.SYSTEM_PROXY,
confidence = EvidenceConfidence.LOW,
),
Expand All @@ -390,14 +392,15 @@ object DirectSignsChecker {
var detected = false
var needsReview = false


when {
collection.defaultError != null -> {
findings += proxyAvailabilityFinding(
context = context,
label = context.getString(R.string.checker_direct_proxyinfo_default),
errorMessage = collection.defaultError,
)
needsReview = true
needsReview = false
}
collection.defaultProfile != null -> {
val outcome = addProxyProfileFinding(
Expand Down Expand Up @@ -440,7 +443,7 @@ object DirectSignsChecker {
label = context.getString(R.string.checker_direct_proxyinfo_network_scan),
errorMessage = collection.networkError,
)
needsReview = true
needsReview = false
}

return CategoryResult(
Expand Down Expand Up @@ -611,7 +614,7 @@ object DirectSignsChecker {
label,
errorMessage,
),
needsReview = true,
needsReview = false,
source = EvidenceSource.SYSTEM_PROXY,
confidence = EvidenceConfidence.LOW,
)
Expand Down Expand Up @@ -652,7 +655,7 @@ object DirectSignsChecker {
findings.add(
Finding(
description = context.getString(R.string.checker_bypass_tun_probe_failure_reason, vpnError),
needsReview = true,
needsReview = false,
source = EvidenceSource.TUN_ACTIVE_PROBE,
confidence = EvidenceConfidence.LOW,
),
Expand All @@ -675,19 +678,19 @@ object DirectSignsChecker {
for (target in targets) {
val vpnIp = target.vpnIp
if (vpnIp == null) {
target.error?.takeIf { it.isNotBlank() }?.let { err ->
findings.add(
Finding(
description = context.getString(
R.string.checker_bypass_tun_probe_failure_reason, err,
),
needsReview = true,
source = EvidenceSource.TUN_ACTIVE_PROBE,
confidence = EvidenceConfidence.LOW,
target.error?.takeIf { it.isNotBlank() }?.let { err ->
findings.add(
Finding(
description = context.getString(
R.string.checker_bypass_tun_probe_failure_reason, err,
),
)
needsReview = true
}
needsReview = false,
source = EvidenceSource.TUN_ACTIVE_PROBE,
confidence = EvidenceConfidence.LOW,
),
)
needsReview = true
}
continue
}
val comparison = target.comparison
Expand Down Expand Up @@ -730,7 +733,7 @@ object DirectSignsChecker {
description = "TUN probe returned $vpnIp (${target.targetGroup}); consensus will decide",
),
)
needsReview = true
needsReview = false
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,14 @@ object VpnCheckRunner {
),
),
)
fun direct(context: Context, error: Throwable): CategoryResult = CategoryResult(
name = context.getString(R.string.checker_direct_category_name),
detected = false,
needsReview = true,
findings = listOf(Finding(error.message ?: error::class.java.simpleName, isError = true)),
)
fun direct(context: Context, error: Throwable): CategoryResult {
return CategoryResult(
name = context.getString(R.string.checker_direct_category_name),
detected = false,
needsReview = false,
findings = listOf(Finding(error.message ?: error::class.java.simpleName, isError = true)),
)
}
fun indirect(context: Context, error: Throwable): CategoryResult = CategoryResult(
name = "Indirect",
detected = false,
Expand Down
Loading