Skip to content

Commit

Permalink
Use AuthorizationHeaderBuilder to encode device name send to web clie…
Browse files Browse the repository at this point in the history
…nt (#466)

This makes sure the SDK and webui use an identical name
  • Loading branch information
nielsvanvelzen authored Jul 13, 2021
1 parent 77e1bce commit c530206
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import org.jellyfin.mobile.utils.runOnUiThread
import org.jellyfin.mobile.webapp.RemotePlayerService
import org.jellyfin.mobile.webapp.RemoteVolumeProvider
import org.jellyfin.mobile.webapp.WebappFunctionChannel
import org.jellyfin.sdk.api.client.util.AuthorizationHeaderBuilder
import org.jellyfin.sdk.model.ClientInfo
import org.jellyfin.sdk.model.DeviceInfo
import org.json.JSONArray
Expand All @@ -60,10 +61,7 @@ class NativeInterface(private val fragment: WebViewFragment) : KoinComponent {
// normalize the name by removing special characters
// and making sure it's at least 1 character long
// otherwise the webui will fail to send it to the server
val name = deviceInfo.name
.replace("[^\\x20-\\x7E]".toRegex(), "")
.trim()
.padStart(1)
val name = AuthorizationHeaderBuilder.encodeParameterValue(deviceInfo.name).padStart(1)
put("deviceName", name)
put("appName", clientInfo.name)
put("appVersion", clientInfo.version)
Expand Down

0 comments on commit c530206

Please sign in to comment.