diff --git a/app/src/main/java/com/topjohnwu/magisk/core/download/DownloadService.kt b/app/src/main/java/com/topjohnwu/magisk/core/download/DownloadService.kt index 9956576a1..005f40958 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/download/DownloadService.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/download/DownloadService.kt @@ -66,7 +66,7 @@ class DownloadService : BaseService() { val stream = service.fetchFile(subject.url).toProgressStream(subject) when (subject) { is Subject.Manager -> handleAPK(subject, stream) - else -> stream.toModule(subject.file, service.fetchInstaller().byteStream()) + is Subject.Module -> stream.toModule(subject.file, assets.open("module_installer.sh")) } val activity = ActivityTracker.foreground if (activity != null && subject.autoStart) { diff --git a/app/src/main/java/com/topjohnwu/magisk/data/network/NetworkServices.kt b/app/src/main/java/com/topjohnwu/magisk/data/network/NetworkServices.kt index c892b96d4..1e00b4b09 100644 --- a/app/src/main/java/com/topjohnwu/magisk/data/network/NetworkServices.kt +++ b/app/src/main/java/com/topjohnwu/magisk/data/network/NetworkServices.kt @@ -6,26 +6,16 @@ import com.topjohnwu.magisk.core.model.UpdateInfo import okhttp3.ResponseBody import retrofit2.http.* -private const val REVISION = "revision" private const val BRANCH = "branch" private const val REPO = "repo" private const val FILE = "file" -const val MAGISK_MAIN = "topjohnwu/Magisk" - interface GithubPageServices { @GET("{$FILE}") suspend fun fetchUpdateJSON(@Path(FILE) file: String): UpdateInfo } -interface JSDelivrServices { - - @GET("$MAGISK_MAIN@{$REVISION}/scripts/module_installer.sh") - @Streaming - suspend fun fetchInstaller(@Path(REVISION) revision: String): ResponseBody -} - interface RawServices { @GET diff --git a/app/src/main/java/com/topjohnwu/magisk/data/repository/NetworkService.kt b/app/src/main/java/com/topjohnwu/magisk/data/repository/NetworkService.kt index b7830b5d7..e7568ebe6 100644 --- a/app/src/main/java/com/topjohnwu/magisk/data/repository/NetworkService.kt +++ b/app/src/main/java/com/topjohnwu/magisk/data/repository/NetworkService.kt @@ -7,7 +7,9 @@ import com.topjohnwu.magisk.core.Config.Value.CUSTOM_CHANNEL import com.topjohnwu.magisk.core.Config.Value.DEFAULT_CHANNEL import com.topjohnwu.magisk.core.Config.Value.STABLE_CHANNEL import com.topjohnwu.magisk.core.Info -import com.topjohnwu.magisk.data.network.* +import com.topjohnwu.magisk.data.network.GithubApiServices +import com.topjohnwu.magisk.data.network.GithubPageServices +import com.topjohnwu.magisk.data.network.RawServices import retrofit2.HttpException import timber.log.Timber import java.io.IOException @@ -15,7 +17,6 @@ import java.io.IOException class NetworkService( private val pages: GithubPageServices, private val raw: RawServices, - private val jsd: JSDelivrServices, private val api: GithubApiServices ) { suspend fun fetchUpdate() = safe { @@ -59,13 +60,7 @@ class NetworkService( } // Fetch files - suspend fun fetchInstaller() = wrap { - val sha = fetchMainVersion() - jsd.fetchInstaller(sha) - } suspend fun fetchFile(url: String) = wrap { raw.fetchFile(url) } suspend fun fetchString(url: String) = wrap { raw.fetchString(url) } suspend fun fetchModuleJson(url: String) = wrap { raw.fetchModuleJson(url) } - - private suspend fun fetchMainVersion() = api.fetchBranch(MAGISK_MAIN, "master").commit.sha } diff --git a/app/src/main/java/com/topjohnwu/magisk/di/ServiceLocator.kt b/app/src/main/java/com/topjohnwu/magisk/di/ServiceLocator.kt index 1398e6b6c..4b80264c2 100644 --- a/app/src/main/java/com/topjohnwu/magisk/di/ServiceLocator.kt +++ b/app/src/main/java/com/topjohnwu/magisk/di/ServiceLocator.kt @@ -47,7 +47,6 @@ object ServiceLocator { NetworkService( createApiService(retrofit, Const.Url.GITHUB_PAGE_URL), createApiService(retrofit, Const.Url.GITHUB_RAW_URL), - createApiService(retrofit, Const.Url.JS_DELIVR_URL), createApiService(retrofit, Const.Url.GITHUB_API_URL) ) } diff --git a/buildSrc/src/main/java/Setup.kt b/buildSrc/src/main/java/Setup.kt index d7911e75a..1091bf881 100644 --- a/buildSrc/src/main/java/Setup.kt +++ b/buildSrc/src/main/java/Setup.kt @@ -123,7 +123,8 @@ fun Project.setupApp() { inputs.property("versionCode", Config.versionCode) into("src/main/assets") from(rootProject.file("scripts")) { - include("util_functions.sh", "boot_patch.sh", "uninstaller.sh", "addon.d.sh") + include("util_functions.sh", "boot_patch.sh", "addon.d.sh") + include("uninstaller.sh", "module_installer.sh") } from(rootProject.file("tools/bootctl")) into("chromeos") {