From 839b5464c6d53d6ea6e04395a1abc14d8638c3e4 Mon Sep 17 00:00:00 2001 From: toasterofbread Date: Thu, 1 Aug 2024 23:18:44 +0100 Subject: [PATCH] Handle unknown desktop hostname --- buildSrc/src/main/kotlin/plugins/spmp/Dependencies.kt | 2 +- .../spmp/platform/playerservice/SpMsPlayerService.kt | 6 ++++-- .../commonMain/resources/assets/values-ja-JP/strings.xml | 1 + shared/src/commonMain/resources/assets/values/strings.xml | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/buildSrc/src/main/kotlin/plugins/spmp/Dependencies.kt b/buildSrc/src/main/kotlin/plugins/spmp/Dependencies.kt index 5edc916b8..3a75a4930 100644 --- a/buildSrc/src/main/kotlin/plugins/spmp/Dependencies.kt +++ b/buildSrc/src/main/kotlin/plugins/spmp/Dependencies.kt @@ -36,7 +36,7 @@ class SpMpDeps(extra: Map) { license_url = "https://github.com/toasterofbread/spmp-server/blob/6dde651ffc102d604ac7ecd5ac7471b1572fd2e6/LICENSE" ), "dev.toastbits.composekit" to DependencyInfo( - version = "d3828b3d42", + version = "e189b7ba8a", name = "ComposeKit", author = "toasterofbread", url = "https://github.com/toasterofbread/composekit", diff --git a/shared/src/commonMain/kotlin/com/toasterofbread/spmp/platform/playerservice/SpMsPlayerService.kt b/shared/src/commonMain/kotlin/com/toasterofbread/spmp/platform/playerservice/SpMsPlayerService.kt index 214c08992..e2a77cdee 100644 --- a/shared/src/commonMain/kotlin/com/toasterofbread/spmp/platform/playerservice/SpMsPlayerService.kt +++ b/shared/src/commonMain/kotlin/com/toasterofbread/spmp/platform/playerservice/SpMsPlayerService.kt @@ -16,6 +16,8 @@ import com.toasterofbread.spmp.platform.download.DownloadStatus import com.toasterofbread.spmp.platform.getUiLanguage import com.toasterofbread.spmp.resources.getString import com.toasterofbread.spmp.model.radio.RadioState +import dev.toastbits.composekit.platform.getPlatformHostName +import dev.toastbits.composekit.platform.getPlatformOSName import io.ktor.http.Headers import io.ktor.util.flattenEntries import kotlinx.coroutines.* @@ -53,8 +55,8 @@ abstract class SpMsPlayerService(val plays_audio: Boolean): PlatformServiceImpl( internal abstract fun onRadioCancelRequested() private fun getClientName(): String { - val os: String = Platform.getOSName() - var host: String = Platform.getHostName() + val os: String = getPlatformOSName() + val host: String = getPlatformHostName() ?: getString("unknown_host_name") return getString("app_name") + " [$os, $host]" } diff --git a/shared/src/commonMain/resources/assets/values-ja-JP/strings.xml b/shared/src/commonMain/resources/assets/values-ja-JP/strings.xml index 27d6a4877..80db6c7ba 100644 --- a/shared/src/commonMain/resources/assets/values-ja-JP/strings.xml +++ b/shared/src/commonMain/resources/assets/values-ja-JP/strings.xml @@ -263,6 +263,7 @@ 報告する 折り返す Paste.eeにアップロード + 不明 ラジオを始める 再生 diff --git a/shared/src/commonMain/resources/assets/values/strings.xml b/shared/src/commonMain/resources/assets/values/strings.xml index 8523af5fb..673859339 100644 --- a/shared/src/commonMain/resources/assets/values/strings.xml +++ b/shared/src/commonMain/resources/assets/values/strings.xml @@ -294,6 +294,7 @@ Report Wrap text Upload to Paste.ee + Unknown Start radio Play