Skip to content
Merged
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 1.1.0 — upozornění na novou verzi a výrobce Wi-Fi (2026-11-02)

- Při spuštění aplikace se zkontroluje nová verze a nabídne se v okně s volbami Stáhnout, Zavřít a Nepřipomínat tuto verzi; bez notifikací na pozadí.
- U skenu Wi-Fi je vidět, kolik skenů zbývá v limitu Androidu (4 za 2 minuty) a kdy bude další; aplikace přebírá i výsledky skenů, které telefon provedl sám, a nabízí návod k vypnutí omezení v Možnostech pro vývojáře.
- Výrobce přístupového bodu pod názvem sítě podle offline seznamu IEEE OUI (bez síťového dotazu; u náhodných BSSID se nezobrazuje).
- Chyby importu SSH profilů na iOS jsou konkrétní a nezahodí náhled; export z iOS se označuje vlastním zdrojem.

## 1.0.1 — SSH profily a iOS ve zdrojích (2026-11-01)

- Export SSH profilů v novém formátu v2 (typ ověření, startovací příkaz, keepalive, pořadí; bez hesel a klíčů) a import v1, v2 i starších exportů z telefonu.
Expand Down
6 changes: 6 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ SLF4J API (testovací závislost) — MIT; docs/licenses/slf4j-api-META-INF_LICE
jQuery WebJar (prostředek testovacích reportů) — MIT, OpenJS Foundation
and other contributors; https://jquery.org/license/.

