Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use AuthorizationHeaderBuilder to encode device name send to web client #466

Merged
merged 1 commit into from
Jul 13, 2021
Merged
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
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