fix(runtime): fetch the KDE language-pack index directly from GitHub (#2845)

The index carries the sha256 of every language pack, so loading it through a download mirror let the mirror pick both the hash and the pack that gets extracted into the Linux runtime. The index now always comes straight from GitHub; pack bodies can still use mirrors since their hash is trusted.

Co-authored-by: Tapuuk <177422350+Tapuuk@users.noreply.github.com>
This commit is contained in:
TapuukandTapuuk authored and GitHub committed 2026-11-24 16:18:15 -05:00
1 parent 31c475d5e1
commit 8f0e124b5d
2 files changed
+66 -1

No files matched your search

@@ -32,6 +32,9 @@ object DesktopLanguage {
internal fun baseUrl(desktopUrl: String) = desktopUrl.substringBeforeLast('/') + "/"
/** The index carries every pack's sha256, so it never goes through a download mirror. */
internal fun fetchIndex(base: String): Map<String, Pack>? = Downloader.downloadDirect(base + INDEX)?.let(::parseIndex)
private fun marker(root: File, tag: String, name: String) = File(root, ".droiddeck-i18n-$tag-$name")
/** Installs the desktop's translations for [locale]; false when a download failed and is worth retrying. */
@@ -44,7 +47,7 @@ object DesktopLanguage {
val pending = candidates(locale).filterNot { marker(root, tag, it).isFile }
if (pending.isEmpty()) return true
val base = baseUrl(BuildConfig.DESKTOP_KDE_URL)
val index = parseIndex(Downloader.downloadString(base + INDEX) ?: return false)
val index = fetchIndex(base) ?: return false
var complete = true
for (name in pending) {
val pack = index[name]