mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
remove support for 0.8 version URLs (found while investigating #188)
This commit is contained in:
parent
31e0136b2a
commit
88b1ad5443
1 changed files with 5 additions and 5 deletions
|
|
@ -31,17 +31,17 @@ data class Channel(
|
|||
MeshProtos.ChannelSettings.newBuilder().setName(defaultChannelName)
|
||||
.setModemConfig(MeshProtos.ChannelSettings.ModemConfig.Bw125Cr45Sf128).build()
|
||||
)
|
||||
|
||||
private const val prefixRoot = "https://www.meshtastic.org/c/"
|
||||
const val prefix = "$prefixRoot#"
|
||||
|
||||
const val prefix = "https://www.meshtastic.org/c/#"
|
||||
|
||||
private const val base64Flags = Base64.URL_SAFE + Base64.NO_WRAP
|
||||
|
||||
private fun urlToSettings(url: Uri): MeshProtos.ChannelSettings {
|
||||
val urlStr = url.toString()
|
||||
|
||||
// Let the path optionally include the # character (or not) so we can work with old URLs generated by old versions of the app
|
||||
val pathRegex = Regex("$prefixRoot#?(.*)")
|
||||
// We no longer support the super old (about 0.8ish? verison of the URLs that don't use the # separator - I doubt
|
||||
// anyone is still using that old format
|
||||
val pathRegex = Regex("$prefix(.*)")
|
||||
val (base64) = pathRegex.find(urlStr)?.destructured
|
||||
?: throw MalformedURLException("Not a meshtastic URL: ${urlStr.take(40)}")
|
||||
val bytes = Base64.decode(base64, base64Flags)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue