Install snapshots take every server's workspace, not only the original one (build 64)
Since the move to the VPS each TV keeps the VPS's channels under no_backup/servers/<key>/; the install snapshot, rollback copy and catalogue copy only took the original server's folder, frozen since 12 November, so the install checks of the last few builds compared the old server's schedules. snapshot, rollback and catalogue now take every server's workspace too (schedules, the server notes, catalogue copies; never the sign-in), and compare_snapshots.py checks their planned programmes as well. Restore still puts back only the original server's schedules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,7 @@ plugins {
|
||||
id("org.jetbrains.kotlin.plugin.compose")
|
||||
}
|
||||
/** The release's build number: versionCode is this x 10 plus the edition's channel. */
|
||||
val ORBIT_BUILD = 63
|
||||
val ORBIT_BUILD = 64
|
||||
android {
|
||||
namespace = "tv.orbit.classic"
|
||||
compileSdk = 36
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.security.MessageDigest
|
||||
* sign-in's checksums, for adb to pull and compare. Nothing is read out of them here.
|
||||
* - `rollback <version>`: copies the schedules aside as schedule-rollback-<version>, as every install does.
|
||||
* - `catalogue`: a read-only copy of the library catalogue beside it, for checking new channels' titles against the library.
|
||||
* Since 18 November 2026 `snapshot`, `rollback` and `catalogue` take every server's workspace, not only the original one.
|
||||
* - `clear`: removes the copy once it's been pulled.
|
||||
* - `restore` (8 November 2026, audit U12): puts a pulled snapshot back. See [InstallRestore]: only with `confirm RESTORE`,
|
||||
* only while Orbit's screen isn't open, only files a snapshot takes, each checked against its checksum first, and the
|
||||
@@ -67,28 +68,47 @@ internal object InstallSnapshot {
|
||||
// so an install can show the old BumbleHive save and every profile's scores came through untouched.
|
||||
File(data, "files/arcade").takeIf { it.isDirectory }?.copyRecursively(File(out, "files/arcade"), overwrite = true)
|
||||
File(data, "app_webview/Default/Local Storage").takeIf { it.isDirectory }?.copyRecursively(File(out, "app_webview/Default/Local Storage"), overwrite = true)
|
||||
File(out, "hashes.txt").writeText(listOf("no_backup/catalogue.db", "no_backup/orbit-connection.v1")
|
||||
// Every other server's schedules too (18 November 2026): since the move to the VPS its channels live under
|
||||
// no_backup/servers/<key>/, and a snapshot of the original server's folder alone said nothing about them.
|
||||
val servers = serverFolders(data)
|
||||
servers.forEach { server ->
|
||||
File(server, "schedule").takeIf { it.isDirectory }?.copyRecursively(File(out, "no_backup/servers/${server.name}/schedule"), overwrite = true)
|
||||
File(server, "first-used").takeIf { it.exists() }?.copyTo(File(out, "no_backup/servers/${server.name}/first-used"), overwrite = true)
|
||||
}
|
||||
// Which server is which: the notes hold addresses only, no sign-in.
|
||||
listOf("original-server", "active-server").forEach { n -> File(data, "no_backup/$n").takeIf { it.exists() }?.copyTo(File(out, "no_backup/$n"), overwrite = true) }
|
||||
File(out, "hashes.txt").writeText((listOf("no_backup/catalogue.db", "no_backup/orbit-connection.v1") +
|
||||
servers.flatMap { listOf("no_backup/servers/${it.name}/catalogue.db", "no_backup/servers/${it.name}/orbit-connection.v1") })
|
||||
.joinToString("\n") { "${sha256(File(data, it))} $it" } + "\n")
|
||||
"copied ${schedule.walk().count { it.isFile }}"
|
||||
"copied ${out.walk().count { it.isFile && "/schedule/" in it.path }}"
|
||||
}
|
||||
"rollback" -> {
|
||||
if (version == null || !versionShape.matches(version)) return "bad version"
|
||||
val schedule = File(data, "no_backup/schedule")
|
||||
val aside = File(data, "no_backup/schedule-rollback-$version")
|
||||
aside.deleteRecursively(); schedule.copyRecursively(aside, overwrite = true)
|
||||
"aside ${aside.walk().count { it.isFile }}"
|
||||
// Each other server's schedules are kept aside the same way, in its own folder.
|
||||
val others = serverFolders(data).mapNotNull { server -> File(server, "schedule").takeIf { it.isDirectory }?.let { s ->
|
||||
File(server, "schedule-rollback-$version").also { a -> a.deleteRecursively(); s.copyRecursively(a, overwrite = true) } } }
|
||||
"aside ${aside.walk().count { it.isFile } + others.sumOf { a -> a.walk().count { it.isFile } }}"
|
||||
}
|
||||
"catalogue" -> {
|
||||
val db = File(data, "no_backup/catalogue.db")
|
||||
if (!db.exists()) return "no catalogue"
|
||||
db.copyTo(File(out, "catalogue.db"), overwrite = true)
|
||||
"copied catalogue"
|
||||
// And each other server's library catalogue, read-only copies (the VPS's, for the programming audit).
|
||||
val others = serverFolders(data).mapNotNull { server -> File(server, "catalogue.db").takeIf { it.exists() }?.also { it.copyTo(File(out, "catalogue-${server.name}.db"), overwrite = true) } }
|
||||
"copied catalogue" + if (others.isNotEmpty()) " and ${others.size} more" else ""
|
||||
}
|
||||
"clear" -> { out.deleteRecursively(); "cleared" }
|
||||
else -> "unknown"
|
||||
}
|
||||
}
|
||||
|
||||
/** The other servers' workspaces (see Workspaces): no_backup/servers/<key>. */
|
||||
private fun serverFolders(data: File): List<File> =
|
||||
File(data, "no_backup/servers").listFiles { f -> f.isDirectory && Regex("[A-Za-z0-9_-]{1,64}").matches(f.name) }.orEmpty().sortedBy { it.name }
|
||||
|
||||
private fun sha256(file: File): String = if (!file.exists()) "missing" else file.inputStream().use { input ->
|
||||
val digest = MessageDigest.getInstance("SHA-256"); val buffer = ByteArray(64 * 1024)
|
||||
while (true) { val n = input.read(buffer); if (n < 0) break; digest.update(buffer, 0, n) }
|
||||
|
||||
@@ -49,7 +49,8 @@ def compare(before, after):
|
||||
if lost:
|
||||
problems.append(f"bookings lost: {len(lost)}")
|
||||
total = changed = 0
|
||||
for bp in glob.glob(before + "/no_backup/schedule/schedule-*.json"):
|
||||
# The original server's schedules and every other server's (no_backup/servers/<key>/schedule, 18 November 2026).
|
||||
for bp in glob.glob(before + "/no_backup/schedule/schedule-*.json") + glob.glob(before + "/no_backup/servers/*/schedule/schedule-*.json"):
|
||||
ap = bp.replace(before, after, 1)
|
||||
try:
|
||||
eb, ea = json.load(open(bp)).get("entries", []), json.load(open(ap)).get("entries", [])
|
||||
|
||||
Reference in New Issue
Block a user