refactor(node): fetch device links from the API, drop the bundled matcher (#5765)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
James Rich
2026-06-10 16:25:27 -05:00
committed by James Rich
parent 4f1d32c7b9
commit f2ee694566
23 changed files with 5643 additions and 1701 deletions

View File

File diff suppressed because it is too large Load Diff

View File

@@ -111,8 +111,9 @@ import org.meshtastic.core.database.entity.TracerouteNodePositionEntity
AutoMigration(from = 39, to = 40),
AutoMigration(from = 40, to = 41),
AutoMigration(from = 41, to = 42),
AutoMigration(from = 42, to = 43, spec = AutoMigration42to43::class),
],
version = 42,
version = 43,
exportSchema = true,
)
@androidx.room3.ConstructedBy(MeshtasticDatabaseConstructor::class)
@@ -160,3 +161,7 @@ class AutoMigration33to34 : AutoMigrationSpec
@DeleteColumn(tableName = "packet", columnName = "retry_count")
@DeleteColumn(tableName = "reactions", columnName = "retry_count")
class AutoMigration34to35 : AutoMigrationSpec
/** Device links moved from the bundled `urls.json` to the resolved API; `original_url` is no longer stored. */
@DeleteColumn(tableName = "device_link", columnName = "original_url")
class AutoMigration42to43 : AutoMigrationSpec

View File

@@ -22,29 +22,29 @@ import androidx.room3.PrimaryKey
import kotlinx.serialization.Serializable
import org.meshtastic.core.model.DeviceLink
/** A msh.to short-link, upserted from the bundled `urls.json` during the device-hardware refresh cycle. */
/** A msh.to device link, cached from the Meshtastic API (`/resource/deviceLinks`) during the refresh cycle. */
@Serializable
@Entity(tableName = "device_link")
data class DeviceLinkEntity(
@PrimaryKey @ColumnInfo(name = "short_code") val shortCode: String,
@ColumnInfo(name = "original_url") val originalUrl: String,
@ColumnInfo(name = "link_description") val linkDescription: String? = null,
@ColumnInfo(name = "is_vendor") val isVendor: Boolean = false,
val regions: List<String>? = null,
val targets: List<String>? = null,
)
fun DeviceLink.asEntity() = DeviceLinkEntity(
shortCode = shortCode,
originalUrl = originalUrl,
linkDescription = description,
isVendor = isVendor,
regions = regions,
targets = targets,
)
fun DeviceLinkEntity.asExternalModel() = DeviceLink(
shortCode = shortCode,
originalUrl = originalUrl,
description = linkDescription,
isVendor = isVendor,
regions = regions,
targets = targets,
)