Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
d1796e4c68
3 changed files with 45 additions and 14 deletions
|
|
@ -5,15 +5,15 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "GoonXposed.xposed"
|
namespace = "ShiggyXposed.xposed"
|
||||||
compileSdk = 36
|
compileSdk = 36
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId = "GoonXposed.xposed"
|
applicationId = "ShiggyXposed.xposed"
|
||||||
minSdk = 24
|
minSdk = 24
|
||||||
targetSdk = 36
|
targetSdk = 36
|
||||||
versionCode = 1330
|
versionCode = 1230
|
||||||
versionName = "1.3.3"
|
versionName = "1.2.3"
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
|
|
||||||
|
|
@ -100,19 +100,29 @@ object HookScriptLoaderModule : Module() {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
preloadsDir.walk().filter { it.isFile }.forEach(runScriptFile)
|
// If a disabled marker exists next to the cached bundle, treat this as a global
|
||||||
|
// disable for the entire script-loading step. In that case, we skip preloads,
|
||||||
|
// cached main script and the assets fallback so nothing is injected.
|
||||||
|
val disabledMarker = File(mainScript.parentFile, "${Constants.MAIN_SCRIPT_FILE}.disabled")
|
||||||
|
if (disabledMarker.exists()) {
|
||||||
|
Log.i("Script loading disabled by marker; skipping preloads, cached bundle and fallback")
|
||||||
|
} else {
|
||||||
|
// Normal behaviour: run preloads then cached main script or fallback to bundled asset
|
||||||
|
preloadsDir.walk().filter { it.isFile }.forEach(runScriptFile)
|
||||||
|
|
||||||
if (mainScript.exists()) runScriptFile(mainScript)
|
if (mainScript.exists()) {
|
||||||
else {
|
runScriptFile(mainScript)
|
||||||
Log.i("Main script does not exist, falling back")
|
} else {
|
||||||
|
Log.i("Main script does not exist, falling back")
|
||||||
|
|
||||||
if (!::resources.isInitialized) resources = XModuleResources.createInstance(modulePath, null)
|
if (!::resources.isInitialized) resources = XModuleResources.createInstance(modulePath, null)
|
||||||
|
|
||||||
XposedBridge.invokeOriginalMethod(
|
XposedBridge.invokeOriginalMethod(
|
||||||
loadScriptFromAssets,
|
loadScriptFromAssets,
|
||||||
thisObject,
|
thisObject,
|
||||||
arrayOf(resources.assets, "assets://Shiggy.bundle", loadSynchronously)
|
arrayOf(resources.assets, "assets://Shiggy.bundle", loadSynchronously)
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
Log.e("Unable to run scripts:", e)
|
Log.e("Unable to run scripts:", e)
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,8 @@ object UpdaterModule : Module() {
|
||||||
private lateinit var cacheDir: File
|
private lateinit var cacheDir: File
|
||||||
private lateinit var bundle: File
|
private lateinit var bundle: File
|
||||||
private lateinit var etag: File
|
private lateinit var etag: File
|
||||||
|
// Path to the application's data directory so we can read LogBox settings
|
||||||
|
private lateinit var appDataDir: File
|
||||||
|
|
||||||
private const val TIMEOUT_CACHED = 5000L
|
private const val TIMEOUT_CACHED = 5000L
|
||||||
private const val TIMEOUT = 10000L
|
private const val TIMEOUT = 10000L
|
||||||
|
|
@ -58,6 +60,8 @@ object UpdaterModule : Module() {
|
||||||
"https://github.com/OTKUSteyler/GoonCord/releases/download/latest/gooncord.js"
|
"https://github.com/OTKUSteyler/GoonCord/releases/download/latest/gooncord.js"
|
||||||
|
|
||||||
override fun onLoad(packageParam: XC_LoadPackage.LoadPackageParam) = with(packageParam) {
|
override fun onLoad(packageParam: XC_LoadPackage.LoadPackageParam) = with(packageParam) {
|
||||||
|
// store app data dir for later checks (LogBox settings live under files/logbox)
|
||||||
|
appDataDir = File(appInfo.dataDir)
|
||||||
cacheDir = File(appInfo.dataDir, Constants.CACHE_DIR).apply { mkdirs() }
|
cacheDir = File(appInfo.dataDir, Constants.CACHE_DIR).apply { mkdirs() }
|
||||||
val filesDir = File(appInfo.dataDir, Constants.FILES_DIR).apply { mkdirs() }
|
val filesDir = File(appInfo.dataDir, Constants.FILES_DIR).apply { mkdirs() }
|
||||||
|
|
||||||
|
|
@ -75,6 +79,23 @@ object UpdaterModule : Module() {
|
||||||
|
|
||||||
fun downloadScript(activity: Activity? = null): Job = scope.launch {
|
fun downloadScript(activity: Activity? = null): Job = scope.launch {
|
||||||
try {
|
try {
|
||||||
|
// Respect LogBox setting to disable bundle injections.
|
||||||
|
// If the file "files/logbox/LOGBOX_SETTINGS" contains the flag bundleInjectionDisabled=true,
|
||||||
|
// skip attempting to download/update the bundle.
|
||||||
|
try {
|
||||||
|
val settingsFile = File(appDataDir, "files/logbox/LOGBOX_SETTINGS")
|
||||||
|
if (settingsFile.exists()) {
|
||||||
|
val txt = settingsFile.readText()
|
||||||
|
// look for a simple true marker; this avoids introducing a new JSON dependency here
|
||||||
|
if (txt.contains("\"bundleInjectionDisabled\"") && txt.contains("true")) {
|
||||||
|
Log.i("UpdaterModule: bundle injection disabled by LogBox settings — skipping download")
|
||||||
|
return@launch
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (ignore: Exception) {
|
||||||
|
// If anything goes wrong reading the setting, proceed with normal behaviour.
|
||||||
|
}
|
||||||
|
|
||||||
HttpClient(CIO) {
|
HttpClient(CIO) {
|
||||||
expectSuccess = false
|
expectSuccess = false
|
||||||
install(UserAgent) { agent = Constants.USER_AGENT }
|
install(UserAgent) { agent = Constants.USER_AGENT }
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue