fix(modules/HookScriptLoaderModule): don't use cache when custom bundle URL is enabled

This commit is contained in:
Purple_Ξye™ 2026-01-30 05:09:47 +01:00
parent 87d4c78c67
commit d9603ffdb5
2 changed files with 10 additions and 5 deletions

View file

@ -83,15 +83,18 @@ object HookScriptLoaderModule : Module() {
runBlocking {
val ready = async { HookStateHolder.readyDeferred.join() }
val isCustomUrl = UpdaterModule.isCustomUrlEnabled
if (mainScript.exists()) {
if (!mainScript.exists() || isCustomUrl) {
val reason = if (isCustomUrl) "Custom URL enabled" else "Main script does not exist"
Log.i("$reason, downloading before load...")
val download =
async { UpdaterModule.downloadScript(showUpdateDialog = false).join() }
awaitAll(ready, download)
} else {
Log.i("Main script exists, updating in background...")
UpdaterModule.downloadScript(showUpdateDialog = true)
ready.await()
} else {
Log.i("Main script does not exist, downloading before load...")
val download = async { UpdaterModule.downloadScript(showUpdateDialog = false).join() }
awaitAll(ready, download)
}
}

View file

@ -43,6 +43,8 @@ data class LoaderConfig(
*/
object UpdaterModule : Module() {
private lateinit var config: LoaderConfig
val isCustomUrlEnabled: Boolean
get() = config.customLoadUrl.enabled
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
private var lastActivity: WeakReference<Activity>? = null