IEEE OUI Public Listing (MA-L, MA-M, MA-S; jen prefixy a názvy organizací, staženo
2026-11-02 z https://standards-oui.ieee.org/). Podle prohlášení IEEE, citovaného v copyright
souboru Debian ieee-data, IEEE k seznamu nenárokuje autorská práva ani neomezuje jeho šíření
(„does not assert any copyright … or attempt to restrict distribution“); Debian soubor zařazuje
jako „other“ / Public Domain. Podrobnosti: androidApp/src/main/assets/licenses/ieee-oui-NOTICE.txt.

Manrope — Copyright 2018 The Manrope Project Authors; SIL OFL 1.1.
JetBrains Mono — Copyright 2020 The JetBrains Mono Project Authors; SIL OFL 1.1.
Úplné licence dodané společně s fonty:
Expand Down
2 changes: 1 addition & 1 deletion androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
alias(libs.plugins.kotlin.compose)
}
/** Release version; versionCode = major*10000 + minor*100 + patch (docs/distribuce.md §2). */
val netkitVersion = "1.0.1"
val netkitVersion = "1.1.0"
val netkitVersionCode = netkitVersion.split('.').map(String::toInt).let { (major, minor, patch) ->
require(minor in 0..99 && patch in 0..99) { "minor and patch must be 0..99" }
major * 10000 + minor * 100 + patch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,17 @@ class M1Instrumentation : Instrumentation() {
phase=arguments.getString("phase").orEmpty()
try {
check(runId.matches(Regex("[a-f0-9]{32}"))) { "Invalid runId" }
check(phase in listOf("ui","lan","ssh","wifi","wifi-denied","ssh-ui","ssh-rotated","lan-confirm","ssh-lifecycle","ssh-legacy","lan-discovery","lan-icmp-rtt","wifi-freshness","ssh-reconnect","json-limits","ssh-key-editor","ssh-profiles-v2","ssh-profiles-r1","ssh-profiles-p3")) { "Invalid phase" }
check(phase in listOf("ui","lan","ssh","wifi","wifi-denied","ssh-ui","ssh-rotated","lan-confirm","ssh-lifecycle","ssh-legacy","lan-discovery","lan-icmp-rtt","wifi-freshness","ssh-reconnect","json-limits","ssh-key-editor","ssh-profiles-v2","ssh-profiles-r1","ssh-profiles-p3","update-dialog","wifi-scan-limit")) { "Invalid phase" }
app=targetContext.applicationContext as M1TestApplication
marker("PHASE:$phase:START")
runBlocking {
withTimeout(if (phase == "ssh-lifecycle") 380_000L else 115_000L) {
when(phase) { "ssh-profiles-p3" -> sshProfilesP3Evidence(this@M1Instrumentation, app, ::screenshot, ::marker); "ssh-profiles-r1" -> sshProfilesR1Evidence(this@M1Instrumentation, app, ::screenshot, ::marker); "ssh-profiles-v2" -> sshProfilesV2Evidence(this@M1Instrumentation, app, ::screenshot, ::marker); "ssh-key-editor" -> sshKeyEditorEvidence(this@M1Instrumentation, app, arguments.getString("stage") ?: "2", arguments.getString("order") != "import-first", ::screenshot, ::marker); "json-limits" -> jsonLimitsPhase(); "ssh-reconnect" -> sshUiPhase(reconnect = true); "wifi-freshness" -> wifiFreshnessPhase(); "ui" -> uiPhase(); "lan" -> lanPhase(); "lan-icmp-rtt" -> lanIcmpRttPhase(); "lan-confirm" -> lanConfirmPhase(); "lan-discovery" -> lanDiscoveryPhase(); "ssh" -> sshPhase(); "ssh-ui" -> sshUiPhase(); "ssh-lifecycle" -> sshUiPhase(lifecycle = true); "ssh-rotated" -> sshRotatedPhase(); "ssh-legacy" -> sshLegacyPhase(); "wifi" -> wifiPhase(false); "wifi-denied" -> wifiPhase(true) }
when(phase) { "wifi-scan-limit" -> wifiScanLimitEvidence(this@M1Instrumentation, app, arguments.getString("language") ?: "cs", ::marker); "update-dialog" -> updateDialogEvidence(this@M1Instrumentation, app, arguments.getString("language") ?: "cs", ::marker); "ssh-profiles-p3" -> sshProfilesP3Evidence(this@M1Instrumentation, app, ::screenshot, ::marker); "ssh-profiles-r1" -> sshProfilesR1Evidence(this@M1Instrumentation, app, ::screenshot, ::marker); "ssh-profiles-v2" -> sshProfilesV2Evidence(this@M1Instrumentation, app, ::screenshot, ::marker); "ssh-key-editor" -> sshKeyEditorEvidence(this@M1Instrumentation, app, arguments.getString("stage") ?: "2", arguments.getString("order") != "import-first", ::screenshot, ::marker); "json-limits" -> jsonLimitsPhase(); "ssh-reconnect" -> sshUiPhase(reconnect = true); "wifi-freshness" -> wifiFreshnessPhase(); "ui" -> uiPhase(); "lan" -> lanPhase(); "lan-icmp-rtt" -> lanIcmpRttPhase(); "lan-confirm" -> lanConfirmPhase(); "lan-discovery" -> lanDiscoveryPhase(); "ssh" -> sshPhase(); "ssh-ui" -> sshUiPhase(); "ssh-lifecycle" -> sshUiPhase(lifecycle = true); "ssh-rotated" -> sshRotatedPhase(); "ssh-legacy" -> sshLegacyPhase(); "wifi" -> wifiPhase(false); "wifi-denied" -> wifiPhase(true) }
}
}
} catch (failure: Throwable) {
// Exception class/step only: provider/library messages may include credentials or key data.
if (phase == "ssh-key-editor" || phase == "ssh-profiles-v2" || phase == "ssh-profiles-r1" || phase == "ssh-profiles-p3") {
if (phase == "wifi-scan-limit" || phase == "update-dialog" || phase == "ssh-key-editor" || phase == "ssh-profiles-v2" || phase == "ssh-profiles-r1" || phase == "ssh-profiles-p3") {
marker("SSH_TEST_STACK:" + failure.stackTrace.take(12).joinToString(";"))
try { screenshot("ssh-test-failure.png") } catch (_: Exception) { }
}
Expand Down Expand Up @@ -156,6 +156,7 @@ class M1Instrumentation : Instrumentation() {
try {
captureWifiFreshnessEvidence(this, activity, ::screenshot, ::marker)
captureWifiChartEvidence(this, activity, ::screenshot, ::marker)
captureWifiVendorEvidence(this, activity, ::screenshot, ::marker)
}
finally { runOnMainSync { activity.finish() } }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ suspend fun sshProfilesR1Evidence(test: Instrumentation, app: M1TestApplication,

data(SshData(profiles = listOf(profile), keys = listOf(key)))
val keyProfile = profile.copy(authentication = SshAuthentication.KEY)
val v2 = File(app.filesDir, "r1-v2.json").apply { writeBytes(encodeSshProfileExport(SshData(profiles = listOf(keyProfile)))) }
val v2 = File(app.filesDir, "r1-v2.json").apply { writeBytes(encodeSshProfileExport(SshData(profiles = listOf(keyProfile)), source = "netkit-android")) }
test.runOnMainSync { model.previewProfileImport(Uri.fromFile(v2)) }
withTimeout(8000) { model.state.first { it.pendingProfileImport != null } }
ui.findText(app.getString(R.string.ssh_select_profile_key), scroll = true)
Expand Down Expand Up @@ -206,7 +206,7 @@ suspend fun sshProfilesP3Evidence(test: Instrumentation, app: M1TestApplication,
for (auth in listOf(SshAuthentication.KEY, SshAuthentication.INTERACTIVE)) {
data(SshData(profiles = listOf(profile.copy(secretRef = "fixture-reference"))))
val input = File(app.filesDir, "p3-auth.json").apply {
writeBytes(encodeSshProfileExport(SshData(profiles = listOf(profile.copy(authentication = auth)))))
writeBytes(encodeSshProfileExport(SshData(profiles = listOf(profile.copy(authentication = auth))), source = "netkit-android"))
}
test.runOnMainSync { model.previewProfileImport(Uri.fromFile(input)) }
withTimeout(8000) { model.state.first { it.pendingProfileImport != null } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ suspend fun sshProfilesV2Evidence(test: Instrumentation, app: M1TestApplication,
ui.clickTag("tab_ssh")
val changed = profiles[0].copy(host = "198.51.100.1", port = 2222, username = "other",
authentication = SshAuthentication.INTERACTIVE, startupCommand = "show version", keepaliveSeconds = 60)
val input = File(app.filesDir, "incoming-v2.json").apply { writeBytes(encodeSshProfileExport(SshData(profiles = listOf(changed)))) }
val input = File(app.filesDir, "incoming-v2.json").apply { writeBytes(encodeSshProfileExport(SshData(profiles = listOf(changed)), source = "netkit-android")) }
test.runOnMainSync { model.previewProfileImport(Uri.fromFile(input)) }
withTimeout(8000) { model.state.first { it.pendingProfileImport != null } }
for ((label, old, new) in listOf(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
package cz.netkit.app.test

import android.app.Instrumentation
import android.content.Intent
import android.os.LocaleList
import androidx.activity.compose.setContent
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.getValue
import androidx.compose.foundation.layout.Column
import androidx.compose.ui.Modifier
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.testTagsAsResourceId
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import cz.netkit.app.MainActivity
import cz.netkit.app.R
import cz.netkit.app.ui.theme.NetKitTheme
import cz.netkit.app.update.*
import java.io.File
import java.util.Locale
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.first

/** Production startup via the existing private-file fixture; no update/network request leaves ART. */
@OptIn(ExperimentalComposeUiApi::class)
suspend fun updateDialogEvidence(test: Instrumentation, app: M1TestApplication, language: String,
marker: (String) -> Unit) {
require(language in setOf("cs", "en"))
val prefs = app.getSharedPreferences("update", 0)
val before = prefs.all.toMap()
val localeManager = app.getSystemService(android.app.LocaleManager::class.java)
val beforeLocales = localeManager.applicationLocales
val fixture = File(app.filesDir, UPDATE_FIXTURE_FILE)
var activity: MainActivity? = null
try {
prefs.edit().clear().putBoolean("enabled", true).commit()
fixture.writeText("""{"schema":1,"versionName":"9.9.9","versionCode":90909,"minSdk":29,"pageUrl":"https://www.daniel.losak.cz/netkit","notes":{"cs":"NetKit-Test česká poznámka","en":"NetKit-Test English notes"}}""")
test.runOnMainSync {
localeManager.applicationLocales = LocaleList(Locale.forLanguageTag(language))
}
activity = test.startActivitySync(Intent(app, MainActivity::class.java).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)) as MainActivity
lateinit var model: UpdateViewModel
test.runOnMainSync { model = ViewModelProvider(activity!!)[UpdateViewModel::class.java] }
val ui = SshEvidenceUi(test)
withTimeout(8000) { model.state.first { it.dialog != null && !it.checking } }
marker("UPDATE_DIALOG:STARTUP_READY")
val info = model.state.value.dialog!!
ui.findText(if (language == "cs") "NetKit-Test česká poznámka" else "NetKit-Test English notes")
ui.findText(app.getString(R.string.update_available_title, "9.9.9"))
marker("UPDATE_DIALOG:NOTES_VISIBLE")
ui.clickTag("update_dialog_close")
withTimeout(3000) { model.state.first { it.dialog == null } }
check(model.state.value.card == info)
val lastCheck = model.state.value.lastCheckMs
val recreation = test.addMonitor(MainActivity::class.java.name, null, false)
test.runOnMainSync { activity!!.recreate() }
activity = test.waitForMonitorWithTimeout(recreation, 8000) as? MainActivity ?: error("No recreated activity")
test.removeMonitor(recreation)
test.runOnMainSync {
check(ViewModelProvider(activity!!)[UpdateViewModel::class.java] === model)
model.onBackground(); model.onForeground()
}
check(model.state.value.dialog == null && model.state.value.lastCheckMs == lastCheck)
marker("UPDATE_DIALOG:$language:CLOSE_ROTATION_FOREGROUND:PASS")

// Render the same production dialog with the valid fixture for each remaining action.
fun render() = test.runOnMainSync {
val visible = mutableStateOf(true)
activity!!.setContent {
NetKitTheme {
val state by model.state.collectAsStateWithLifecycle()
Column(Modifier.semantics { testTagsAsResourceId = true }) {
state.card?.let { UpdateCard(it, onDismiss = { model.dismiss(it) }) }
}
if (visible.value && state.card != null) UpdateDialog(info, {
model.closeDialog(); visible.value = false
}) { model.dismiss(info) }
}
}
}
var opened: Intent? = null
val intentMonitor = object : Instrumentation.ActivityMonitor() {
override fun onStartActivity(intent: Intent): Instrumentation.ActivityResult? {
if (intent.action != Intent.ACTION_VIEW) return null
opened = intent
return Instrumentation.ActivityResult(0, null)
}
}
test.addMonitor(intentMonitor)
try {
render()
ui.clickTag("update_dialog_download")
withTimeout(3000) { while (opened == null) delay(25) }
check(opened!!.action == Intent.ACTION_VIEW)
check(opened!!.dataString == localizedUpdateUrl(info.openUrl, language))
check(model.state.value.dialogClosed)
withTimeout(3000) { while (ui.all().any { it.viewIdResourceName == "update_dialog_download" }) delay(50) }
} finally { test.removeMonitor(intentMonitor) }
marker("UPDATE_DIALOG:$language:DOWNLOAD_INTENT:PASS")
render()
ui.clickTag("update_dialog_dismiss")
withTimeout(3000) { model.state.first { it.card == null && it.dialog == null } }
withTimeout(3000) { while (prefs.getInt("dismissed_version_code", -1) != info.versionCode) delay(25) }
check(ui.all().none { it.viewIdResourceName == "update_card" && it.isVisibleToUser })
marker("UPDATE_DIALOG:$language:DISMISS_CARD:PASS")

// A later foreground check refreshes a newer card after 24 h, never the startup dialog.
fixture.writeText(fixture.readText().replace("9.9.9", "10.0.0").replace("90909", "100000"))
prefs.edit().putLong("last_check_ms", System.currentTimeMillis() - 86_400_001L).commit()
test.runOnMainSync { model.onBackground(); model.onForeground() }
withTimeout(8000) { model.state.first { it.info?.versionCode == 100000 && !it.checking } }
check(model.state.value.card?.versionCode == 100000)
check(model.state.value.dialog == null && !model.state.value.startupDialogReady)
marker("UPDATE_DIALOG:$language:FOREGROUND_CARD_ONLY:PASS")
} finally {
test.runOnMainSync { activity?.finish() }
test.runOnMainSync { localeManager.applicationLocales = beforeLocales }
fixture.delete()
prefs.edit().clear().apply {
before.forEach { (key, value) -> when (value) {
is Boolean -> putBoolean(key, value)
is Int -> putInt(key, value)
is Long -> putLong(key, value)
is String -> putString(key, value)
} }
}.commit()
}
}
Loading
Loading