mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 12:56:06 +00:00
feat: downloads resume where they stopped, and fall back to another source (#623)
This commit is contained in:
1 parent
5e57d78b5d
commit
7c90879b39
53 files changed
+784
-221
No files matched your search
@@ -20,6 +20,7 @@ class App : Application() {
|
||||
com.droiddeck.launcher.session.QuestExperimental.initialize(this)
|
||||
com.droiddeck.launcher.session.SessionPrefs.settleGpuDriverMode(this)
|
||||
com.droiddeck.launcher.update.AppUpdates.init(this)
|
||||
com.droiddeck.launcher.core.DownloadSource.init(this)
|
||||
GpuClockPin.clearLeftover(this)
|
||||
BwrapSpawner.start(this)
|
||||
com.droiddeck.launcher.frontend.GameFileSync.start(this)
|
||||
|
||||
@@ -47,6 +47,7 @@ import com.droiddeck.launcher.session.SessionLogShare
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import com.droiddeck.launcher.session.SteamRepair
|
||||
import com.droiddeck.launcher.core.CpuCores
|
||||
import com.droiddeck.launcher.core.DownloadSource
|
||||
import com.droiddeck.launcher.core.PhantomProcessLimit
|
||||
import com.droiddeck.launcher.core.PhantomProcessStatus
|
||||
import com.droiddeck.launcher.core.WirelessAdbFix
|
||||
@@ -155,6 +156,9 @@ class MainActivity : ComponentActivity() {
|
||||
private var stretch16x9 by mutableStateOf(false)
|
||||
private var orientation by mutableStateOf(android.content.pm.ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE)
|
||||
private var launcherFullscreen by mutableStateOf(true)
|
||||
private var downloadSource by mutableStateOf(DownloadSource.MODE_AUTO)
|
||||
private var downloadMirror by mutableStateOf("")
|
||||
private var downloadPrefix by mutableStateOf("")
|
||||
private var animationsEnabled by mutableStateOf(true)
|
||||
private var gameStoresEnabled by mutableStateOf(true)
|
||||
private var gameStoresSpeedTier by mutableStateOf("fast")
|
||||
@@ -515,6 +519,10 @@ class MainActivity : ComponentActivity() {
|
||||
orientation = SessionPrefs.orientation(this)
|
||||
requestedOrientation = orientation
|
||||
launcherFullscreen = SessionPrefs.launcherFullscreen(this)
|
||||
downloadSource = DownloadSource.mode(this)
|
||||
downloadMirror = DownloadSource.mirror(this)
|
||||
downloadPrefix = DownloadSource.custom(this)
|
||||
DownloadSource.probe()
|
||||
animationsEnabled = SessionPrefs.animationsEnabled(this)
|
||||
gameStoresEnabled = SessionPrefs.gameStoresEnabled(this)
|
||||
gameStoresSpeedTier = SessionPrefs.gameStoresSpeedTier(this)
|
||||
@@ -571,6 +579,9 @@ class MainActivity : ComponentActivity() {
|
||||
showPhantomGate = showPhantomGate,
|
||||
orientation = orientation,
|
||||
launcherFullscreen = launcherFullscreen,
|
||||
downloadSource = downloadSource,
|
||||
downloadMirror = downloadMirror,
|
||||
downloadPrefix = downloadPrefix,
|
||||
animationsEnabled = animationsEnabled,
|
||||
gameStoresEnabled = gameStoresEnabled,
|
||||
gameStoresSpeedTier = gameStoresSpeedTier,
|
||||
@@ -750,6 +761,18 @@ class MainActivity : ComponentActivity() {
|
||||
animationsEnabled = on
|
||||
com.droiddeck.launcher.ui.Motion.refresh(this)
|
||||
},
|
||||
onDownloadSource = { mode ->
|
||||
DownloadSource.setMode(this, mode)
|
||||
downloadSource = mode
|
||||
},
|
||||
onDownloadMirror = { host ->
|
||||
DownloadSource.setMirror(this, host)
|
||||
downloadMirror = host
|
||||
},
|
||||
onDownloadPrefix = { prefix ->
|
||||
DownloadSource.setCustom(this, prefix)
|
||||
downloadPrefix = DownloadSource.custom(this)
|
||||
},
|
||||
onHomeApp = { manageHomeApp() },
|
||||
onHomeScreen = { on ->
|
||||
HomeApp.setHomeScreenEnabled(this, on)
|
||||
|
||||
@@ -0,0 +1,207 @@
|
||||
package com.droiddeck.launcher.core
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
|
||||
object DownloadSource {
|
||||
const val MODE_AUTO = "auto"
|
||||
const val MODE_DIRECT = "direct"
|
||||
const val MODE_MIRROR = "mirror"
|
||||
const val MODE_CUSTOM = "custom"
|
||||
|
||||
private const val PREFS = "download-source"
|
||||
private const val KEY_MODE = "mode"
|
||||
private const val KEY_MIRROR = "mirror"
|
||||
private const val KEY_CUSTOM = "custom"
|
||||
private const val KEY_FASTEST = "fastest"
|
||||
|
||||
private const val PROBE = "https://raw.githubusercontent.com/Droid-Deck/DroidDeck/main/README.md"
|
||||
private const val PROBE_TIMEOUT_MS = 4_000
|
||||
private const val PROBE_COOLDOWN_MS = 30_000L
|
||||
private const val UA = "DroidDeck-Android"
|
||||
|
||||
private val MODES = listOf(MODE_AUTO, MODE_DIRECT, MODE_MIRROR, MODE_CUSTOM)
|
||||
|
||||
private val GITHUB_HOSTS = listOf(
|
||||
"github.com",
|
||||
"raw.githubusercontent.com",
|
||||
"api.github.com",
|
||||
)
|
||||
|
||||
private val CATALOGS = listOf(
|
||||
"https://raw.githubusercontent.com/Droid-Deck/DroidDeck-CI/",
|
||||
"https://raw.githubusercontent.com/Droid-Deck/DroidDeck-Components/",
|
||||
)
|
||||
|
||||
data class Mirror(val host: String, val api: Boolean)
|
||||
|
||||
val MIRRORS = listOf(
|
||||
Mirror("gh-proxy.com", true),
|
||||
Mirror("gh-proxy.org", true),
|
||||
Mirror("ghproxy.net", false),
|
||||
Mirror("ghfast.top", false),
|
||||
)
|
||||
|
||||
@Volatile
|
||||
private var app: Context? = null
|
||||
|
||||
@Volatile
|
||||
private var lastGood: String? = null
|
||||
|
||||
private val probing = AtomicBoolean(false)
|
||||
private val probedAt = AtomicLong(0L)
|
||||
|
||||
fun init(context: Context) {
|
||||
app = context.applicationContext
|
||||
lastGood = prefs()?.getString(KEY_FASTEST, null)
|
||||
}
|
||||
|
||||
fun probe() {
|
||||
if (app == null || prefs()?.getString(KEY_MODE, MODE_AUTO) == MODE_DIRECT) return
|
||||
if (!probing.compareAndSet(false, true)) return
|
||||
val now = System.currentTimeMillis()
|
||||
if (now - probedAt.get() < PROBE_COOLDOWN_MS) {
|
||||
probing.set(false)
|
||||
return
|
||||
}
|
||||
probedAt.set(now)
|
||||
Thread {
|
||||
try {
|
||||
val times = ConcurrentHashMap<String, Long>()
|
||||
val sources = listOf<String?>(null) + MIRRORS.map { it.host }
|
||||
val latch = CountDownLatch(sources.size)
|
||||
for (mirror in sources) {
|
||||
Thread {
|
||||
try {
|
||||
val ms = latency(mirror?.let { "https://$it/$PROBE" } ?: PROBE)
|
||||
if (ms > 0) times[mirror ?: ""] = ms
|
||||
} finally {
|
||||
latch.countDown()
|
||||
}
|
||||
}.apply { isDaemon = true }.start()
|
||||
}
|
||||
latch.await(PROBE_TIMEOUT_MS * 3L, TimeUnit.MILLISECONDS)
|
||||
val best = times.minByOrNull { it.value }?.key ?: return@Thread
|
||||
lastGood = best
|
||||
prefs()?.edit()?.putString(KEY_FASTEST, best)?.apply()
|
||||
} finally {
|
||||
probing.set(false)
|
||||
}
|
||||
}.apply { isDaemon = true }.start()
|
||||
}
|
||||
|
||||
private fun latency(url: String): Long {
|
||||
val started = System.nanoTime()
|
||||
var connection: HttpURLConnection? = null
|
||||
return try {
|
||||
val c = (URL(url).openConnection() as HttpURLConnection).apply {
|
||||
connectTimeout = PROBE_TIMEOUT_MS
|
||||
readTimeout = PROBE_TIMEOUT_MS
|
||||
instanceFollowRedirects = true
|
||||
setRequestProperty("Range", "bytes=0-1023")
|
||||
setRequestProperty("User-Agent", UA)
|
||||
}
|
||||
connection = c
|
||||
if (c.responseCode / 100 != 2) 0L else {
|
||||
c.inputStream.use { it.read() }
|
||||
(System.nanoTime() - started) / 1_000_000
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
0L
|
||||
} finally {
|
||||
runCatching { connection?.disconnect() }
|
||||
}
|
||||
}
|
||||
|
||||
fun isGithub(url: String): Boolean = GITHUB_HOSTS.any { url.startsWith("https://$it/") }
|
||||
|
||||
/** Catalogs carry the digests everything else is checked against, so a mirror must never supply one. */
|
||||
fun isCatalog(url: String): Boolean = CATALOGS.any { url.startsWith(it) }
|
||||
|
||||
fun candidates(target: String): List<String> {
|
||||
// GitHub API metadata carries executable URLs and digests; never proxy it.
|
||||
if (isCatalog(target) || target.startsWith("https://api.github.com/")) return listOf(target)
|
||||
val prefs = prefs() ?: return listOf(target)
|
||||
if (!isGithub(target)) return listOf(target)
|
||||
val api = target.startsWith("https://api.github.com/")
|
||||
val proxies = MIRRORS.filter { !api || it.api }.map { it.proxy(target) }
|
||||
val ordered = when (prefs.getString(KEY_MODE, MODE_AUTO) ?: MODE_AUTO) {
|
||||
MODE_DIRECT -> listOf(target)
|
||||
MODE_MIRROR -> listOfNotNull(picked(prefs, api)?.proxy(target)) + listOf(target) + quickest(proxies)
|
||||
MODE_CUSTOM -> listOfNotNull(customProxy(prefs, target)) + listOf(target) + quickest(proxies)
|
||||
else -> if (api) listOf(target) else listOf(target) + quickest(proxies)
|
||||
}
|
||||
return ordered.distinct()
|
||||
}
|
||||
|
||||
private fun quickest(sources: List<String>): List<String> =
|
||||
sources.sortedBy { if (host(it) == lastGood) 0 else 1 }
|
||||
|
||||
fun succeeded(source: String) {
|
||||
lastGood = host(source)
|
||||
}
|
||||
|
||||
fun failed() {
|
||||
lastGood = null
|
||||
prefs()?.edit()?.remove(KEY_FASTEST)?.apply()
|
||||
}
|
||||
|
||||
fun mode(context: Context): String = prefs(context)?.getString(KEY_MODE, MODE_AUTO) ?: MODE_AUTO
|
||||
|
||||
fun setMode(context: Context, mode: String) {
|
||||
prefs(context)?.edit()?.putString(KEY_MODE, mode.takeIf { it in MODES } ?: MODE_AUTO)?.apply()
|
||||
}
|
||||
|
||||
fun mirror(context: Context): String {
|
||||
val host = prefs(context)?.getString(KEY_MIRROR, "") ?: ""
|
||||
return MIRRORS.firstOrNull { it.host == host }?.host ?: MIRRORS.first().host
|
||||
}
|
||||
|
||||
fun setMirror(context: Context, host: String) {
|
||||
prefs(context)?.edit()?.putString(KEY_MIRROR, host.takeIf { h -> MIRRORS.any { it.host == h } } ?: "")?.apply()
|
||||
}
|
||||
|
||||
fun custom(context: Context): String = prefs(context)?.getString(KEY_CUSTOM, "") ?: ""
|
||||
|
||||
fun setCustom(context: Context, prefix: String) {
|
||||
prefs(context)?.edit()?.putString(KEY_CUSTOM, normalizePrefix(prefix))?.apply()
|
||||
}
|
||||
|
||||
fun reset(context: Context) {
|
||||
lastGood = null
|
||||
prefs(context)?.edit()?.clear()?.apply()
|
||||
}
|
||||
|
||||
private fun prefs(): SharedPreferences? = app?.getSharedPreferences(PREFS, Context.MODE_PRIVATE)
|
||||
|
||||
private fun prefs(context: Context): SharedPreferences? =
|
||||
context.applicationContext.getSharedPreferences(PREFS, Context.MODE_PRIVATE)
|
||||
|
||||
private fun Mirror.proxy(target: String): String = "https://$host/$target"
|
||||
|
||||
private fun host(url: String): String =
|
||||
MIRRORS.firstOrNull { url.startsWith("https://${it.host}/") }?.host ?: ""
|
||||
|
||||
private fun picked(prefs: SharedPreferences, api: Boolean): Mirror? {
|
||||
val chosen = MIRRORS.firstOrNull { it.host == (prefs.getString(KEY_MIRROR, "") ?: "") } ?: MIRRORS.firstOrNull()
|
||||
return if (api && chosen != null && !chosen.api) MIRRORS.firstOrNull { it.api } else chosen
|
||||
}
|
||||
|
||||
private fun custom(prefs: SharedPreferences): String = prefs.getString(KEY_CUSTOM, "") ?: ""
|
||||
|
||||
private fun customProxy(prefs: SharedPreferences, target: String): String? =
|
||||
normalizePrefix(custom(prefs)).takeIf { it.isNotEmpty() }?.let { "$it/$target" }
|
||||
|
||||
private fun normalizePrefix(value: String): String {
|
||||
val trimmed = value.trim().trimEnd('/')
|
||||
if (trimmed.isEmpty() || trimmed.startsWith("http://")) return ""
|
||||
return if (trimmed.startsWith("https://")) trimmed else "https://$trimmed"
|
||||
}
|
||||
}
|
||||
@@ -6,69 +6,201 @@ import java.io.BufferedInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
public final class Downloader {
|
||||
private static final String TAG = "Downloader";
|
||||
private static final int TIMEOUT_MS = 30_000;
|
||||
private static final int CONNECT_TIMEOUT_MS = 10_000;
|
||||
private static final int STALL_TIMEOUT_MS = 15_000;
|
||||
private static final int HTTP_RANGE_NOT_SATISFIABLE = 416;
|
||||
|
||||
private Downloader() {}
|
||||
|
||||
public static String downloadString(String url) {
|
||||
HttpURLConnection connection = null;
|
||||
try {
|
||||
connection = open(url);
|
||||
if (connection.getResponseCode() / 100 != 2) {
|
||||
Log.w(TAG, url + " -> HTTP " + connection.getResponseCode());
|
||||
return null;
|
||||
List<String> sources = DownloadSource.INSTANCE.candidates(url);
|
||||
for (int i = 0; i < sources.size(); i++) {
|
||||
if (i > 0) Log.i(TAG, "retrying " + url + " via " + sources.get(i));
|
||||
Fetch fetch = fetch(sources.get(i));
|
||||
if (fetch.body != null) {
|
||||
DownloadSource.INSTANCE.succeeded(sources.get(i));
|
||||
return fetch.body;
|
||||
}
|
||||
try (InputStream in = connection.getInputStream();
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream()) {
|
||||
FileUtils.copy(in, out);
|
||||
return new String(out.toByteArray(), StandardCharsets.UTF_8);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "GET " + url, e);
|
||||
return null;
|
||||
} finally {
|
||||
if (connection != null) connection.disconnect();
|
||||
if (fetch.fatal && sources.get(i).equals(url)) return null;
|
||||
}
|
||||
DownloadSource.INSTANCE.failed();
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Fetches without the mirror list, for a URL whose body is a digest the payload is checked against. */
|
||||
public static String downloadDirect(String url) {
|
||||
return fetch(url).body;
|
||||
}
|
||||
|
||||
public static boolean downloadFile(String url, File destination, boolean resume,
|
||||
java.util.function.Consumer<Float> progress) {
|
||||
return downloadFile(url, destination, resume, null, progress);
|
||||
}
|
||||
|
||||
/** Verify each candidate before accepting it, so a bad mirror can fall back. */
|
||||
public static boolean downloadFile(String url, File destination, boolean resume, String expectedSha256,
|
||||
java.util.function.Consumer<Float> progress) {
|
||||
if (expectedSha256 != null && !expectedSha256.matches("(?i)[0-9a-f]{64}"))
|
||||
throw new IllegalArgumentException("Expected SHA-256 must be 64 hex characters");
|
||||
return downloadCandidates(url, DownloadSource.INSTANCE.candidates(url), destination, resume, expectedSha256, progress);
|
||||
}
|
||||
|
||||
// Package-private for the local multi-source HTTP test.
|
||||
static boolean downloadCandidates(String original, List<String> sources, File destination, boolean resume,
|
||||
String expectedSha256, java.util.function.Consumer<Float> progress) {
|
||||
Identity identity = loadIdentity(destination, resume, expectedSha256);
|
||||
for (int i = 0; i < sources.size(); i++) {
|
||||
String source = sources.get(i);
|
||||
if (i > 0) Log.i(TAG, "retrying " + original + " via " + source);
|
||||
Outcome outcome = attempt(source, destination, resume, identity, expectedSha256, progress);
|
||||
if (outcome == Outcome.DONE) {
|
||||
if (expectedSha256 != null && !expectedSha256.equalsIgnoreCase(Hashes.sha256(destination))) {
|
||||
Log.w(TAG, "checksum mismatch from " + source + "; trying another source");
|
||||
if (!discardPartial(destination, identity)) return false;
|
||||
continue;
|
||||
}
|
||||
resumeFile(destination).delete();
|
||||
DownloadSource.INSTANCE.succeeded(source);
|
||||
if (progress != null) progress.accept(1f);
|
||||
return true;
|
||||
}
|
||||
if (outcome == Outcome.FATAL && source.equals(original)) return false;
|
||||
}
|
||||
DownloadSource.INSTANCE.failed();
|
||||
return false;
|
||||
}
|
||||
|
||||
private enum Outcome { DONE, RETRY, FATAL }
|
||||
|
||||
private static final class Identity {
|
||||
private String source;
|
||||
private String etag;
|
||||
}
|
||||
|
||||
private static File resumeFile(File dest) {
|
||||
return new File(dest.getPath() + ".resume.properties");
|
||||
}
|
||||
|
||||
private static boolean strongETag(String value) {
|
||||
return value != null && !value.isEmpty() && !value.startsWith("W/");
|
||||
}
|
||||
|
||||
/** Only reuse saved bytes when we persisted a strong validator and their source. */
|
||||
private static Identity loadIdentity(File dest, boolean resume, String expectedSha256) {
|
||||
Identity identity = new Identity();
|
||||
File marker = resumeFile(dest);
|
||||
if (!resume || !dest.isFile() || dest.length() == 0) {
|
||||
marker.delete();
|
||||
return identity;
|
||||
}
|
||||
try (FileInputStream in = new FileInputStream(marker)) {
|
||||
Properties p = new Properties();
|
||||
p.load(in);
|
||||
String source = p.getProperty("source");
|
||||
String etag = p.getProperty("etag");
|
||||
String expected = p.getProperty("sha256", "");
|
||||
if (source != null && source.startsWith("http") && strongETag(etag)
|
||||
&& expected.equals(expectedSha256 == null ? "" : expectedSha256.toLowerCase(java.util.Locale.ROOT))) {
|
||||
identity.source = source;
|
||||
identity.etag = etag;
|
||||
return identity;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
// Legacy partials or interrupted metadata writes have no trustworthy identity.
|
||||
}
|
||||
if (!discardPartial(dest, identity)) Log.w(TAG, "could not discard unidentified partial " + dest);
|
||||
return identity;
|
||||
}
|
||||
|
||||
private static boolean discardPartial(File dest, Identity identity) {
|
||||
identity.source = null;
|
||||
identity.etag = null;
|
||||
File marker = resumeFile(dest);
|
||||
return (!dest.exists() || dest.delete()) && (!marker.exists() || marker.delete());
|
||||
}
|
||||
|
||||
private static void saveIdentity(File dest, Identity identity, String expectedSha256) {
|
||||
File marker = resumeFile(dest);
|
||||
if (!strongETag(identity.etag)) {
|
||||
marker.delete();
|
||||
return;
|
||||
}
|
||||
Properties p = new Properties();
|
||||
p.setProperty("source", identity.source);
|
||||
p.setProperty("etag", identity.etag);
|
||||
p.setProperty("sha256", expectedSha256 == null ? "" : expectedSha256.toLowerCase(java.util.Locale.ROOT));
|
||||
try (FileOutputStream out = new FileOutputStream(marker)) {
|
||||
p.store(out, "DroidDeck partial download validator");
|
||||
} catch (IOException e) {
|
||||
marker.delete(); // No valid metadata means no future resume.
|
||||
Log.w(TAG, "cannot persist download validator", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static Outcome attempt(String url, File destination, boolean resume, Identity identity,
|
||||
String expectedSha256, java.util.function.Consumer<Float> progress) {
|
||||
HttpURLConnection connection = null;
|
||||
long have = resume && destination.isFile() ? destination.length() : 0;
|
||||
try {
|
||||
connection = open(url);
|
||||
if (have > 0) connection.setRequestProperty("Range", "bytes=" + have + "-");
|
||||
if (have > 0 && (!url.equals(identity.source) || !strongETag(identity.etag))) {
|
||||
// A new source or unvalidated bytes must restart from byte zero.
|
||||
if (!discardPartial(destination, identity)) return Outcome.RETRY;
|
||||
have = 0;
|
||||
}
|
||||
connection = open(url, STALL_TIMEOUT_MS);
|
||||
if (have > 0) {
|
||||
connection.setRequestProperty("Range", "bytes=" + have + "-");
|
||||
connection.setRequestProperty("If-Range", identity.etag);
|
||||
}
|
||||
int code = connection.getResponseCode();
|
||||
boolean appending = code == HttpURLConnection.HTTP_PARTIAL;
|
||||
if (appending && !rangeStartsAt(connection.getHeaderField("Content-Range"), have)) {
|
||||
// A 206 that does not begin where the kept bytes end would corrupt the file if appended.
|
||||
if (have > 0 && code == HTTP_RANGE_NOT_SATISFIABLE) {
|
||||
connection.disconnect();
|
||||
destination.delete();
|
||||
return downloadFile(url, destination, false, progress);
|
||||
if (!discardPartial(destination, identity)) return Outcome.RETRY;
|
||||
return attempt(url, destination, false, identity, expectedSha256, progress);
|
||||
}
|
||||
if (code / 100 != 2) {
|
||||
if (have > 0) {
|
||||
connection.disconnect();
|
||||
destination.delete();
|
||||
return downloadFile(url, destination, false, progress);
|
||||
}
|
||||
Log.w(TAG, url + " -> HTTP " + code);
|
||||
return false;
|
||||
return code == HttpURLConnection.HTTP_NOT_FOUND || code == HttpURLConnection.HTTP_GONE
|
||||
? Outcome.FATAL : Outcome.RETRY;
|
||||
}
|
||||
boolean appending = code == HttpURLConnection.HTTP_PARTIAL;
|
||||
if (appending && !rangeStartsAt(connection.getHeaderField("Content-Range"), have)) {
|
||||
connection.disconnect();
|
||||
if (!discardPartial(destination, identity)) return Outcome.RETRY;
|
||||
return attempt(url, destination, false, identity, expectedSha256, progress);
|
||||
}
|
||||
String etag = connection.getHeaderField("ETag");
|
||||
if (have > 0 && appending && (!strongETag(etag) || !etag.equals(identity.etag))) {
|
||||
connection.disconnect();
|
||||
if (!discardPartial(destination, identity)) return Outcome.RETRY;
|
||||
return attempt(url, destination, false, identity, expectedSha256, progress);
|
||||
}
|
||||
if (!appending && have > 0) {
|
||||
// If-Range may legitimately return full 200 when representation changed.
|
||||
if (!discardPartial(destination, identity)) return Outcome.RETRY;
|
||||
have = 0;
|
||||
}
|
||||
if (!appending) have = 0;
|
||||
long length = connection.getContentLengthLong();
|
||||
long total = length < 0 ? -1 : length + have;
|
||||
long total = appending ? rangeTotal(connection.getHeaderField("Content-Range")) : -1;
|
||||
if (total < 0) total = length < 0 ? -1 : length + have;
|
||||
File parent = destination.getParentFile();
|
||||
if (parent != null && !parent.isDirectory())
|
||||
parent.mkdirs();
|
||||
if (parent != null && !parent.isDirectory()) parent.mkdirs();
|
||||
identity.source = url;
|
||||
identity.etag = strongETag(etag) ? etag : null;
|
||||
saveIdentity(destination, identity, expectedSha256);
|
||||
long written = have;
|
||||
try (InputStream in = new BufferedInputStream(connection.getInputStream(), 1 << 16);
|
||||
OutputStream out = new FileOutputStream(destination, appending)) {
|
||||
@@ -83,11 +215,11 @@ public final class Downloader {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (progress != null) progress.accept(1f);
|
||||
return total <= 0 || written >= total;
|
||||
if (total > 0 && written < total) return Outcome.RETRY;
|
||||
return Outcome.DONE;
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "download " + url, e);
|
||||
return false;
|
||||
return Outcome.RETRY;
|
||||
} finally {
|
||||
if (connection != null) connection.disconnect();
|
||||
}
|
||||
@@ -100,10 +232,49 @@ public final class Downloader {
|
||||
return m.matches() && Long.parseLong(m.group(1)) == start;
|
||||
}
|
||||
|
||||
private static HttpURLConnection open(String url) throws java.io.IOException {
|
||||
/** The complete length in a `Content-Range` header, or -1 when the header leaves it unknown. */
|
||||
static long rangeTotal(String contentRange) {
|
||||
if (contentRange == null) return -1;
|
||||
java.util.regex.Matcher m = java.util.regex.Pattern.compile("^\\s*bytes\\s+\\d+-\\d+/(\\d+)\\s*$").matcher(contentRange);
|
||||
return m.matches() ? Long.parseLong(m.group(1)) : -1;
|
||||
}
|
||||
|
||||
private static final class Fetch {
|
||||
final String body;
|
||||
final boolean fatal;
|
||||
|
||||
Fetch(String body, boolean fatal) {
|
||||
this.body = body;
|
||||
this.fatal = fatal;
|
||||
}
|
||||
}
|
||||
|
||||
private static Fetch fetch(String url) {
|
||||
HttpURLConnection connection = null;
|
||||
try {
|
||||
connection = open(url, STALL_TIMEOUT_MS);
|
||||
int code = connection.getResponseCode();
|
||||
if (code / 100 != 2) {
|
||||
Log.w(TAG, url + " -> HTTP " + code);
|
||||
return new Fetch(null, code == HttpURLConnection.HTTP_NOT_FOUND || code == HttpURLConnection.HTTP_GONE);
|
||||
}
|
||||
try (InputStream in = connection.getInputStream();
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream()) {
|
||||
FileUtils.copy(in, out);
|
||||
return new Fetch(new String(out.toByteArray(), StandardCharsets.UTF_8), false);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "GET " + url, e);
|
||||
return new Fetch(null, false);
|
||||
} finally {
|
||||
if (connection != null) connection.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
private static HttpURLConnection open(String url, int readTimeoutMs) throws java.io.IOException {
|
||||
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
|
||||
connection.setConnectTimeout(TIMEOUT_MS);
|
||||
connection.setReadTimeout(TIMEOUT_MS);
|
||||
connection.setConnectTimeout(CONNECT_TIMEOUT_MS);
|
||||
connection.setReadTimeout(readTimeoutMs);
|
||||
connection.setInstanceFollowRedirects(true);
|
||||
connection.setRequestProperty("User-Agent", "DroidDeck-Android");
|
||||
return connection;
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.droiddeck.launcher.frontend
|
||||
import android.content.Context
|
||||
import android.graphics.BitmapFactory
|
||||
import android.util.Log
|
||||
import com.droiddeck.launcher.core.DownloadSource
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import java.io.File
|
||||
@@ -199,24 +200,62 @@ object CoverArt {
|
||||
setRequestProperty("User-Agent", "DroidDeck")
|
||||
}
|
||||
|
||||
private fun exists(url: String): Boolean = try {
|
||||
val c = open(url, "HEAD"); val ok = c.responseCode == 200; c.disconnect(); ok
|
||||
} catch (e: Exception) { false }
|
||||
private fun <T> through(url: String, attempt: (String, Boolean) -> T?): T? {
|
||||
for (source in DownloadSource.candidates(url)) {
|
||||
val result = attempt(source, source == url)
|
||||
if (result != null) {
|
||||
DownloadSource.succeeded(source)
|
||||
return result
|
||||
}
|
||||
}
|
||||
DownloadSource.failed()
|
||||
return null
|
||||
}
|
||||
|
||||
private fun get(url: String): String? = try {
|
||||
private fun exists(url: String): Boolean = through(url) { source, original -> head(source, original) } ?: false
|
||||
|
||||
private fun head(url: String, original: Boolean): Boolean? = try {
|
||||
val c = open(url, "HEAD")
|
||||
val code = c.responseCode
|
||||
c.disconnect()
|
||||
when {
|
||||
code == 200 -> true
|
||||
code == 404 || code == 410 -> if (original) false else null
|
||||
else -> null
|
||||
}
|
||||
} catch (e: Exception) { null }
|
||||
|
||||
private fun get(url: String): String? = through(url) { source, original -> text(source, original) }
|
||||
|
||||
private fun text(url: String, original: Boolean): String? = try {
|
||||
val c = open(url)
|
||||
if (c.responseCode != 200) { c.disconnect(); null } else c.inputStream.bufferedReader().use { it.readText() }
|
||||
val code = c.responseCode
|
||||
when {
|
||||
code == 200 -> c.inputStream.bufferedReader().use { it.readText() }.takeIf { it.isNotEmpty() }
|
||||
code == 404 || code == 410 -> { c.disconnect(); if (original) "" else null }
|
||||
else -> { c.disconnect(); null }
|
||||
}
|
||||
} catch (e: Exception) { Log.w(TAG, "$url: $e"); null }
|
||||
|
||||
private fun download(url: String, target: File): Boolean = try {
|
||||
private fun download(url: String, target: File): Boolean = through(url) { source, original -> fetch(source, target, original) } ?: false
|
||||
|
||||
private fun fetch(url: String, target: File, original: Boolean): Boolean? = try {
|
||||
val c = open(url)
|
||||
if (c.responseCode != 200) { c.disconnect(); false } else {
|
||||
target.parentFile?.mkdirs()
|
||||
val tmp = File(target.path + ".part")
|
||||
c.inputStream.use { input -> tmp.outputStream().use { input.copyTo(it) } }
|
||||
val bounds = BitmapFactory.Options().apply { inJustDecodeBounds = true }
|
||||
BitmapFactory.decodeFile(tmp.path, bounds)
|
||||
if (bounds.outWidth > 0 && tmp.renameTo(target)) true else { tmp.delete(); false }
|
||||
when (val code = c.responseCode) {
|
||||
200 -> {
|
||||
target.parentFile?.mkdirs()
|
||||
val tmp = File(target.path + ".part")
|
||||
c.inputStream.use { input -> tmp.outputStream().use { input.copyTo(it) } }
|
||||
val bounds = BitmapFactory.Options().apply { inJustDecodeBounds = true }
|
||||
BitmapFactory.decodeFile(tmp.path, bounds)
|
||||
when {
|
||||
bounds.outWidth > 0 && tmp.renameTo(target) -> true
|
||||
original -> { tmp.delete(); false }
|
||||
else -> { tmp.delete(); null }
|
||||
}
|
||||
}
|
||||
404, 410 -> { c.disconnect(); if (original) false else null }
|
||||
else -> { c.disconnect(); null }
|
||||
}
|
||||
} catch (e: Exception) { Log.w(TAG, "$url: $e"); false }
|
||||
} catch (e: Exception) { Log.w(TAG, "$url: $e"); null }
|
||||
}
|
||||
@@ -1,18 +1,21 @@
|
||||
package com.droiddeck.launcher.gpu
|
||||
|
||||
import com.droiddeck.launcher.core.DownloadSource
|
||||
import com.droiddeck.launcher.core.Downloader
|
||||
import com.droiddeck.launcher.core.Hashes
|
||||
import com.droiddeck.launcher.R
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.droiddeck.launcher.core.FileUtils
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
import java.io.IOException
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
|
||||
object TurnipReleases {
|
||||
private const val TAG = "TurnipReleases"
|
||||
private const val PREFS = "turnip_releases"
|
||||
private const val KEY_RELEASE = "latest"
|
||||
private const val KEY_DOWNLOADS = "downloads"
|
||||
@@ -104,7 +107,24 @@ object TurnipReleases {
|
||||
}
|
||||
|
||||
private fun get(context: Context, url: String): String {
|
||||
val c = URL(url).openConnection() as HttpURLConnection
|
||||
val sources = DownloadSource.candidates(url)
|
||||
var last: IOException? = null
|
||||
for ((index, source) in sources.withIndex()) {
|
||||
try {
|
||||
val body = get(context, source, url)
|
||||
DownloadSource.succeeded(source)
|
||||
return body
|
||||
} catch (e: IOException) {
|
||||
last = e
|
||||
if (index < sources.lastIndex) Log.i(TAG, "retrying $url via $source")
|
||||
}
|
||||
}
|
||||
DownloadSource.failed()
|
||||
throw last ?: IOException(context.getString(R.string.turnip_github_http, 0))
|
||||
}
|
||||
|
||||
private fun get(context: Context, source: String, url: String): String {
|
||||
val c = URL(source).openConnection() as HttpURLConnection
|
||||
c.connectTimeout = 15_000
|
||||
c.readTimeout = 20_000
|
||||
c.setRequestProperty("Accept", "application/vnd.github+json")
|
||||
@@ -160,39 +180,13 @@ object TurnipReleases {
|
||||
fun download(context: Context, asset: Asset, progress: (Int) -> Unit): File {
|
||||
if (asset.sha256.isEmpty()) throw IOException(context.getString(R.string.turnip_list_predates_checksums))
|
||||
val target = File(context.cacheDir, asset.name)
|
||||
val c = URL(asset.url).openConnection() as HttpURLConnection
|
||||
c.connectTimeout = 15_000
|
||||
c.readTimeout = 60_000
|
||||
c.setRequestProperty("User-Agent", "DroidDeck-app")
|
||||
c.instanceFollowRedirects = true
|
||||
try {
|
||||
if (c.responseCode != 200) throw IOException(context.getString(R.string.turnip_download_http, c.responseCode))
|
||||
val total = c.contentLengthLong.takeIf { it > 0 } ?: asset.size
|
||||
c.inputStream.use { input ->
|
||||
FileOutputStream(target).use { out ->
|
||||
val buf = ByteArray(1 shl 16)
|
||||
var done = 0L
|
||||
var last = -1
|
||||
while (true) {
|
||||
val r = input.read(buf)
|
||||
if (r <= 0) break
|
||||
out.write(buf, 0, r)
|
||||
done += r
|
||||
val pct = if (total > 0) (done * 100 / total).toInt() else 0
|
||||
if (pct != last) { last = pct; progress(pct) }
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!asset.sha256.equals(Hashes.sha256(target), ignoreCase = true)) {
|
||||
throw IOException(context.getString(R.string.turnip_checksum_mismatch))
|
||||
}
|
||||
return target
|
||||
} catch (e: Exception) {
|
||||
val ok = Downloader.downloadFile(asset.url, target, true, asset.sha256) { f -> progress(if (f < 0) -1 else (f * 100).toInt()) }
|
||||
if (!ok) throw IOException(context.getString(R.string.turnip_download_failed))
|
||||
if (!asset.sha256.equals(Hashes.sha256(target), ignoreCase = true)) {
|
||||
FileUtils.delete(target)
|
||||
throw e
|
||||
} finally {
|
||||
c.disconnect()
|
||||
throw IOException(context.getString(R.string.turnip_checksum_mismatch))
|
||||
}
|
||||
return target
|
||||
}
|
||||
|
||||
private fun downloads(context: Context): JSONObject =
|
||||
|
||||
@@ -108,11 +108,11 @@ object DeckyManager {
|
||||
target.parentFile?.mkdirs()
|
||||
val temp = File(target.parentFile, "PluginLoader.download")
|
||||
val downloading = context.getString(R.string.user_apps_downloading, release.tag)
|
||||
val ok = Downloader.downloadFile(release.url, temp, false) { f -> progress(downloading, if (f < 0) -1 else (f * 100).toInt().coerceIn(0, 100)) }
|
||||
val ok = Downloader.downloadFile(release.url, temp, true, release.digest?.substringAfter(':')) { f -> progress(downloading, if (f < 0) -1 else (f * 100).toInt().coerceIn(0, 100)) }
|
||||
if (!ok) { temp.delete(); return context.getString(R.string.deckymgr_download_failed) }
|
||||
if (temp.length() != release.size) { temp.delete(); return context.getString(R.string.deckymgr_size_mismatch) }
|
||||
val expected = release.digest?.substringAfter(':') ?: release.shaUrl?.let { checksumUrl ->
|
||||
val checksumBody = Downloader.downloadString(checksumUrl) ?: run { temp.delete(); return context.getString(R.string.deckymgr_checksum_download_failed) }
|
||||
val checksumBody = Downloader.downloadDirect(checksumUrl) ?: run { temp.delete(); return context.getString(R.string.deckymgr_checksum_download_failed) }
|
||||
Regex("(?i)\\b[0-9a-f]{64}\\b").find(checksumBody)?.value
|
||||
} ?: run { temp.delete(); return context.getString(R.string.deckymgr_checksum_missing) }
|
||||
if (!expected.matches(Regex("(?i)[0-9a-f]{64}"))) { temp.delete(); return context.getString(R.string.deckymgr_checksum_invalid) }
|
||||
@@ -236,7 +236,7 @@ object DeckyManager {
|
||||
downloadingBinary = true
|
||||
progress(downloading, -1)
|
||||
val downloaded = try {
|
||||
Downloader.downloadFile(url, temp, false) { fraction ->
|
||||
Downloader.downloadFile(url, temp, true, hash) { fraction ->
|
||||
progress(downloading, if (fraction < 0) -1 else (fraction * 100).toInt().coerceIn(0, 100))
|
||||
}
|
||||
} finally {
|
||||
|
||||
@@ -90,7 +90,7 @@ object DesktopCatalog {
|
||||
try {
|
||||
val downloading = context.getString(R.string.user_apps_downloading, entry.name)
|
||||
listener?.onProgress(LinuxRuntimeInstaller.Step.DOWNLOADING, downloading, 0)
|
||||
val ok = Downloader.downloadFile(entry.url, download, true) { f ->
|
||||
val ok = Downloader.downloadFile(entry.url, download, true, entry.sha256) { f ->
|
||||
listener?.onProgress(LinuxRuntimeInstaller.Step.DOWNLOADING, downloading, if (f < 0) -1 else Math.round(f * 100f))
|
||||
}
|
||||
if (!ok) return context.getString(R.string.user_apps_download_failed)
|
||||
|
||||
@@ -261,7 +261,7 @@ public final class LinuxRuntimeInstaller {
|
||||
emptyTrash(LinuxRuntime.rootDir(context).getParentFile());
|
||||
String downloading = context.getString(R.string.rtinst_downloading);
|
||||
if (listener != null) listener.onProgress(Step.DOWNLOADING, downloading, 0);
|
||||
boolean ok = Downloader.downloadFile(release.url, archive, true, (fraction) -> {
|
||||
boolean ok = Downloader.downloadFile(release.url, archive, true, release.sha256, (fraction) -> {
|
||||
if (listener != null) {
|
||||
listener.onProgress(Step.DOWNLOADING, downloading,
|
||||
fraction < 0 ? -1 : Math.round(fraction * 100f));
|
||||
|
||||
@@ -929,8 +929,7 @@ object ComponentsManager {
|
||||
require(Hashes.isGithubSha256(item.digest)) { context.getString(R.string.cmgr_list_predates_checksums) }
|
||||
val dest = File(packagesDir(context), safeName(item.file))
|
||||
val part = File(dest.parentFile, dest.name + ".part")
|
||||
part.delete()
|
||||
check(Downloader.downloadFile(item.url, part, false) { f -> progress(if (f < 0) -1 else (f * 100).toInt().coerceIn(0, 100)) }) { context.getString(R.string.user_apps_download_failed) }
|
||||
check(Downloader.downloadFile(item.url, part, true, item.digest.substringAfter(':')) { f -> progress(if (f < 0) -1 else (f * 100).toInt().coerceIn(0, 100)) }) { context.getString(R.string.user_apps_download_failed) }
|
||||
if (!Hashes.sha256(part).equals(item.digest.substringAfter(':'), true)) { part.delete(); error(context.getString(R.string.cmgr_checksum_mismatch)) }
|
||||
val info = runCatching { packageInfo(context, part) }.getOrElse { part.delete(); throw it }
|
||||
synchronized(lock) { part.renameTo(dest) }
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.droiddeck.launcher.session
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.droiddeck.launcher.core.DownloadSource
|
||||
import com.droiddeck.launcher.core.FileUtils
|
||||
import com.droiddeck.launcher.core.Hashes
|
||||
import com.github.luben.zstd.ZstdInputStream
|
||||
@@ -620,16 +621,27 @@ object EsyncPacks {
|
||||
val label = context.getString(com.droiddeck.launcher.R.string.esync_fetching)
|
||||
onProgress?.invoke(label, -1)
|
||||
var reported = -1
|
||||
val fetched = FileOutputStream(part).use { output ->
|
||||
fetch(entry.asset.url, entry.asset.size, output) { done ->
|
||||
val percent = (done * 100 / entry.asset.size).toInt().coerceIn(0, 100)
|
||||
if (percent != reported) {
|
||||
reported = percent
|
||||
onProgress?.invoke(label, percent)
|
||||
val sources = DownloadSource.candidates(entry.asset.url)
|
||||
var fetched = false
|
||||
for ((index, source) in sources.withIndex()) {
|
||||
if (index > 0) Log.i(TAG, "retrying ${entry.asset.url} via $source")
|
||||
reported = -1
|
||||
fetched = FileOutputStream(part).use { output ->
|
||||
fetch(source, entry.asset.size, output) { done ->
|
||||
val percent = (done * 100 / entry.asset.size).toInt().coerceIn(0, 100)
|
||||
if (percent != reported) {
|
||||
reported = percent
|
||||
onProgress?.invoke(label, percent)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fetched) {
|
||||
DownloadSource.succeeded(source)
|
||||
break
|
||||
}
|
||||
}
|
||||
if (!fetched) {
|
||||
DownloadSource.failed()
|
||||
SessionEvents.record("sync.pack", mapOf("id" to entry.id, "source" to "download", "result" to "failed", "reason" to "download"))
|
||||
return false
|
||||
}
|
||||
@@ -836,8 +848,17 @@ object EsyncPacks {
|
||||
}
|
||||
|
||||
private fun fetchBytes(url: String, limit: Long): ByteArray? {
|
||||
val out = ByteArrayOutputStream()
|
||||
return if (fetch(url, limit, out, null)) out.toByteArray() else null
|
||||
val sources = DownloadSource.candidates(url)
|
||||
for ((index, source) in sources.withIndex()) {
|
||||
if (index > 0) Log.i(TAG, "retrying $url via $source")
|
||||
val out = ByteArrayOutputStream()
|
||||
if (fetch(source, limit, out, null)) {
|
||||
DownloadSource.succeeded(source)
|
||||
return out.toByteArray()
|
||||
}
|
||||
}
|
||||
DownloadSource.failed()
|
||||
return null
|
||||
}
|
||||
|
||||
private fun fetch(url: String, limit: Long, out: OutputStream, progress: ((Long) -> Unit)?): Boolean =
|
||||
|
||||
@@ -167,7 +167,7 @@ object ProtonExtras {
|
||||
onProgress(downloading, 0)
|
||||
var downloaded = false
|
||||
for (attempt in 0 until 5) {
|
||||
downloaded = Downloader.downloadFile(asset.url, archive, true) { fraction ->
|
||||
downloaded = Downloader.downloadFile(asset.url, archive, true, asset.sha256) { fraction ->
|
||||
onProgress(downloading, if (fraction < 0) -1 else (fraction * 100f).toInt().coerceIn(0, 100))
|
||||
}
|
||||
if (downloaded) break
|
||||
@@ -192,7 +192,7 @@ object ProtonExtras {
|
||||
val verified = when {
|
||||
asset.sha256 != null -> asset.sha256.equals(Hashes.sha256(archive), ignoreCase = true)
|
||||
asset.sha512 != null -> {
|
||||
val expected = Downloader.downloadString(asset.sha512)?.let { Regex("(?i)\\b[0-9a-f]{128}\\b").find(it)?.value }
|
||||
val expected = Downloader.downloadDirect(asset.sha512)?.let { Regex("(?i)\\b[0-9a-f]{128}\\b").find(it)?.value }
|
||||
?: return context.getString(R.string.pextra_checksum_unreadable)
|
||||
expected.equals(Hashes.sha512(archive), ignoreCase = true)
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.droiddeck.launcher.session
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.droiddeck.launcher.core.DownloadSource
|
||||
import com.droiddeck.launcher.core.GameEnvironment
|
||||
import com.droiddeck.launcher.input.ControllerPrefs
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
@@ -41,6 +42,7 @@ object SettingsReset {
|
||||
context.getSharedPreferences("frame_gen", Context.MODE_PRIVATE).edit().clear().commit()
|
||||
context.getSharedPreferences("steam_touch", Context.MODE_PRIVATE).edit()
|
||||
.apply { STEAM_TOUCH_KEYS.forEach { remove(it) } }.commit()
|
||||
DownloadSource.reset(context)
|
||||
com.droiddeck.launcher.agent.AgentAccess.setCommandsEnabled(context, false)
|
||||
|
||||
if (gameProfiles) {
|
||||
|
||||
@@ -77,6 +77,7 @@ import com.droiddeck.launcher.frontend.Library
|
||||
import com.droiddeck.launcher.gpu.FrameGen
|
||||
import com.droiddeck.launcher.gpu.Lossless
|
||||
import com.droiddeck.launcher.input.SecondScreenDisplay
|
||||
import com.droiddeck.launcher.core.DownloadSource
|
||||
import com.droiddeck.launcher.core.PhantomProcessLimit
|
||||
import com.droiddeck.launcher.core.PhantomProcessStatus
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
@@ -131,6 +132,9 @@ class FrontEndState(
|
||||
val showPhantomGate: Boolean = false,
|
||||
val orientation: Int = android.content.pm.ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE,
|
||||
val launcherFullscreen: Boolean = true,
|
||||
val downloadSource: String = DownloadSource.MODE_AUTO,
|
||||
val downloadMirror: String = "",
|
||||
val downloadPrefix: String = "",
|
||||
val animationsEnabled: Boolean = true,
|
||||
val gameStoresEnabled: Boolean = true,
|
||||
val gameStoresSpeedTier: String = "fast",
|
||||
@@ -198,6 +202,9 @@ class FrontEndActions(
|
||||
val onOrientation: (Int) -> Unit = {},
|
||||
val onLauncherFullscreen: (Boolean) -> Unit = {},
|
||||
val onAnimationsEnabled: (Boolean) -> Unit = {},
|
||||
val onDownloadSource: (String) -> Unit = {},
|
||||
val onDownloadMirror: (String) -> Unit = {},
|
||||
val onDownloadPrefix: (String) -> Unit = {},
|
||||
val onGameStoresEnabled: (Boolean) -> Unit = {},
|
||||
val onGameStoresSpeedTier: (String) -> Unit = {},
|
||||
val onStoresOpenTab: (String) -> Unit = {},
|
||||
|
||||
@@ -75,6 +75,7 @@ import androidx.compose.ui.layout.boundsInRoot
|
||||
import androidx.compose.ui.layout.onGloballyPositioned
|
||||
import com.droiddeck.launcher.core.AppLanguage
|
||||
import com.droiddeck.launcher.core.DeviceSupport
|
||||
import com.droiddeck.launcher.core.DownloadSource
|
||||
import com.droiddeck.launcher.core.PhantomProcessLimit
|
||||
import com.droiddeck.launcher.core.PhantomProcessStatus
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
@@ -166,7 +167,14 @@ internal fun SetupPanel(
|
||||
val signedIn = s.offlineAccount != null
|
||||
var showLimitDetails by rememberSaveable { mutableStateOf(false) }
|
||||
var editSgdbKey by remember { mutableStateOf(false) }
|
||||
var editDownloadPrefix by remember { mutableStateOf(false) }
|
||||
if (editSgdbKey) SgdbKeyDialog(s.sgdbUserKey, onSave = { a.onSgdbKey(it); editSgdbKey = false }, onDismiss = { editSgdbKey = false })
|
||||
|
||||
if (editDownloadPrefix) TextEntryDialog(
|
||||
stringResource(R.string.setup_download_prefix), s.downloadPrefix,
|
||||
onDismiss = { editDownloadPrefix = false },
|
||||
onSave = { a.onDownloadPrefix(it); editDownloadPrefix = false },
|
||||
)
|
||||
val tabs = listOf(stringResource(R.string.setup_tab_overview), stringResource(R.string.setup_tab_controller), stringResource(R.string.setup_tab_launcher), stringResource(R.string.setup_tab_storage), stringResource(R.string.setup_tab_diagnostics))
|
||||
var tab by rememberSaveable { mutableStateOf(0) }
|
||||
val chipFocus = remember { List(tabs.size) { FocusRequester() } }
|
||||
@@ -390,10 +398,39 @@ internal fun SetupPanel(
|
||||
)
|
||||
}
|
||||
}
|
||||
val download: @Composable () -> Unit = {
|
||||
SettingsGroup(stringResource(R.string.setup_group_download)) {
|
||||
ChoiceRow(
|
||||
host, "download-source", stringResource(R.string.setup_download_source), null,
|
||||
listOf(
|
||||
DownloadSource.MODE_AUTO to stringResource(R.string.setup_download_source_auto),
|
||||
DownloadSource.MODE_DIRECT to stringResource(R.string.setup_download_source_direct),
|
||||
DownloadSource.MODE_MIRROR to stringResource(R.string.setup_download_source_mirror),
|
||||
DownloadSource.MODE_CUSTOM to stringResource(R.string.setup_download_source_custom),
|
||||
),
|
||||
s.downloadSource, onPick = a.onDownloadSource,
|
||||
)
|
||||
if (s.downloadSource == DownloadSource.MODE_MIRROR) {
|
||||
ChoiceRow(
|
||||
host, "download-mirror", stringResource(R.string.setup_download_mirror), null,
|
||||
DownloadSource.MIRRORS.map { it.host to it.host },
|
||||
s.downloadMirror, onPick = a.onDownloadMirror,
|
||||
)
|
||||
}
|
||||
if (s.downloadSource == DownloadSource.MODE_CUSTOM) {
|
||||
ActionRow(
|
||||
stringResource(R.string.setup_download_prefix),
|
||||
s.downloadPrefix.takeIf { it.isNotEmpty() },
|
||||
stringResource(R.string.mode_sgdb_edit),
|
||||
onClick = { editDownloadPrefix = true },
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (wide) Row(horizontalArrangement = Arrangement.spacedBy(16.dp), verticalAlignment = Alignment.Top) {
|
||||
Column(Modifier.weight(1f)) { look() }
|
||||
Column(Modifier.weight(1f)) { device(); art() }
|
||||
} else { look(); device(); art() }
|
||||
Column(Modifier.weight(1f)) { device(); art(); download() }
|
||||
} else { look(); device(); art(); download() }
|
||||
}
|
||||
STORAGE_TAB -> StoragePanel(s, a)
|
||||
4 -> {
|
||||
|
||||
@@ -3,8 +3,10 @@ package com.droiddeck.launcher.update
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Build
|
||||
import android.util.Log
|
||||
import com.droiddeck.launcher.BuildConfig
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.core.DownloadSource
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import java.io.IOException
|
||||
@@ -13,6 +15,7 @@ import java.net.URL
|
||||
import java.security.MessageDigest
|
||||
|
||||
object AppUpdates {
|
||||
private const val TAG = "AppUpdates"
|
||||
private const val REPO = "Droid-Deck/DroidDeck"
|
||||
private const val CI_REPO = "Droid-Deck/DroidDeck-CI"
|
||||
private const val CATALOG_URL = "https://raw.githubusercontent.com/$CI_REPO/main/catalog.json"
|
||||
@@ -353,7 +356,24 @@ object AppUpdates {
|
||||
}
|
||||
|
||||
private fun get(context: Context, url: String): String {
|
||||
val c = URL(url).openConnection() as HttpURLConnection
|
||||
val sources = DownloadSource.candidates(url)
|
||||
var last: IOException? = null
|
||||
for ((index, source) in sources.withIndex()) {
|
||||
try {
|
||||
val body = get(context, source, url)
|
||||
DownloadSource.succeeded(source)
|
||||
return body
|
||||
} catch (e: IOException) {
|
||||
last = e
|
||||
if (index < sources.lastIndex) Log.i(TAG, "retrying $url via $source")
|
||||
}
|
||||
}
|
||||
DownloadSource.failed()
|
||||
throw last ?: IOException(context.getString(R.string.appupd_http, 0))
|
||||
}
|
||||
|
||||
private fun get(context: Context, source: String, url: String): String {
|
||||
val c = URL(source).openConnection() as HttpURLConnection
|
||||
c.connectTimeout = 15_000
|
||||
c.readTimeout = 20_000
|
||||
c.setRequestProperty("Accept", "application/json")
|
||||
|
||||
@@ -10,13 +10,11 @@ import android.os.Build
|
||||
import android.provider.Settings
|
||||
import com.droiddeck.launcher.BuildConfig
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.core.Downloader
|
||||
import com.droiddeck.launcher.core.FileUtils
|
||||
import com.droiddeck.launcher.core.Hashes
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
import java.io.IOException
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
import java.security.MessageDigest
|
||||
|
||||
object SelfInstaller {
|
||||
@@ -30,32 +28,12 @@ object SelfInstaller {
|
||||
|
||||
fun download(context: Context, apk: AppUpdates.Apk, progress: (Int) -> Unit): File {
|
||||
val dir = File(context.cacheDir, "updates")
|
||||
FileUtils.delete(dir)
|
||||
dir.listFiles()?.forEach { if (it.name != apk.name) FileUtils.delete(it) }
|
||||
dir.mkdirs()
|
||||
val target = File(dir, apk.name)
|
||||
val c = URL(apk.url).openConnection() as HttpURLConnection
|
||||
c.connectTimeout = 15_000
|
||||
c.readTimeout = 60_000
|
||||
c.setRequestProperty("User-Agent", "DroidDeck-app")
|
||||
c.instanceFollowRedirects = true
|
||||
val ok = Downloader.downloadFile(apk.url, target, true, apk.sha256) { f -> progress(if (f < 0) -1 else (f * 100).toInt()) }
|
||||
if (!ok) throw IOException(context.getString(R.string.selfinst_download_failed))
|
||||
try {
|
||||
if (c.responseCode != 200) throw IOException(context.getString(R.string.selfinst_http, c.responseCode))
|
||||
val total = c.contentLengthLong.takeIf { it > 0 } ?: apk.size
|
||||
c.inputStream.use { input ->
|
||||
FileOutputStream(target).use { out ->
|
||||
val buf = ByteArray(1 shl 16)
|
||||
var done = 0L
|
||||
var last = -1
|
||||
while (true) {
|
||||
val r = input.read(buf)
|
||||
if (r <= 0) break
|
||||
out.write(buf, 0, r)
|
||||
done += r
|
||||
val pct = if (total > 0) (done * 100 / total).toInt() else -1
|
||||
if (pct != last) { last = pct; progress(pct) }
|
||||
}
|
||||
}
|
||||
}
|
||||
if (apk.size > 0 && target.length() != apk.size) {
|
||||
throw IOException(context.getString(R.string.selfinst_size_mismatch))
|
||||
}
|
||||
@@ -63,13 +41,11 @@ object SelfInstaller {
|
||||
throw IOException(context.getString(R.string.selfinst_checksum_mismatch))
|
||||
}
|
||||
validateDownloaded(context, target, apk)
|
||||
return target
|
||||
} catch (e: Exception) {
|
||||
FileUtils.delete(target)
|
||||
throw e
|
||||
} finally {
|
||||
c.disconnect()
|
||||
}
|
||||
return target
|
||||
}
|
||||
|
||||
private fun validateDownloaded(context: Context, file: File, apk: AppUpdates.Apk) {
|
||||
|
||||
@@ -1748,7 +1748,6 @@
|
||||
<string name="adbpair_done_text">اضغط للعودة إلى DroidDeck. يمكنك إيقاف تصحيح الأخطاء اللاسلكي الآن.</string>
|
||||
<string name="adbpair_title_failed">توقَّف إعداد تصحيح الأخطاء اللاسلكي</string>
|
||||
|
||||
<string name="selfinst_http">استجاب التنزيل بـ HTTP %1$d</string>
|
||||
<string name="selfinst_size_mismatch">حجم التنزيل غير مطابق لملف APK المنشور، وتم تجاهله - حاوِل مرة أخرى</string>
|
||||
<string name="selfinst_checksum_mismatch">التنزيل غير مطابق لمجموعه الاختباري، وتم تجاهله - حاوِل مرة أخرى</string>
|
||||
<string name="selfinst_wrong_package">التحديث مخصَّص لحزمة Android %1$s، لا %2$s</string>
|
||||
@@ -1846,7 +1845,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">تم الوصول إلى حدّ الطلبات في GitHub - حاوِل مرة أخرى لاحقًا</string>
|
||||
<string name="turnip_github_http">استجاب GitHub بـ HTTP %1$d</string>
|
||||
<string name="turnip_download_http">استجاب التنزيل بـ HTTP %1$d</string>
|
||||
<string name="turnip_list_predates_checksums">قائمة برامج التشغيل هذه أقدم من إضافة المجاميع الاختبارية - حدِّثها وحاوِل مرة أخرى</string>
|
||||
<string name="turnip_checksum_mismatch">عدم تطابق المجموع الاختباري - تم تجاهل التنزيل</string>
|
||||
<string name="turnip_not_adrenotools">ليس برنامج تشغيل AdrenoTools: %1$s</string>
|
||||
|
||||
@@ -1664,7 +1664,6 @@
|
||||
<string name="adbpair_done_text">Докосни, за да се върнеш в DroidDeck. Вече можеш да изключиш безжичното отстраняване на грешки.</string>
|
||||
<string name="adbpair_title_failed">Настройката на безжичното отстраняване на грешки спря</string>
|
||||
|
||||
<string name="selfinst_http">Изтеглянето отговори с HTTP %1$d</string>
|
||||
<string name="selfinst_size_mismatch">Размерът на изтеглянето не съответстваше на публикуваното APK и беше отхвърлен - опитай отново</string>
|
||||
<string name="selfinst_checksum_mismatch">Изтеглянето не съответстваше на контролната си сума и беше отхвърлено - опитай отново</string>
|
||||
<string name="selfinst_wrong_package">Актуализацията е за Android пакета %1$s, а не за %2$s</string>
|
||||
@@ -1762,7 +1761,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">Достигнато е ограничението на GitHub за заявки - опитай отново по-късно</string>
|
||||
<string name="turnip_github_http">GitHub отговори с HTTP %1$d</string>
|
||||
<string name="turnip_download_http">изтеглянето отговори с HTTP %1$d</string>
|
||||
<string name="turnip_list_predates_checksums">Този списък с драйвери е отпреди въвеждането на контролни суми - обнови го и опитай отново</string>
|
||||
<string name="turnip_checksum_mismatch">Несъответствие в контролната сума - изтеглянето беше отхвърлено</string>
|
||||
<string name="turnip_not_adrenotools">Не е драйвер за AdrenoTools: %1$s</string>
|
||||
|
||||
@@ -1706,7 +1706,6 @@
|
||||
<string name="adbpair_done_text">Klepnutím se vrátíte do DroidDecku. Bezdrátové ladění teď můžete vypnout.</string>
|
||||
<string name="adbpair_title_failed">Nastavení bezdrátového ladění bylo zastaveno</string>
|
||||
|
||||
<string name="selfinst_http">Stahování odpovědělo HTTP %1$d</string>
|
||||
<string name="selfinst_size_mismatch">Velikost stahování neodpovídala zveřejněnému APK a bylo zahozeno - zkuste to znovu</string>
|
||||
<string name="selfinst_checksum_mismatch">Stahování neodpovídalo svému kontrolnímu součtu a bylo zahozeno - zkuste to znovu</string>
|
||||
<string name="selfinst_wrong_package">Aktualizace je pro balíček Androidu %1$s, ne %2$s</string>
|
||||
@@ -1804,7 +1803,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">Byl dosažen limit požadavků GitHubu - zkuste to později</string>
|
||||
<string name="turnip_github_http">GitHub odpověděl HTTP %1$d</string>
|
||||
<string name="turnip_download_http">stahování odpovědělo HTTP %1$d</string>
|
||||
<string name="turnip_list_predates_checksums">Tento seznam ovladačů předchází kontrolním součtům - obnovte ho a zkuste to znovu</string>
|
||||
<string name="turnip_checksum_mismatch">Neshoda kontrolního součtu - stahování bylo zahozeno</string>
|
||||
<string name="turnip_not_adrenotools">Není ovladač AdrenoTools: %1$s</string>
|
||||
|
||||
@@ -1664,7 +1664,6 @@
|
||||
<string name="adbpair_done_text">Tryk for at gå tilbage til DroidDeck. Du kan slukke Trådløs fejlretning nu.</string>
|
||||
<string name="adbpair_title_failed">Opsætning af Trådløs fejlretning stoppet</string>
|
||||
|
||||
<string name="selfinst_http">Downloadet svarede HTTP %1$d</string>
|
||||
<string name="selfinst_size_mismatch">Downloadets størrelse passede ikke med den udgivne APK og blev kasseret - forsøg igen</string>
|
||||
<string name="selfinst_checksum_mismatch">Downloadet matchede ikke sin tjeksum og blev kasseret - forsøg igen</string>
|
||||
<string name="selfinst_wrong_package">Opdateringen er til Android-pakken %1$s, ikke %2$s</string>
|
||||
@@ -1762,7 +1761,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">GitHubs hastighedsgrænse blev nået - forsøg igen senere</string>
|
||||
<string name="turnip_github_http">GitHub svarede HTTP %1$d</string>
|
||||
<string name="turnip_download_http">downloadet svarede HTTP %1$d</string>
|
||||
<string name="turnip_list_predates_checksums">Denne driverliste er ældre end tjeksummer - opdater den, og forsøg igen</string>
|
||||
<string name="turnip_checksum_mismatch">Tjeksum stemmer ikke - downloadet blev kasseret</string>
|
||||
<string name="turnip_not_adrenotools">Ikke en AdrenoTools-driver: %1$s</string>
|
||||
|
||||
@@ -1664,7 +1664,6 @@
|
||||
<string name="adbpair_done_text">Tippe, um zu DroidDeck zurückzukehren. Du kannst Debugging über WLAN jetzt deaktivieren.</string>
|
||||
<string name="adbpair_title_failed">Einrichtung von Debugging über WLAN abgebrochen</string>
|
||||
|
||||
<string name="selfinst_http">Der Download antwortete mit HTTP %1$d</string>
|
||||
<string name="selfinst_size_mismatch">Der Download hatte nicht die Größe der veröffentlichten APK und wurde verworfen - versuche es erneut</string>
|
||||
<string name="selfinst_checksum_mismatch">Der Download stimmte nicht mit seiner Prüfsumme überein und wurde verworfen - versuche es erneut</string>
|
||||
<string name="selfinst_wrong_package">Das Update ist für das Android-Paket %1$s, nicht für %2$s</string>
|
||||
@@ -1762,7 +1761,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">Das Rate-Limit von GitHub wurde erreicht - versuche es später erneut</string>
|
||||
<string name="turnip_github_http">GitHub antwortete mit HTTP %1$d</string>
|
||||
<string name="turnip_download_http">Download antwortete mit HTTP %1$d</string>
|
||||
<string name="turnip_list_predates_checksums">Diese Treiberliste stammt aus der Zeit vor Prüfsummen - aktualisiere sie und versuche es erneut</string>
|
||||
<string name="turnip_checksum_mismatch">Prüfsumme stimmt nicht überein - der Download wurde verworfen</string>
|
||||
<string name="turnip_not_adrenotools">Kein AdrenoTools-Treiber: %1$s</string>
|
||||
|
||||
@@ -1664,7 +1664,6 @@
|
||||
<string name="adbpair_done_text">Πατήστε για να επιστρέψετε στο DroidDeck. Μπορείτε να απενεργοποιήσετε τον ασύρματο εντοπισμό σφαλμάτων τώρα.</string>
|
||||
<string name="adbpair_title_failed">Η ρύθμιση ασύρματου εντοπισμού σφαλμάτων διακόπηκε</string>
|
||||
|
||||
<string name="selfinst_http">Η λήψη απάντησε με HTTP %1$d</string>
|
||||
<string name="selfinst_size_mismatch">Το μέγεθος της λήψης δεν ταίριαζε με το δημοσιευμένο APK και απορρίφθηκε - δοκιμάστε ξανά</string>
|
||||
<string name="selfinst_checksum_mismatch">Η λήψη δεν ταίριαζε με το άθροισμα ελέγχου της και απορρίφθηκε - δοκιμάστε ξανά</string>
|
||||
<string name="selfinst_wrong_package">Η ενημέρωση είναι για το πακέτο Android %1$s, όχι για το %2$s</string>
|
||||
@@ -1762,7 +1761,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">Το όριο ρυθμού του GitHub ξεπεράστηκε - δοκιμάστε ξανά αργότερα</string>
|
||||
<string name="turnip_github_http">Το GitHub απάντησε με HTTP %1$d</string>
|
||||
<string name="turnip_download_http">η λήψη απάντησε με HTTP %1$d</string>
|
||||
<string name="turnip_list_predates_checksums">Αυτή η λίστα προγραμμάτων οδήγησης προηγείται των αθροισμάτων ελέγχου - ανανεώστε την και δοκιμάστε ξανά</string>
|
||||
<string name="turnip_checksum_mismatch">Αναντιστοιχία αθροίσματος ελέγχου - η λήψη απορρίφθηκε</string>
|
||||
<string name="turnip_not_adrenotools">Δεν είναι πρόγραμμα οδήγησης AdrenoTools: %1$s</string>
|
||||
|
||||
@@ -1693,7 +1693,6 @@
|
||||
<string name="adbpair_done_text">Toca para volver a DroidDeck. Ya puedes desactivar la Depuración inalámbrica.</string>
|
||||
<string name="adbpair_title_failed">Se detuvo la configuración de la Depuración inalámbrica</string>
|
||||
|
||||
<string name="selfinst_http">La descarga respondió HTTP %1$d</string>
|
||||
<string name="selfinst_size_mismatch">El tamaño de la descarga no coincidía con el APK publicado y se descartó - inténtalo de nuevo</string>
|
||||
<string name="selfinst_checksum_mismatch">La descarga no coincidía con su suma de verificación y se descartó - inténtalo de nuevo</string>
|
||||
<string name="selfinst_wrong_package">La actualización es para el paquete de Android %1$s, no %2$s</string>
|
||||
@@ -1791,7 +1790,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">Se alcanzó el límite de solicitudes de GitHub - inténtalo más tarde</string>
|
||||
<string name="turnip_github_http">GitHub respondió HTTP %1$d</string>
|
||||
<string name="turnip_download_http">la descarga respondió HTTP %1$d</string>
|
||||
<string name="turnip_list_predates_checksums">Esta lista de controladores es anterior a las sumas de verificación - actualízala e inténtalo de nuevo</string>
|
||||
<string name="turnip_checksum_mismatch">La suma de verificación no coincide - se descartó la descarga</string>
|
||||
<string name="turnip_not_adrenotools">No es un controlador de AdrenoTools: %1$s</string>
|
||||
|
||||
@@ -1664,7 +1664,6 @@
|
||||
<string name="adbpair_done_text">Napauta palataksesi DroidDeckiin. Voit sammuttaa langattoman virheenkorjauksen nyt.</string>
|
||||
<string name="adbpair_title_failed">Langattoman virheenkorjauksen käyttöönotto pysähtyi</string>
|
||||
|
||||
<string name="selfinst_http">Lataus vastasi HTTP %1$d</string>
|
||||
<string name="selfinst_size_mismatch">Latauksen koko ei vastannut julkaistua APK-tiedostoa, ja se hylättiin - yritä uudelleen</string>
|
||||
<string name="selfinst_checksum_mismatch">Lataus ei vastannut tarkistussummaansa, ja se hylättiin - yritä uudelleen</string>
|
||||
<string name="selfinst_wrong_package">Päivitys on Android-paketille %1$s, ei %2$s</string>
|
||||
@@ -1762,7 +1761,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">GitHubin käyttörajoitus tuli vastaan - yritä myöhemmin uudelleen</string>
|
||||
<string name="turnip_github_http">GitHub vastasi HTTP %1$d</string>
|
||||
<string name="turnip_download_http">lataus vastasi HTTP %1$d</string>
|
||||
<string name="turnip_list_predates_checksums">Tämä ajuriluettelo on tarkistussummia vanhempi - päivitä se ja yritä uudelleen</string>
|
||||
<string name="turnip_checksum_mismatch">Tarkistussumma ei täsmää - lataus hylättiin</string>
|
||||
<string name="turnip_not_adrenotools">Ei AdrenoTools-ajuri: %1$s</string>
|
||||
|
||||
@@ -1693,7 +1693,6 @@
|
||||
<string name="adbpair_done_text">Appuyez pour revenir à DroidDeck. Vous pouvez maintenant désactiver le débogage sans fil.</string>
|
||||
<string name="adbpair_title_failed">Configuration du débogage sans fil interrompue</string>
|
||||
|
||||
<string name="selfinst_http">Le téléchargement a renvoyé HTTP %1$d</string>
|
||||
<string name="selfinst_size_mismatch">La taille du téléchargement ne correspond pas à l\'APK publié ; il a été supprimé - réessayez</string>
|
||||
<string name="selfinst_checksum_mismatch">Le téléchargement ne correspond pas à sa somme de contrôle et a été supprimé - réessayez</string>
|
||||
<string name="selfinst_wrong_package">La mise à jour concerne le paquet Android %1$s, et non %2$s</string>
|
||||
@@ -1791,7 +1790,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">Limite de requêtes GitHub atteinte - réessayez plus tard</string>
|
||||
<string name="turnip_github_http">GitHub a répondu HTTP %1$d</string>
|
||||
<string name="turnip_download_http">le téléchargement a répondu HTTP %1$d</string>
|
||||
<string name="turnip_list_predates_checksums">Cette liste de pilotes est antérieure aux sommes de contrôle - actualisez-la et réessayez</string>
|
||||
<string name="turnip_checksum_mismatch">Somme de contrôle incorrecte - le téléchargement a été supprimé</string>
|
||||
<string name="turnip_not_adrenotools">Ce n\'est pas un pilote AdrenoTools : %1$s</string>
|
||||
|
||||
@@ -1664,7 +1664,6 @@
|
||||
<string name="adbpair_done_text">DroidDeck पर वापस जाने के लिए टैप करें। अब आप वायरलेस डीबगिंग बंद कर सकते हैं।</string>
|
||||
<string name="adbpair_title_failed">वायरलेस डीबगिंग सेटअप रुक गया</string>
|
||||
|
||||
<string name="selfinst_http">डाउनलोड ने HTTP %1$d जवाब दिया</string>
|
||||
<string name="selfinst_size_mismatch">डाउनलोड का आकार पब्लिश किए APK से मेल नहीं खाया और इसे हटा दिया गया - फिर कोशिश करें</string>
|
||||
<string name="selfinst_checksum_mismatch">डाउनलोड अपने चेकसम से मेल नहीं खाया और इसे हटा दिया गया - फिर कोशिश करें</string>
|
||||
<string name="selfinst_wrong_package">यह अपडेट Android पैकेज %1$s के लिए है, %2$s के लिए नहीं</string>
|
||||
@@ -1762,7 +1761,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">GitHub की रेट लिमिट पार हो गई - बाद में फिर कोशिश करें</string>
|
||||
<string name="turnip_github_http">GitHub ने HTTP %1$d जवाब दिया</string>
|
||||
<string name="turnip_download_http">डाउनलोड ने HTTP %1$d जवाब दिया</string>
|
||||
<string name="turnip_list_predates_checksums">यह ड्राइवर लिस्ट चेकसम से पुरानी है - इसे रीफ़्रेश करें और फिर कोशिश करें</string>
|
||||
<string name="turnip_checksum_mismatch">चेकसम मेल नहीं खाया - डाउनलोड हटा दिया गया</string>
|
||||
<string name="turnip_not_adrenotools">यह AdrenoTools ड्राइवर नहीं है: %1$s</string>
|
||||
|
||||
@@ -1664,7 +1664,6 @@
|
||||
<string name="adbpair_done_text">Koppintson a DroidDeckhez való visszatéréshez. A vezeték nélküli hibakeresést most kikapcsolhatja.</string>
|
||||
<string name="adbpair_title_failed">A vezeték nélküli hibakeresés beállítása megállt</string>
|
||||
|
||||
<string name="selfinst_http">A letöltés HTTP %1$d választ adott</string>
|
||||
<string name="selfinst_size_mismatch">A letöltés mérete nem egyezett a közzétett APK-val, és elvetésre került – próbálja újra</string>
|
||||
<string name="selfinst_checksum_mismatch">A letöltés nem egyezett az ellenőrzőösszegével, és elvetésre került – próbálja újra</string>
|
||||
<string name="selfinst_wrong_package">A frissítés a %1$s Android-csomaghoz tartozik, nem a %2$s-hez</string>
|
||||
@@ -1762,7 +1761,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">A GitHub korlátja elérve – próbálja újra később</string>
|
||||
<string name="turnip_github_http">A GitHub HTTP %1$d választ adott</string>
|
||||
<string name="turnip_download_http">a letöltés HTTP %1$d választ adott</string>
|
||||
<string name="turnip_list_predates_checksums">Ez az illesztőprogram-lista régebbi, mint az ellenőrzőösszegek – frissítse, és próbálja újra</string>
|
||||
<string name="turnip_checksum_mismatch">Az ellenőrzőösszeg nem egyezik – a letöltés elvetve</string>
|
||||
<string name="turnip_not_adrenotools">Nem egy AdrenoTools illesztőprogram: %1$s</string>
|
||||
|
||||
@@ -1643,7 +1643,6 @@
|
||||
<string name="adbpair_done_text">Ketuk untuk kembali ke DroidDeck. Anda bisa menonaktifkan Debugging nirkabel sekarang.</string>
|
||||
<string name="adbpair_title_failed">Penyiapan Debugging nirkabel dihentikan</string>
|
||||
|
||||
<string name="selfinst_http">Unduhan merespons HTTP %1$d</string>
|
||||
<string name="selfinst_size_mismatch">Ukuran unduhan tidak sesuai dengan APK yang dipublikasikan dan dibuang - coba lagi</string>
|
||||
<string name="selfinst_checksum_mismatch">Unduhan tidak sesuai dengan checksum-nya dan dibuang - coba lagi</string>
|
||||
<string name="selfinst_wrong_package">Pembaruan ini untuk paket Android %1$s, bukan %2$s</string>
|
||||
@@ -1741,7 +1740,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">Batas kecepatan GitHub tercapai - coba lagi nanti</string>
|
||||
<string name="turnip_github_http">GitHub merespons HTTP %1$d</string>
|
||||
<string name="turnip_download_http">unduhan merespons HTTP %1$d</string>
|
||||
<string name="turnip_list_predates_checksums">Daftar driver ini dibuat sebelum adanya checksum - segarkan dan coba lagi</string>
|
||||
<string name="turnip_checksum_mismatch">Checksum tidak cocok - unduhan dibuang</string>
|
||||
<string name="turnip_not_adrenotools">Bukan driver AdrenoTools: %1$s</string>
|
||||
|
||||
@@ -1685,7 +1685,6 @@
|
||||
<string name="adbpair_done_text">Tocca per tornare a DroidDeck. Ora puoi disattivare il debug wireless.</string>
|
||||
<string name="adbpair_title_failed">Configurazione del debug wireless interrotta</string>
|
||||
|
||||
<string name="selfinst_http">Il download ha risposto HTTP %1$d</string>
|
||||
<string name="selfinst_size_mismatch">La dimensione del download non corrispondeva all\'APK pubblicato ed è stato scartato - riprova</string>
|
||||
<string name="selfinst_checksum_mismatch">Il download non corrispondeva al suo checksum ed è stato scartato - riprova</string>
|
||||
<string name="selfinst_wrong_package">L\'aggiornamento è per il pacchetto Android %1$s, non %2$s</string>
|
||||
@@ -1783,7 +1782,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">Raggiunto il limite di richieste di GitHub - riprova più tardi</string>
|
||||
<string name="turnip_github_http">GitHub ha risposto HTTP %1$d</string>
|
||||
<string name="turnip_download_http">il download ha risposto HTTP %1$d</string>
|
||||
<string name="turnip_list_predates_checksums">Questo elenco di driver è anteriore ai checksum - aggiornalo e riprova</string>
|
||||
<string name="turnip_checksum_mismatch">Checksum non corrispondente - il download è stato scartato</string>
|
||||
<string name="turnip_not_adrenotools">Non è un driver AdrenoTools: %1$s</string>
|
||||
|
||||
@@ -1651,7 +1651,6 @@
|
||||
<string name="adbpair_done_text">タップしてDroidDeckに戻ります。ワイヤレスデバッグはオフにしてかまいません。</string>
|
||||
<string name="adbpair_title_failed">ワイヤレスデバッグのセットアップが中断しました</string>
|
||||
|
||||
<string name="selfinst_http">ダウンロード先がHTTP %1$dを返しました</string>
|
||||
<string name="selfinst_size_mismatch">ダウンロードしたファイルのサイズが公開されているAPKと一致しないため、破棄しました。もう一度お試しください</string>
|
||||
<string name="selfinst_checksum_mismatch">ダウンロードしたファイルがチェックサムと一致しないため、破棄しました。もう一度お試しください</string>
|
||||
<string name="selfinst_wrong_package">このアップデートはAndroidパッケージ%1$s用で、%2$s用ではありません</string>
|
||||
@@ -1749,7 +1748,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">GitHubのレート制限に達しました。後でもう一度お試しください</string>
|
||||
<string name="turnip_github_http">GitHubがHTTP %1$dを返しました</string>
|
||||
<string name="turnip_download_http">ダウンロード先がHTTP %1$dを返しました</string>
|
||||
<string name="turnip_list_predates_checksums">このドライバー一覧はチェックサム導入前のものです。更新してからもう一度お試しください</string>
|
||||
<string name="turnip_checksum_mismatch">チェックサムが一致しないため、ダウンロードを破棄しました</string>
|
||||
<string name="turnip_not_adrenotools">AdrenoToolsドライバーではありません:%1$s</string>
|
||||
|
||||
@@ -1651,7 +1651,6 @@
|
||||
<string name="adbpair_done_text">탭하여 DroidDeck으로 돌아가세요. 이제 무선 디버깅을 꺼도 됩니다.</string>
|
||||
<string name="adbpair_title_failed">무선 디버깅 설정이 중단되었습니다</string>
|
||||
|
||||
<string name="selfinst_http">다운로드 응답: HTTP %1$d</string>
|
||||
<string name="selfinst_size_mismatch">다운로드 크기가 배포된 APK와 일치하지 않아 삭제했습니다. 다시 시도하세요</string>
|
||||
<string name="selfinst_checksum_mismatch">다운로드한 파일이 체크섬과 일치하지 않아 삭제했습니다. 다시 시도하세요</string>
|
||||
<string name="selfinst_wrong_package">이 업데이트는 %2$s이(가) 아닌 Android 패키지 %1$s용입니다</string>
|
||||
@@ -1749,7 +1748,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">GitHub 요청 한도에 도달했습니다. 나중에 다시 시도하세요</string>
|
||||
<string name="turnip_github_http">GitHub 응답: HTTP %1$d</string>
|
||||
<string name="turnip_download_http">다운로드 응답: HTTP %1$d</string>
|
||||
<string name="turnip_list_predates_checksums">이 드라이버 목록은 체크섬 도입 이전의 것입니다. 새로 고친 후 다시 시도하세요</string>
|
||||
<string name="turnip_checksum_mismatch">체크섬이 일치하지 않아 다운로드를 삭제했습니다</string>
|
||||
<string name="turnip_not_adrenotools">AdrenoTools 드라이버가 아닙니다: %1$s</string>
|
||||
|
||||
@@ -1643,7 +1643,6 @@
|
||||
<string name="adbpair_done_text">Ketik untuk kembali ke DroidDeck. Anda boleh matikan Debugging Wayarles sekarang.</string>
|
||||
<string name="adbpair_title_failed">Persediaan Debugging Wayarles terhenti</string>
|
||||
|
||||
<string name="selfinst_http">Muat turun menjawab HTTP %1$d</string>
|
||||
<string name="selfinst_size_mismatch">Saiz muat turun tidak sepadan dengan APK yang diterbitkan dan telah dibuang - cuba lagi</string>
|
||||
<string name="selfinst_checksum_mismatch">Muat turun tidak sepadan dengan checksumnya dan telah dibuang - cuba lagi</string>
|
||||
<string name="selfinst_wrong_package">Kemas kini ini untuk pakej Android %1$s, bukan %2$s</string>
|
||||
@@ -1741,7 +1740,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">Had kadar GitHub dicapai - cuba lagi kemudian</string>
|
||||
<string name="turnip_github_http">GitHub menjawab HTTP %1$d</string>
|
||||
<string name="turnip_download_http">muat turun menjawab HTTP %1$d</string>
|
||||
<string name="turnip_list_predates_checksums">Senarai pemacu ini mendahului checksum - segarkan dan cuba lagi</string>
|
||||
<string name="turnip_checksum_mismatch">Checksum tidak sepadan - muat turun telah dibuang</string>
|
||||
<string name="turnip_not_adrenotools">Bukan pemacu AdrenoTools: %1$s</string>
|
||||
|
||||
@@ -1664,7 +1664,6 @@
|
||||
<string name="adbpair_done_text">Trykk for å gå tilbake til DroidDeck. Du kan slå av trådløs feilsøking nå.</string>
|
||||
<string name="adbpair_title_failed">Oppsettet for trådløs feilsøking stoppet</string>
|
||||
|
||||
<string name="selfinst_http">Nedlastingen svarte HTTP %1$d</string>
|
||||
<string name="selfinst_size_mismatch">Nedlastingens størrelse stemte ikke med den publiserte APK-en og ble forkastet – prøv igjen</string>
|
||||
<string name="selfinst_checksum_mismatch">Nedlastingen stemte ikke med sjekksummen og ble forkastet – prøv igjen</string>
|
||||
<string name="selfinst_wrong_package">Oppdateringen er for Android-pakken %1$s, ikke %2$s</string>
|
||||
@@ -1762,7 +1761,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">GitHubs hastighetsgrense ble nådd – prøv igjen senere</string>
|
||||
<string name="turnip_github_http">GitHub svarte HTTP %1$d</string>
|
||||
<string name="turnip_download_http">nedlastingen svarte HTTP %1$d</string>
|
||||
<string name="turnip_list_predates_checksums">Denne driverlisten er eldre enn sjekksummene – oppdater den og prøv igjen</string>
|
||||
<string name="turnip_checksum_mismatch">Sjekksummen stemmer ikke – nedlastingen ble forkastet</string>
|
||||
<string name="turnip_not_adrenotools">Ikke en AdrenoTools-driver: %1$s</string>
|
||||
|
||||
@@ -1664,7 +1664,6 @@
|
||||
<string name="adbpair_done_text">Tik om terug te gaan naar DroidDeck. Je kunt draadloze foutopsporing nu uitschakelen.</string>
|
||||
<string name="adbpair_title_failed">Instellen van draadloze foutopsporing gestopt</string>
|
||||
|
||||
<string name="selfinst_http">De download antwoordde met HTTP %1$d</string>
|
||||
<string name="selfinst_size_mismatch">De downloadgrootte kwam niet overeen met de gepubliceerde APK en is verwijderd - probeer het opnieuw</string>
|
||||
<string name="selfinst_checksum_mismatch">De download kwam niet overeen met de checksum en is verwijderd - probeer het opnieuw</string>
|
||||
<string name="selfinst_wrong_package">De update is voor Android-package %1$s, niet voor %2$s</string>
|
||||
@@ -1762,7 +1761,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">De ratelimiet van GitHub is bereikt - probeer het later opnieuw</string>
|
||||
<string name="turnip_github_http">GitHub antwoordde met HTTP %1$d</string>
|
||||
<string name="turnip_download_http">download antwoordde met HTTP %1$d</string>
|
||||
<string name="turnip_list_predates_checksums">Deze driverlijst is ouder dan de checksums - vernieuw de lijst en probeer het opnieuw</string>
|
||||
<string name="turnip_checksum_mismatch">Checksum komt niet overeen - de download is verwijderd</string>
|
||||
<string name="turnip_not_adrenotools">Geen AdrenoTools-driver: %1$s</string>
|
||||
|
||||
@@ -1706,7 +1706,6 @@
|
||||
<string name="adbpair_done_text">Dotknij, aby wrócić do DroidDeck. Możesz już wyłączyć debugowanie bezprzewodowe.</string>
|
||||
<string name="adbpair_title_failed">Konfiguracja debugowania bezprzewodowego została przerwana</string>
|
||||
|
||||
<string name="selfinst_http">Serwer pobierania odpowiedział HTTP %1$d</string>
|
||||
<string name="selfinst_size_mismatch">Rozmiar pobranego pliku nie zgadzał się z opublikowanym APK, więc go odrzucono – spróbuj ponownie</string>
|
||||
<string name="selfinst_checksum_mismatch">Pobrany plik nie zgadzał się z sumą kontrolną, więc go odrzucono – spróbuj ponownie</string>
|
||||
<string name="selfinst_wrong_package">Aktualizacja jest dla pakietu Android %1$s, a nie %2$s</string>
|
||||
@@ -1804,7 +1803,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">Osiągnięto limit zapytań GitHub – spróbuj ponownie później</string>
|
||||
<string name="turnip_github_http">GitHub odpowiedział HTTP %1$d</string>
|
||||
<string name="turnip_download_http">serwer pobierania odpowiedział HTTP %1$d</string>
|
||||
<string name="turnip_list_predates_checksums">Ta lista sterowników jest starsza niż sumy kontrolne – odśwież ją i spróbuj ponownie</string>
|
||||
<string name="turnip_checksum_mismatch">Niezgodna suma kontrolna – pobrany plik odrzucono</string>
|
||||
<string name="turnip_not_adrenotools">To nie jest sterownik AdrenoTools: %1$s</string>
|
||||
|
||||
@@ -1685,7 +1685,6 @@
|
||||
<string name="adbpair_done_text">Toque para voltar ao DroidDeck. Já pode desativar a depuração sem fios.</string>
|
||||
<string name="adbpair_title_failed">A configuração da depuração sem fios parou</string>
|
||||
|
||||
<string name="selfinst_http">A transferência respondeu HTTP %1$d</string>
|
||||
<string name="selfinst_size_mismatch">O tamanho da transferência não correspondia ao APK publicado e foi descartada - tente novamente</string>
|
||||
<string name="selfinst_checksum_mismatch">A transferência não correspondia à soma de verificação e foi descartada - tente novamente</string>
|
||||
<string name="selfinst_wrong_package">A atualização é para o pacote Android %1$s, não para %2$s</string>
|
||||
@@ -1783,7 +1782,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">Foi atingido o limite de pedidos do GitHub - tente novamente mais tarde</string>
|
||||
<string name="turnip_github_http">O GitHub respondeu HTTP %1$d</string>
|
||||
<string name="turnip_download_http">a transferência respondeu HTTP %1$d</string>
|
||||
<string name="turnip_list_predates_checksums">Esta lista de controladores é anterior às somas de verificação - atualize-a e tente novamente</string>
|
||||
<string name="turnip_checksum_mismatch">A soma de verificação não corresponde - a transferência foi descartada</string>
|
||||
<string name="turnip_not_adrenotools">Não é um controlador AdrenoTools: %1$s</string>
|
||||
|
||||
@@ -1685,7 +1685,6 @@
|
||||
<string name="adbpair_done_text">Toque para voltar ao DroidDeck. Você já pode desativar a depuração por Wi-Fi.</string>
|
||||
<string name="adbpair_title_failed">A configuração da depuração por Wi-Fi parou</string>
|
||||
|
||||
<string name="selfinst_http">O download respondeu HTTP %1$d</string>
|
||||
<string name="selfinst_size_mismatch">O tamanho do download não corresponde ao APK publicado, e ele foi descartado - tente de novo</string>
|
||||
<string name="selfinst_checksum_mismatch">O download não corresponde à soma de verificação e foi descartado - tente de novo</string>
|
||||
<string name="selfinst_wrong_package">A atualização é para o pacote Android %1$s, não %2$s</string>
|
||||
@@ -1783,7 +1782,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">O limite de requisições do GitHub foi atingido - tente mais tarde</string>
|
||||
<string name="turnip_github_http">O GitHub respondeu HTTP %1$d</string>
|
||||
<string name="turnip_download_http">o download respondeu HTTP %1$d</string>
|
||||
<string name="turnip_list_predates_checksums">Esta lista de drivers é anterior às somas de verificação - atualize-a e tente de novo</string>
|
||||
<string name="turnip_checksum_mismatch">A soma de verificação não confere - o download foi descartado</string>
|
||||
<string name="turnip_not_adrenotools">Não é um driver AdrenoTools: %1$s</string>
|
||||
|
||||
@@ -1685,7 +1685,6 @@
|
||||
<string name="adbpair_done_text">Apasă pentru a reveni la DroidDeck. Poți dezactiva acum Depanarea wireless.</string>
|
||||
<string name="adbpair_title_failed">Configurarea Depanării wireless s-a oprit</string>
|
||||
|
||||
<string name="selfinst_http">Descărcarea a răspuns cu HTTP %1$d</string>
|
||||
<string name="selfinst_size_mismatch">Dimensiunea descărcării nu s-a potrivit cu APK-ul publicat și a fost abandonată - încearcă din nou</string>
|
||||
<string name="selfinst_checksum_mismatch">Descărcarea nu s-a potrivit cu suma sa de control și a fost abandonată - încearcă din nou</string>
|
||||
<string name="selfinst_wrong_package">Actualizarea este pentru pachetul Android %1$s, nu %2$s</string>
|
||||
@@ -1783,7 +1782,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">S-a atins limita de solicitări a GitHub - încearcă din nou mai târziu</string>
|
||||
<string name="turnip_github_http">GitHub a răspuns cu HTTP %1$d</string>
|
||||
<string name="turnip_download_http">descărcarea a răspuns cu HTTP %1$d</string>
|
||||
<string name="turnip_list_predates_checksums">Această listă de drivere e anterioară sumelor de control - reîmprospătează-o și încearcă din nou</string>
|
||||
<string name="turnip_checksum_mismatch">Sumă de control incorectă - descărcarea a fost abandonată</string>
|
||||
<string name="turnip_not_adrenotools">Nu este un driver AdrenoTools: %1$s</string>
|
||||
|
||||
@@ -1714,7 +1714,6 @@
|
||||
<string name="adbpair_done_text">Нажмите, чтобы вернуться в DroidDeck. Теперь отладку по Wi-Fi можно отключить.</string>
|
||||
<string name="adbpair_title_failed">Настройка отладки по Wi-Fi остановлена</string>
|
||||
|
||||
<string name="selfinst_http">Сервер загрузки ответил HTTP %1$d</string>
|
||||
<string name="selfinst_size_mismatch">Размер загруженного файла не совпал с опубликованным APK, файл удален — повторите попытку</string>
|
||||
<string name="selfinst_checksum_mismatch">Загруженный файл не совпал с контрольной суммой и был удален — повторите попытку</string>
|
||||
<string name="selfinst_wrong_package">Обновление предназначено для пакета Android %1$s, а не %2$s</string>
|
||||
@@ -1812,7 +1811,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">Превышен лимит запросов GitHub — повторите попытку позже</string>
|
||||
<string name="turnip_github_http">GitHub ответил HTTP %1$d</string>
|
||||
<string name="turnip_download_http">сервер загрузки ответил HTTP %1$d</string>
|
||||
<string name="turnip_list_predates_checksums">Этот список драйверов создан до появления контрольных сумм — обновите его и повторите попытку</string>
|
||||
<string name="turnip_checksum_mismatch">Контрольная сумма не совпадает — загруженный файл удален</string>
|
||||
<string name="turnip_not_adrenotools">Не драйвер AdrenoTools: %1$s</string>
|
||||
|
||||
@@ -1664,7 +1664,6 @@
|
||||
<string name="adbpair_done_text">Tryck för att gå tillbaka till DroidDeck. Du kan stänga av trådlös felsökning nu.</string>
|
||||
<string name="adbpair_title_failed">Konfigurationen av trådlös felsökning avbröts</string>
|
||||
|
||||
<string name="selfinst_http">Nedladdningen svarade HTTP %1$d</string>
|
||||
<string name="selfinst_size_mismatch">Nedladdningens storlek matchade inte den publicerade APK-filen och förkastades - försök igen</string>
|
||||
<string name="selfinst_checksum_mismatch">Nedladdningen matchade inte sin kontrollsumma och förkastades - försök igen</string>
|
||||
<string name="selfinst_wrong_package">Uppdateringen är för Android-paketet %1$s, inte %2$s</string>
|
||||
@@ -1762,7 +1761,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">GitHubs hastighetsgräns nåddes - försök igen senare</string>
|
||||
<string name="turnip_github_http">GitHub svarade HTTP %1$d</string>
|
||||
<string name="turnip_download_http">nedladdningen svarade HTTP %1$d</string>
|
||||
<string name="turnip_list_predates_checksums">Den här drivrutinslistan är från innan kontrollsummor fanns - uppdatera den och försök igen</string>
|
||||
<string name="turnip_checksum_mismatch">Kontrollsumman stämmer inte - nedladdningen förkastades</string>
|
||||
<string name="turnip_not_adrenotools">Inte en AdrenoTools-drivrutin: %1$s</string>
|
||||
|
||||
@@ -1643,7 +1643,6 @@
|
||||
<string name="adbpair_done_text">แตะเพื่อกลับไปที่ DroidDeck คุณสามารถปิด Wireless debugging ได้แล้วตอนนี้</string>
|
||||
<string name="adbpair_title_failed">การตั้งค่า Wireless debugging หยุดแล้ว</string>
|
||||
|
||||
<string name="selfinst_http">การดาวน์โหลดตอบกลับด้วย HTTP %1$d</string>
|
||||
<string name="selfinst_size_mismatch">ขนาดการดาวน์โหลดไม่ตรงกับ APK ที่เผยแพร่และถูกยกเลิก - ลองใหม่</string>
|
||||
<string name="selfinst_checksum_mismatch">การดาวน์โหลดไม่ตรงกับค่าตรวจสอบและถูกยกเลิก - ลองใหม่</string>
|
||||
<string name="selfinst_wrong_package">อัปเดตนี้สำหรับแพ็กเกจ Android %1$s ไม่ใช่ %2$s</string>
|
||||
@@ -1741,7 +1740,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">ติดขีดจำกัดอัตราของ GitHub - ลองใหม่ในหลัง</string>
|
||||
<string name="turnip_github_http">GitHub ตอบกลับด้วย HTTP %1$d</string>
|
||||
<string name="turnip_download_http">การดาวน์โหลดตอบกลับด้วย HTTP %1$d</string>
|
||||
<string name="turnip_list_predates_checksums">รายการไดรเวอร์นี้เก่ากว่าระบบค่าตรวจสอบ - รีเฟรชแล้วลองใหม่</string>
|
||||
<string name="turnip_checksum_mismatch">ค่าตรวจสอบไม่ตรงกัน - การดาวน์โหลดถูกยกเลิก</string>
|
||||
<string name="turnip_not_adrenotools">ไม่ใช่ไดรเวอร์ AdrenoTools: %1$s</string>
|
||||
|
||||
@@ -1664,7 +1664,6 @@
|
||||
<string name="adbpair_done_text">DroidDeck\'e geri dönmek için dokunun. Kablosuz hata ayıklamayı şimdi kapatabilirsiniz.</string>
|
||||
<string name="adbpair_title_failed">Kablosuz hata ayıklama kurulumu durdu</string>
|
||||
|
||||
<string name="selfinst_http">İndirme HTTP %1$d yanıtı verdi</string>
|
||||
<string name="selfinst_size_mismatch">İndirme boyutu yayınlanan APK ile eşleşmedi ve atıldı - yeniden deneyin</string>
|
||||
<string name="selfinst_checksum_mismatch">İndirme, sağlama toplamıyla eşleşmedi ve atıldı - yeniden deneyin</string>
|
||||
<string name="selfinst_wrong_package">Güncelleme, %2$s değil %1$s Android paketi içindir</string>
|
||||
@@ -1762,7 +1761,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">GitHub\'ın hız sınırına ulaşıldı - daha sonra yeniden deneyin</string>
|
||||
<string name="turnip_github_http">GitHub HTTP %1$d yanıtı verdi</string>
|
||||
<string name="turnip_download_http">indirme HTTP %1$d yanıtı verdi</string>
|
||||
<string name="turnip_list_predates_checksums">Bu sürücü listesi sağlama toplamlarından önceki bir tarihe ait - yenileyip yeniden deneyin</string>
|
||||
<string name="turnip_checksum_mismatch">Sağlama toplamı uyuşmuyor - indirme atıldı</string>
|
||||
<string name="turnip_not_adrenotools">Bir AdrenoTools sürücüsü değil: %1$s</string>
|
||||
|
||||
@@ -1706,7 +1706,6 @@
|
||||
<string name="adbpair_done_text">Торкніться, щоб повернутися до DroidDeck. Тепер можна вимкнути бездротове налагодження.</string>
|
||||
<string name="adbpair_title_failed">Налаштування бездротового налагодження зупинено</string>
|
||||
|
||||
<string name="selfinst_http">Завантаження відповіло HTTP %1$d</string>
|
||||
<string name="selfinst_size_mismatch">Розмір завантаження не збігся з опублікованим APK, тож його відхилено - спробуйте ще раз</string>
|
||||
<string name="selfinst_checksum_mismatch">Завантаження не збіглося з контрольною сумою, тож його відхилено - спробуйте ще раз</string>
|
||||
<string name="selfinst_wrong_package">Оновлення призначене для пакета Android %1$s, а не %2$s</string>
|
||||
@@ -1804,7 +1803,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">Перевищено ліміт запитів GitHub - спробуйте пізніше</string>
|
||||
<string name="turnip_github_http">GitHub відповів HTTP %1$d</string>
|
||||
<string name="turnip_download_http">завантаження відповіло HTTP %1$d</string>
|
||||
<string name="turnip_list_predates_checksums">Цей список драйверів створено до появи контрольних сум - оновіть його і спробуйте ще раз</string>
|
||||
<string name="turnip_checksum_mismatch">Контрольна сума не збіглася - завантаження відхилено</string>
|
||||
<string name="turnip_not_adrenotools">Не драйвер AdrenoTools: %1$s</string>
|
||||
|
||||
@@ -1643,7 +1643,6 @@
|
||||
<string name="adbpair_done_text">Nhấn để quay lại DroidDeck. Bạn có thể tắt Gỡ lỗi qua mạng không dây ngay bây giờ.</string>
|
||||
<string name="adbpair_title_failed">Thiết lập Gỡ lỗi qua mạng không dây đã dừng</string>
|
||||
|
||||
<string name="selfinst_http">Lượt tải trả về HTTP %1$d</string>
|
||||
<string name="selfinst_size_mismatch">Kích thước tải xuống không khớp với APK đã phát hành và đã bị loại bỏ - hãy thử lại</string>
|
||||
<string name="selfinst_checksum_mismatch">Tệp tải xuống không khớp checksum và đã bị loại bỏ - hãy thử lại</string>
|
||||
<string name="selfinst_wrong_package">Bản cập nhật này dành cho package Android %1$s, không phải %2$s</string>
|
||||
@@ -1741,7 +1740,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">Đã đạt giới hạn tốc độ của GitHub - hãy thử lại sau</string>
|
||||
<string name="turnip_github_http">GitHub trả về HTTP %1$d</string>
|
||||
<string name="turnip_download_http">tải xuống trả về HTTP %1$d</string>
|
||||
<string name="turnip_list_predates_checksums">Danh sách driver này có trước checksum - hãy làm mới và thử lại</string>
|
||||
<string name="turnip_checksum_mismatch">Checksum không khớp - tệp tải xuống đã bị loại bỏ</string>
|
||||
<string name="turnip_not_adrenotools">Không phải driver AdrenoTools: %1$s</string>
|
||||
|
||||
@@ -714,6 +714,14 @@
|
||||
<string name="setup_choose_home">选择主屏幕应用</string>
|
||||
<string name="setup_choose">选择</string>
|
||||
<string name="setup_linux_apps">Linux 应用(测试版)</string>
|
||||
<string name="setup_group_download">下载</string>
|
||||
<string name="setup_download_source">下载源</string>
|
||||
<string name="setup_download_source_auto">自动</string>
|
||||
<string name="setup_download_source_direct">直连</string>
|
||||
<string name="setup_download_source_mirror">镜像</string>
|
||||
<string name="setup_download_source_custom">自定义前缀</string>
|
||||
<string name="setup_download_mirror">镜像站点</string>
|
||||
<string name="setup_download_prefix">前缀</string>
|
||||
<string name="setup_tool_files">文件</string>
|
||||
<string name="setup_tool_files_hint">浏览和管理文件</string>
|
||||
<string name="setup_tool_protons">Proton 版本</string>
|
||||
@@ -1651,7 +1659,7 @@
|
||||
<string name="adbpair_done_text">点按即可返回 DroidDeck。现在可以关闭无线调试了。</string>
|
||||
<string name="adbpair_title_failed">无线调试配置已中止</string>
|
||||
|
||||
<string name="selfinst_http">下载服务器返回 HTTP %1$d</string>
|
||||
<string name="selfinst_download_failed">下载失败</string>
|
||||
<string name="selfinst_size_mismatch">下载的文件大小与发布的 APK 不符,已丢弃 — 请重试</string>
|
||||
<string name="selfinst_checksum_mismatch">下载的文件与校验和不符,已丢弃 — 请重试</string>
|
||||
<string name="selfinst_wrong_package">此更新适用于 Android 软件包 %1$s,而不是 %2$s</string>
|
||||
@@ -1749,7 +1757,7 @@
|
||||
|
||||
<string name="turnip_rate_limited">已达到 GitHub 的请求频率限制 — 请稍后重试</string>
|
||||
<string name="turnip_github_http">GitHub 返回 HTTP %1$d</string>
|
||||
<string name="turnip_download_http">下载返回 HTTP %1$d</string>
|
||||
<string name="turnip_download_failed">下载失败</string>
|
||||
<string name="turnip_list_predates_checksums">此驱动列表早于校验和功能 — 请刷新后重试</string>
|
||||
<string name="turnip_checksum_mismatch">校验和不匹配 — 已丢弃下载的文件</string>
|
||||
<string name="turnip_not_adrenotools">不是 AdrenoTools 驱动:%1$s</string>
|
||||
|
||||
@@ -1651,7 +1651,6 @@
|
||||
<string name="adbpair_done_text">輕按即可返回 DroidDeck。你現在可以關閉無線偵錯。</string>
|
||||
<string name="adbpair_title_failed">無線偵錯設定已停止</string>
|
||||
|
||||
<string name="selfinst_http">下載回應 HTTP %1$d</string>
|
||||
<string name="selfinst_size_mismatch">下載的大小與已發佈的 APK 不符,已被捨棄 - 請再試一次</string>
|
||||
<string name="selfinst_checksum_mismatch">下載的檔案與其校驗和不符,已被捨棄 - 請再試一次</string>
|
||||
<string name="selfinst_wrong_package">此更新屬於 Android 套件 %1$s,而非 %2$s</string>
|
||||
@@ -1749,7 +1748,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">已達 GitHub 的速率限制 - 請稍後再試</string>
|
||||
<string name="turnip_github_http">GitHub 回應 HTTP %1$d</string>
|
||||
<string name="turnip_download_http">下載回應 HTTP %1$d</string>
|
||||
<string name="turnip_list_predates_checksums">此驅動程式清單早於校驗和推出 - 請重新整理後再試一次</string>
|
||||
<string name="turnip_checksum_mismatch">校驗和不符 - 已捨棄下載的檔案</string>
|
||||
<string name="turnip_not_adrenotools">不是 AdrenoTools 驅動程式:%1$s</string>
|
||||
|
||||
@@ -1651,7 +1651,6 @@
|
||||
<string name="adbpair_done_text">點擊即可返回 DroidDeck。現在可以關閉無線偵錯了。</string>
|
||||
<string name="adbpair_title_failed">無線偵錯設定已停止</string>
|
||||
|
||||
<string name="selfinst_http">下載回應 HTTP %1$d</string>
|
||||
<string name="selfinst_size_mismatch">下載的大小與發布的 APK 不符,已捨棄 - 請再試一次</string>
|
||||
<string name="selfinst_checksum_mismatch">下載的檔案與校驗碼不符,已捨棄 - 請再試一次</string>
|
||||
<string name="selfinst_wrong_package">此更新適用於 Android 套件 %1$s,而非 %2$s</string>
|
||||
@@ -1749,7 +1748,6 @@
|
||||
|
||||
<string name="turnip_rate_limited">已達 GitHub 速率限制 - 請稍後再試</string>
|
||||
<string name="turnip_github_http">GitHub 回應 HTTP %1$d</string>
|
||||
<string name="turnip_download_http">下載回應 HTTP %1$d</string>
|
||||
<string name="turnip_list_predates_checksums">此驅動程式清單早於校驗碼機制 - 請重新整理後再試一次</string>
|
||||
<string name="turnip_checksum_mismatch">校驗碼不符 - 已捨棄下載內容</string>
|
||||
<string name="turnip_not_adrenotools">不是 AdrenoTools 驅動程式:%1$s</string>
|
||||
|
||||
@@ -1724,7 +1724,7 @@
|
||||
<string name="adbpair_done_text">Tap to go back to DroidDeck. You can turn Wireless debugging off now.</string>
|
||||
<string name="adbpair_title_failed">Wireless debugging setup stopped</string>
|
||||
|
||||
<string name="selfinst_http">The download answered HTTP %1$d</string>
|
||||
<string name="selfinst_download_failed">Download failed</string>
|
||||
<string name="selfinst_size_mismatch">The download size didn\'t match the published APK and was discarded - try again</string>
|
||||
<string name="selfinst_checksum_mismatch">The download didn\'t match its checksum and was discarded - try again</string>
|
||||
<string name="selfinst_wrong_package">The update is for Android package %1$s, not %2$s</string>
|
||||
@@ -1822,7 +1822,7 @@
|
||||
|
||||
<string name="turnip_rate_limited">GitHub\'s rate limit was hit - try again later</string>
|
||||
<string name="turnip_github_http">GitHub answered HTTP %1$d</string>
|
||||
<string name="turnip_download_http">download answered HTTP %1$d</string>
|
||||
<string name="turnip_download_failed">Download failed</string>
|
||||
<string name="turnip_list_predates_checksums">This driver list predates checksums - refresh it and try again</string>
|
||||
<string name="turnip_checksum_mismatch">Checksum mismatch - the download was discarded</string>
|
||||
<string name="turnip_not_adrenotools">Not an AdrenoTools driver: %1$s</string>
|
||||
@@ -2201,6 +2201,14 @@
|
||||
<string name="setup_group_look">Look</string>
|
||||
<string name="setup_group_device">This device</string>
|
||||
<string name="setup_group_art">Library art</string>
|
||||
<string name="setup_group_download">Downloads</string>
|
||||
<string name="setup_download_source">Source</string>
|
||||
<string name="setup_download_source_auto">Automatic</string>
|
||||
<string name="setup_download_source_direct">Direct</string>
|
||||
<string name="setup_download_source_mirror">Mirror</string>
|
||||
<string name="setup_download_source_custom">Custom prefix</string>
|
||||
<string name="setup_download_mirror">Site</string>
|
||||
<string name="setup_download_prefix">Prefix</string>
|
||||
<string name="flathub_eyebrow">LINUX APPS</string>
|
||||
<string name="flathub_name">Flathub</string>
|
||||
<string name="flathub_line">Desktop apps for the Linux desktop, opened from Desktop.</string>
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.io.File
|
||||
import java.net.ServerSocket
|
||||
import java.net.Socket
|
||||
import java.nio.file.Files
|
||||
import java.security.MessageDigest
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
import org.junit.After
|
||||
import org.junit.Assert.assertArrayEquals
|
||||
@@ -26,6 +27,8 @@ class DownloaderResumeTest {
|
||||
private lateinit var dir: File
|
||||
private lateinit var thread: Thread
|
||||
@Volatile private var misbehave = false
|
||||
@Volatile private var etag: String? = "\"v1\""
|
||||
@Volatile private var corrupt = false
|
||||
|
||||
@Before fun setUp() {
|
||||
dir = Files.createTempDirectory("downloader-resume").toFile()
|
||||
@@ -50,6 +53,7 @@ class DownloaderResumeTest {
|
||||
|
||||
private fun handle(socket: Socket) = socket.use {
|
||||
val input = it.getInputStream().bufferedReader(Charsets.ISO_8859_1)
|
||||
val path = input.readLine() ?: return@use
|
||||
var range: String? = null
|
||||
while (true) {
|
||||
val line = input.readLine() ?: break
|
||||
@@ -58,24 +62,26 @@ class DownloaderResumeTest {
|
||||
}
|
||||
requests.add(range)
|
||||
val out = it.getOutputStream()
|
||||
val validator = etag?.let { tag -> "ETag: $tag\r\n" } ?: ""
|
||||
val content = if (corrupt && "/corrupt" in path) ByteArray(data.size) else data
|
||||
val from = range?.removePrefix("bytes=")?.substringBefore('-')?.toIntOrNull()
|
||||
if (misbehave) {
|
||||
// answers a Range request with a 206 that starts at 0, and serves plain requests whole
|
||||
val start = if (from == null) "200 OK" else "206 Partial Content"
|
||||
val extra = if (from == null) "" else "Content-Range: bytes 0-${data.size - 1}/${data.size}\r\n"
|
||||
out.write("HTTP/1.1 $start\r\n${extra}Content-Length: ${data.size}\r\nConnection: close\r\n\r\n".toByteArray())
|
||||
out.write(data)
|
||||
out.write("HTTP/1.1 $start\r\n${extra}${validator}Content-Length: ${data.size}\r\nConnection: close\r\n\r\n".toByteArray())
|
||||
out.write(content)
|
||||
out.flush()
|
||||
} else if (from == null) {
|
||||
out.write("HTTP/1.1 200 OK\r\nContent-Length: ${data.size}\r\nConnection: close\r\n\r\n".toByteArray())
|
||||
out.write(data, 0, cutAt)
|
||||
out.write("HTTP/1.1 200 OK\r\n${validator}Content-Length: ${data.size}\r\nConnection: close\r\n\r\n".toByteArray())
|
||||
out.write(content, 0, cutAt)
|
||||
out.flush()
|
||||
// hang up with most of the promised body still unsent
|
||||
} else {
|
||||
val rest = data.size - from
|
||||
out.write(("HTTP/1.1 206 Partial Content\r\nContent-Range: bytes $from-${data.size - 1}/${data.size}\r\n" +
|
||||
"Content-Length: $rest\r\nConnection: close\r\n\r\n").toByteArray())
|
||||
out.write(data, from, rest)
|
||||
"${validator}Content-Length: $rest\r\nConnection: close\r\n\r\n").toByteArray())
|
||||
out.write(content, from, rest)
|
||||
out.flush()
|
||||
}
|
||||
}
|
||||
@@ -108,4 +114,57 @@ class DownloaderResumeTest {
|
||||
assertArrayEquals("the file must not be the kept bytes plus a misplaced body", data, target.readBytes())
|
||||
assertEquals(listOf<String?>(null, "bytes=$kept-", null), requests.toList())
|
||||
}
|
||||
|
||||
@Test fun legacyPartialWithoutValidatorRestartsAtZero() {
|
||||
val url = "http://127.0.0.1:${server.localPort}/runtime.tar.zst"
|
||||
val target = File(dir, "runtime.tar.zst")
|
||||
target.writeBytes(ByteArray(cutAt) { 9 })
|
||||
misbehave = true
|
||||
assertTrue(Downloader.downloadFile(url, target, true, null))
|
||||
assertArrayEquals(data, target.readBytes())
|
||||
assertEquals(listOf<String?>(null), requests.toList())
|
||||
}
|
||||
|
||||
@Test fun missingStrongETagPreventsUnsafeResume() {
|
||||
val url = "http://127.0.0.1:${server.localPort}/runtime.tar.zst"
|
||||
val target = File(dir, "runtime.tar.zst")
|
||||
etag = null
|
||||
assertFalse(Downloader.downloadFile(url, target, true, null))
|
||||
misbehave = true
|
||||
assertTrue(Downloader.downloadFile(url, target, true, null))
|
||||
assertArrayEquals(data, target.readBytes())
|
||||
assertEquals(listOf<String?>(null, null), requests.toList())
|
||||
}
|
||||
|
||||
@Test fun switchingCandidateDoesNotAppendToDifferentSource() {
|
||||
val first = "http://127.0.0.1:${server.localPort}/first"
|
||||
val second = "http://127.0.0.1:${server.localPort}/second"
|
||||
val target = File(dir, "runtime.tar.zst")
|
||||
val sha256 = MessageDigest.getInstance("SHA-256").digest(data).joinToString("") { "%02x".format(it.toInt() and 0xff) }
|
||||
assertFalse(Downloader.downloadFile(first, target, true, sha256, null))
|
||||
misbehave = true
|
||||
assertTrue(Downloader.downloadFile(second, target, true, sha256, null))
|
||||
assertArrayEquals(data, target.readBytes())
|
||||
assertEquals(listOf<String?>(null, null), requests.toList())
|
||||
}
|
||||
|
||||
@Test fun corruptCandidateFallsBackAfterChecksumMismatch() {
|
||||
val first = "http://127.0.0.1:${server.localPort}/corrupt"
|
||||
val second = "http://127.0.0.1:${server.localPort}/clean"
|
||||
val target = File(dir, "runtime.tar.zst")
|
||||
val sha256 = MessageDigest.getInstance("SHA-256").digest(data).joinToString("") { "%02x".format(it.toInt() and 0xff) }
|
||||
misbehave = true
|
||||
corrupt = true
|
||||
assertTrue(Downloader.downloadCandidates(first, listOf(first, second), target, true, sha256, null))
|
||||
assertArrayEquals(data, target.readBytes())
|
||||
assertEquals(listOf<String?>(null, null), requests.toList())
|
||||
}
|
||||
|
||||
@Test fun executableMetadataIsAlwaysDirect() {
|
||||
val url = "https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases"
|
||||
assertEquals(listOf(url), DownloadSource.candidates(url))
|
||||
val catalog = "https://raw.githubusercontent.com/Droid-Deck/DroidDeck-CI/main/catalog.json"
|
||||
assertEquals(listOf(catalog), DownloadSource.candidates(catalog))
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,8 +25,15 @@ WORK=/var/cache/droiddeck-flatpak
|
||||
CONF=$WORK/pacman.conf
|
||||
mkdir -p "$WORK/pkg" "$WORK/db" || fail "cannot create $WORK"
|
||||
|
||||
{ for m in https://ca.us.mirror.archlinuxarm.org https://fl.us.mirror.archlinuxarm.org \
|
||||
https://de3.mirror.archlinuxarm.org https://nl.mirror.archlinuxarm.org; do
|
||||
OVERSEAS="https://ca.us.mirror.archlinuxarm.org https://fl.us.mirror.archlinuxarm.org https://de3.mirror.archlinuxarm.org https://nl.mirror.archlinuxarm.org"
|
||||
MAINLAND=""
|
||||
for m in https://mirrors.tuna.tsinghua.edu.cn/archlinuxarm https://mirrors.ustc.edu.cn/archlinuxarm \
|
||||
https://mirrors.bfsu.edu.cn/archlinuxarm https://mirrors.sjtug.sjtu.edu.cn/archlinuxarm; do
|
||||
if curl -fsS -r 0-0 --connect-timeout 4 --max-time 8 -o /dev/null "$m/aarch64/core/core.db" 2>/dev/null; then
|
||||
MAINLAND="$MAINLAND $m"
|
||||
fi
|
||||
done
|
||||
{ for m in $MAINLAND $OVERSEAS; do
|
||||
echo "Server = $m/\$arch/\$repo"; done
|
||||
grep '^Server' /etc/pacman.d/mirrorlist 2>/dev/null; } > "$WORK/mirrorlist"
|
||||
sed -e 's/^DownloadUser/#DownloadUser/' \
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
cdn=https://client-update.fastly.steamstatic.com
|
||||
cdn_list="https://client-update.steamstatic.com https://client-update.akamai.steamstatic.com https://client-update.fastly.steamstatic.com"
|
||||
steam_channel=steamdeck_publicbeta
|
||||
manifest=steam_client_${steam_channel}_linuxarm64
|
||||
steam_root=${XDG_DATA_HOME:-$HOME/.local/share}/Steam
|
||||
@@ -37,7 +37,19 @@ fi
|
||||
|
||||
work=$(mktemp -d)
|
||||
trap 'rm -rf "$work"' EXIT
|
||||
curl -fsSL "$cdn/$manifest" -o "$work/manifest"
|
||||
cdn=""
|
||||
for candidate in $cdn_list; do
|
||||
if curl -fsSL --connect-timeout 10 --max-time 30 --retry 2 --retry-connrefused --retry-delay 3 \
|
||||
"$candidate/$manifest" -o "$work/manifest"; then
|
||||
cdn=$candidate
|
||||
break
|
||||
fi
|
||||
done
|
||||
[ -n "$cdn" ] || { echo "droiddeck-steam-install: no Steam client CDN answered for $manifest" >&2; exit 1; }
|
||||
cdn_order=("$cdn")
|
||||
for candidate in $cdn_list; do
|
||||
[ "$candidate" = "$cdn" ] || cdn_order+=("$candidate")
|
||||
done
|
||||
version=$(awk -F'"' '$2 == "version" { print $4; exit }' "$work/manifest")
|
||||
awk -F'"' '
|
||||
/^\t"/ && NF >= 3 && $4 == "" { block = $2 }
|
||||
@@ -52,8 +64,16 @@ mkdir -p "$steam_root/package"
|
||||
while read -r block file sum; do
|
||||
i=$((${i:-0} + 1))
|
||||
echo "== STEP $(date -u +%H:%M:%S) downloading Steam: $block ($i/$total)"
|
||||
curl -fsSL "$cdn/$file" -o "$work/$file"
|
||||
echo "$sum $work/$file" | sha256sum -c --quiet
|
||||
fetched=""
|
||||
for host in "${cdn_order[@]}"; do
|
||||
if curl -fsSL --connect-timeout 10 --speed-limit 1024 --speed-time 60 --max-time 1800 \
|
||||
"$host/$file" -o "$work/$file" && echo "$sum $work/$file" | sha256sum -c --quiet; then
|
||||
fetched=$host
|
||||
break
|
||||
fi
|
||||
rm -f "$work/$file"
|
||||
done
|
||||
[ -n "$fetched" ] || { echo "droiddeck-steam-install: $file failed on every CDN" >&2; exit 1; }
|
||||
unzip -qo "$work/$file" -d "$steam_root"
|
||||
rm -f "$work/$file"
|
||||
done < "$work/parts"
|
||||
|
||||
@@ -28,8 +28,21 @@ class SteamInstallTest(unittest.TestCase):
|
||||
curl = self.bin / 'curl'
|
||||
curl.write_text('''#!/bin/bash
|
||||
set -eu
|
||||
printf '%s\\n' "$2" >> "$TEST_REQUESTS"
|
||||
cp "$TEST_CDN/${2##*/}" "$4"
|
||||
url=""
|
||||
out=""
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
-o) out=$2; shift 2 ;;
|
||||
--connect-timeout|--max-time|--speed-limit|--speed-time|--retry|--retry-delay) shift 2 ;;
|
||||
-*) shift ;;
|
||||
*) url=$1; shift ;;
|
||||
esac
|
||||
done
|
||||
printf '%s\\n' "$url" >> "$TEST_REQUESTS"
|
||||
if [ -n "${TEST_FAIL_HOST:-}" ]; then
|
||||
case $url in *"$TEST_FAIL_HOST"*) exit 22 ;; esac
|
||||
fi
|
||||
cp "$TEST_CDN/${url##*/}" "$out"
|
||||
''')
|
||||
curl.chmod(0o755)
|
||||
if shutil.which('sha256sum') is None:
|
||||
@@ -55,11 +68,12 @@ cp "$TEST_CDN/${2##*/}" "$4"
|
||||
f'\t\t"file" "{archive.name}"\n\t\t"sha2" "{digest}"\n'
|
||||
'\t}\n}\n')
|
||||
|
||||
def install(self):
|
||||
return subprocess.run(['bash', str(SCRIPT)], env=self.env, text=True, capture_output=True)
|
||||
def install(self, fail_host=None):
|
||||
env = self.env if fail_host is None else dict(self.env, TEST_FAIL_HOST=fail_host)
|
||||
return subprocess.run(['bash', str(SCRIPT)], env=env, text=True, capture_output=True)
|
||||
|
||||
def assert_installed(self, channel='steamdeck_publicbeta'):
|
||||
result = self.install()
|
||||
def assert_installed(self, channel='steamdeck_publicbeta', fail_host=None, expected=None):
|
||||
result = self.install(fail_host)
|
||||
self.assertEqual(0, result.returncode, result.stderr)
|
||||
self.assertEqual(channel + '\n', (self.steam / 'package/beta').read_text())
|
||||
self.assertEqual('123456\n', (self.steam / 'package/droiddeck-installed').read_text())
|
||||
@@ -67,14 +81,24 @@ cp "$TEST_CDN/${2##*/}" "$4"
|
||||
self.assertTrue(os.access(client, os.X_OK))
|
||||
self.assertEqual(channel, client.read_text())
|
||||
self.assertEqual((self.steam / 'linuxarm64').resolve(), (self.home / '.steam/sdkarm64').resolve())
|
||||
self.assertEqual([
|
||||
'https://client-update.fastly.steamstatic.com/steam_client_' + channel + '_linuxarm64',
|
||||
'https://client-update.fastly.steamstatic.com/' + channel + '.zip',
|
||||
], self.requests.read_text().splitlines())
|
||||
if expected is None:
|
||||
expected = [
|
||||
'https://client-update.steamstatic.com/steam_client_' + channel + '_linuxarm64',
|
||||
'https://client-update.steamstatic.com/' + channel + '.zip',
|
||||
]
|
||||
self.assertEqual(expected, self.requests.read_text().splitlines())
|
||||
|
||||
def test_downloads_the_deck_beta_client(self):
|
||||
self.assert_installed()
|
||||
|
||||
def test_a_cdn_that_does_not_answer_hands_over_to_the_next_one(self):
|
||||
akamai = 'https://client-update.akamai.steamstatic.com'
|
||||
self.assert_installed(fail_host='client-update.steamstatic.com', expected=[
|
||||
'https://client-update.steamstatic.com/steam_client_steamdeck_publicbeta_linuxarm64',
|
||||
akamai + '/steam_client_steamdeck_publicbeta_linuxarm64',
|
||||
akamai + '/steamdeck_publicbeta.zip',
|
||||
])
|
||||
|
||||
def test_an_install_from_another_branch_is_left_for_steam_to_move(self):
|
||||
self.assert_installed()
|
||||
requests = self.requests.read_text()
|
||||
|
||||
Reference in new issue
Block a user