Skip to content

armgit / andee

Public Imported from GitHub
0

Andee lives on your phone or Mac and uses any app like you do—no integrations, no root, any model; memory and passwords never leave your device | Andee 住进你的手机或 Mac,像你一样操作任何 App——无需集成、无需 Root、支持任意模型,记忆和密码绝不离开设备。

fix: report codeflying=1 only when CodeFlying is in use with a key

booboosui1470e6031e96
diff --git a/app/src/main/java/net/kuafuai/andee/device/SelfCheck.kt b/app/src/main/java/net/kuafuai/andee/device/SelfCheck.kt
index 94c74b0..ba8c110 100644
--- a/app/src/main/java/net/kuafuai/andee/device/SelfCheck.kt
+++ b/app/src/main/java/net/kuafuai/andee/device/SelfCheck.kt
@@ -557,7 +557,10 @@ object SelfCheck {
val deviceId = VoiceConfig.hubConfig(context).deviceId
return when (val v = probeVersion(
VERSION_API_BASE, BuildConfig.VERSION_NAME, deviceId,
- VoiceConfig.brainMode(context) == VoiceConfig.BRAIN_CODEFLYING,
+ // True only when CodeFlying is the backend in force AND a key is set for it. The field keeps its name,
+ // `codeflying`; what it now says is "this install really can use CodeFlying".
+ VoiceConfig.brainMode(context) == VoiceConfig.BRAIN_CODEFLYING &&
+ VoiceConfig.codeFlyingKey(context).isNotBlank(),
)) {
is Verdict.Current -> Finding(
id = "version",
@@ -1354,8 +1357,8 @@ object SelfCheck {
?.addQueryParameter("os_version", "Android ${Build.VERSION.RELEASE} (API ${Build.VERSION.SDK_INT})")
?.addQueryParameter("device_id", deviceId)
?.addQueryParameter("app_package", BuildConfig.APPLICATION_ID)
- // Whether the CodeFlying backend is the one in force right now: "1" / "0". Only the on/off fact,
- // never the key or the address.
+ // "1" only if CodeFlying is the backend in force and a key is configured for it, else "0". Only
+ // that on/off fact is sent, never the key or the address.
?.addQueryParameter("codeflying", if (codeFlying) "1" else "0")
?.addQueryParameter("lang", Locale.getDefault().toLanguageTag())
?.build()
diff --git a/desktop/src/main/kotlin/net/kuafuai/andee/desktop/VersionCheck.kt b/desktop/src/main/kotlin/net/kuafuai/andee/desktop/VersionCheck.kt
index c17d084..af3495e 100644
--- a/desktop/src/main/kotlin/net/kuafuai/andee/desktop/VersionCheck.kt
+++ b/desktop/src/main/kotlin/net/kuafuai/andee/desktop/VersionCheck.kt
@@ -10,7 +10,7 @@ import java.util.concurrent.TimeUnit
* The self-check's version row on the Mac: the phone's `SelfCheck.probeVersion`, against the same service.
*
* What it sends, and nothing else: this build's version, `platform=mac`, the Mac's model and macOS release, the
- * interface language, this install's own random id, and whether CodeFlying is the backend in force (on / off —
+ * interface language, this install's own random id, and whether CodeFlying is in use (the backend in force AND a key set: 1 / 0 —
* never the key or the address). No conversation, no screen content, no file names. It is the one call the app
* makes to a host the maintainers run, and docs/permissions.md says so.
*
@@ -48,7 +48,8 @@ object VersionCheck {
?.addQueryParameter("os_version", "macOS ${System.getProperty("os.version")} (${System.getProperty("os.arch")})")
?.addQueryParameter("device_id", Settings.uid())
?.addQueryParameter("app_package", "net.kuafuai.andee.mac")
- ?.addQueryParameter("codeflying", if (Assistant.config().mode == net.kuafuai.andee.config.BrainConfig.BRAIN_CODEFLYING) "1" else "0")
+ // "1" only if CodeFlying is the backend in force AND a key is configured for it, else "0".
+ ?.addQueryParameter("codeflying", if (usingCodeFlyingWithKey()) "1" else "0")
?.addQueryParameter("lang", Strings.locale().toLanguageTag())
?.build() ?: return Result.Unknown("bad address")
val http = OkHttpClient.Builder()
@@ -76,6 +77,10 @@ object VersionCheck {
}
}
+ private fun usingCodeFlyingWithKey(): Boolean = Assistant.config().let {
+ it.mode == net.kuafuai.andee.config.BrainConfig.BRAIN_CODEFLYING && it.apiKey.isNotBlank()
+ }
+
/** "Mac14,5"-style model identifier; empty when sysctl is not answering. */
private fun macModel(): String = runCatching {
val p = ProcessBuilder("/usr/sbin/sysctl", "-n", "hw.model").redirectErrorStream(true).start()