diff --git a/.github/workflows/update-dependencies.yaml b/.github/workflows/update-dependencies.yaml index dc87d26e..476489f6 100644 --- a/.github/workflows/update-dependencies.yaml +++ b/.github/workflows/update-dependencies.yaml @@ -21,9 +21,6 @@ jobs: distribution: 'zulu' java-version: 17 - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v4 - - name: Setup Go uses: actions/setup-go@v5 with: @@ -37,10 +34,6 @@ jobs: key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go- - - - name: Download GeoIP Database - run: | - ./gradlew :core:downloadGeoipDatabase - name: Install update-go-mod-replace run: | diff --git a/app/src/main/java/com/github/kr328/clash/OverrideSettingsActivity.kt b/app/src/main/java/com/github/kr328/clash/OverrideSettingsActivity.kt index c1636c86..b4641ed0 100644 --- a/app/src/main/java/com/github/kr328/clash/OverrideSettingsActivity.kt +++ b/app/src/main/java/com/github/kr328/clash/OverrideSettingsActivity.kt @@ -45,45 +45,14 @@ class OverrideSettingsActivity : BaseActivity() { withClash { clearOverride(Clash.OverrideSlot.Persist) } - - service.sideloadGeoip = "" } finish() } } - OverrideSettingsDesign.Request.EditSideloadGeoip -> { - withContext(Dispatchers.IO) { - val list = querySideloadProviders() - val initial = service.sideloadGeoip - val exist = list.any { info -> info.packageName == initial } - - service.sideloadGeoip = - design.requestSelectSideload(if (exist) initial else "", list) - } - } } } } } } - - private fun querySideloadProviders(): List { - val apps = packageManager.getInstalledPackages(PackageManager.GET_META_DATA) - .filter { - it.applicationInfo.metaData?.containsKey(Metadata.GEOIP_FILE_NAME) - ?: false - } - .map { it.toAppInfo(packageManager) } - - return listOf( - AppInfo( - packageName = "", - label = getString(R.string.use_built_in), - icon = getDrawableCompat(R.drawable.ic_baseline_work)!!, - installTime = 0, - updateDate = 0, - ) - ) + apps - } } \ No newline at end of file diff --git a/core/build.gradle.kts b/core/build.gradle.kts index ed6dd2ad..e50230aa 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -11,10 +11,6 @@ plugins { id("golang-android") } -val geoipDatabaseUrl = - "https://raw.githubusercontent.com/Loyalsoldier/geoip/release/Country.mmdb" -val geoipInvalidate = Duration.ofDays(7)!! -val geoipOutput = buildDir.resolve("intermediates/golang_blob") val golangSource = file("src/main/golang/native") golang { @@ -66,52 +62,4 @@ afterEvaluate { tasks.withType(GolangBuildTask::class.java).forEach { it.inputs.dir(golangSource) } -} - -task("downloadGeoipDatabase") { - val databaseFile = geoipOutput.resolve("Country.mmdb") - val moduleFile = geoipOutput.resolve("go.mod") - val sourceFile = geoipOutput.resolve("blob.go") - - val moduleContent = """ - module "cfa/blob" - """.trimIndent() - - val sourceContent = """ - package blob - - import _ "embed" - - //go:embed Country.mmdb - var GeoipDatabase []byte - """.trimIndent() - - outputs.dir(geoipOutput) - - onlyIf { - System.currentTimeMillis() - databaseFile.lastModified() > geoipInvalidate.toMillis() - } - - doLast { - geoipOutput.mkdirs() - - moduleFile.writeText(moduleContent) - sourceFile.writeText(sourceContent) - - URL(geoipDatabaseUrl).openConnection().getInputStream().use { input -> - FileOutputStream(databaseFile).use { output -> - input.copyTo(output) - } - } - } -} - -afterEvaluate { - val downloadTask = tasks["downloadGeoipDatabase"] - - tasks.forEach { - if (it.name.startsWith("externalGolangBuild")) { - it.dependsOn(downloadTask) - } - } -} +} \ No newline at end of file diff --git a/core/src/foss/golang/go.mod b/core/src/foss/golang/go.mod index a4af5078..6a00af12 100644 --- a/core/src/foss/golang/go.mod +++ b/core/src/foss/golang/go.mod @@ -4,8 +4,6 @@ go 1.20 require cfa v0.0.0 -require cfa/blob v0.0.0-00010101000000-000000000000 // indirect - require ( github.com/3andne/restls-client-go v0.1.6 // indirect github.com/RyuaNerin/go-krypto v1.2.4 // indirect @@ -115,5 +113,3 @@ replace github.com/sagernet/sing => github.com/metacubex/sing v0.0.0-20240724044 replace cfa => ../../main/golang replace github.com/metacubex/mihomo => ./clash - -replace cfa/blob => ../../../build/intermediates/golang_blob diff --git a/core/src/main/cpp/main.c b/core/src/main/cpp/main.c index a836a0e1..0a2c8b51 100644 --- a/core/src/main/cpp/main.c +++ b/core/src/main/cpp/main.c @@ -287,33 +287,6 @@ Java_com_github_kr328_clash_core_bridge_Bridge_nativeClearOverride(JNIEnv *env, clearOverride(slot); } -JNIEXPORT void JNICALL -Java_com_github_kr328_clash_core_bridge_Bridge_nativeInstallSideloadGeoip(JNIEnv *env, jobject thiz, - jbyteArray data) { - TRACE_METHOD(); - - if (data == NULL) { - installSideloadGeoip(NULL, 0); - - return; - } - - jbyte *bytes = (*env)->GetByteArrayElements(env, data, NULL); - int size = (*env)->GetArrayLength(env, data); - - scoped_string err = installSideloadGeoip(bytes, size); - - (*env)->ReleaseByteArrayElements(env, data, bytes, JNI_ABORT); - - if (err != NULL) { - (*env)->ThrowNew( - env, - find_class("com/github/kr328/clash/core/bridge/ClashException"), - err - ); - } -} - JNIEXPORT jstring JNICALL Java_com_github_kr328_clash_core_bridge_Bridge_nativeQueryConfiguration(JNIEnv *env, jobject thiz) { TRACE_METHOD(); diff --git a/core/src/main/golang/.idea/codeStyles/Project.xml b/core/src/main/golang/.idea/codeStyles/Project.xml index bbba885f..235439ed 100644 --- a/core/src/main/golang/.idea/codeStyles/Project.xml +++ b/core/src/main/golang/.idea/codeStyles/Project.xml @@ -5,7 +5,6 @@