OTA: name release assets after their tag, download from one host
Build and Release APK / Build APK and publish release (push) Canceled after 0s
Build and Release APK / Build APK and publish release (push) Canceled after 0s
Two things the first live release check on git.wallacenet.ca showed: - The publish script uploaded the APK under whatever the build called it (app-debug.apk), which is the name the updater only finds by its fallback rule. The script now names the asset after its tag, so the primary rule — "the asset whose name contains the tag" — is the one that fires. - The instance answers for two host names and reports asset URLs on the one it treats as canonical, so the app would have fetched its release list from git.wallacenet.ca and its APK from elsewhere. onReportedHost() now keeps the path the server chose and puts the download on the host the app already trusts, tested in UpdatePolicyTest. Co-Authored-By: Paperclip <[email protected]>
This commit is contained in:
co-authored by
Paperclip
parent
fad4778ad8
commit
a827a38ae6
@@ -53,6 +53,28 @@ class UpdatePolicyTest {
|
||||
assertNull(versionCodeOfTag("nightly"))
|
||||
}
|
||||
|
||||
// -- Where the download happens ----------------------------------------
|
||||
|
||||
@Test
|
||||
fun `a release asset is fetched from this app's host, keeping its path`() {
|
||||
// The instance reports its canonical host; the app was told to trust
|
||||
// another. Same bytes, one host, whatever the server names itself.
|
||||
assertEquals(
|
||||
"https://git.wallacenet.ca/devadmin/PilgrimsOfKatan/releases/download/" +
|
||||
"v1.4.1001-dev/PilgrimsOfKatan-v1.4.1001-dev.apk",
|
||||
onReportedHost(
|
||||
"https://git.saskvalleytech.com/devadmin/PilgrimsOfKatan/releases/download/" +
|
||||
"v1.4.1001-dev/PilgrimsOfKatan-v1.4.1001-dev.apk",
|
||||
"git.wallacenet.ca",
|
||||
),
|
||||
)
|
||||
// A URL that already says the right host is left exactly as it is.
|
||||
val already = "https://git.wallacenet.ca/devadmin/PilgrimsOfKatan/releases/download/v1.4.1/a.apk"
|
||||
assertEquals(already, onReportedHost(already, "git.wallacenet.ca"))
|
||||
// Anything unparseable survives untouched rather than being dropped.
|
||||
assertEquals("not a url", onReportedHost("not a url", "git.wallacenet.ca"))
|
||||
}
|
||||
|
||||
// -- The wall -----------------------------------------------------------
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user