Merge remote-tracking branch 'upstream/master'

This commit is contained in:
OTKUSteyler 2025-12-11 18:29:19 +01:00
commit d1796e4c68
3 changed files with 45 additions and 14 deletions

View file

@ -5,15 +5,15 @@ plugins {
}
android {
namespace = "GoonXposed.xposed"
namespace = "ShiggyXposed.xposed"
compileSdk = 36
defaultConfig {
applicationId = "GoonXposed.xposed"
applicationId = "ShiggyXposed.xposed"
minSdk = 24
targetSdk = 36
versionCode = 1330
versionName = "1.3.3"
versionCode = 1230
versionName = "1.2.3"
}
buildTypes {

View file

@ -100,10 +100,19 @@ object HookScriptLoaderModule : Module() {
}
try {
// 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)
else {
if (mainScript.exists()) {
runScriptFile(mainScript)
} else {
Log.i("Main script does not exist, falling back")
if (!::resources.isInitialized) resources = XModuleResources.createInstance(modulePath, null)
@ -114,6 +123,7 @@ object HookScriptLoaderModule : Module() {
arrayOf(resources.assets, "assets://Shiggy.bundle", loadSynchronously)
)
}
}
} catch (e: Throwable) {
Log.e("Unable to run scripts:", e)
}

View file

@ -48,6 +48,8 @@ object UpdaterModule : Module() {
private lateinit var cacheDir: File
private lateinit var bundle: 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 = 10000L
@ -58,6 +60,8 @@ object UpdaterModule : Module() {
"https://github.com/OTKUSteyler/GoonCord/releases/download/latest/gooncord.js"
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() }
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 {
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) {
expectSuccess = false
install(UserAgent) { agent = Constants.USER_AGENT }