2019-05-06 19:03:28 +02:00
|
|
|
package com.topjohnwu.magisk.data.network
|
|
|
|
|
2019-06-08 09:41:03 +02:00
|
|
|
import com.topjohnwu.magisk.Const
|
2019-06-17 01:47:30 +02:00
|
|
|
import com.topjohnwu.magisk.model.entity.UpdateInfo
|
2019-05-06 19:03:28 +02:00
|
|
|
import io.reactivex.Single
|
|
|
|
import okhttp3.ResponseBody
|
|
|
|
import retrofit2.http.GET
|
|
|
|
import retrofit2.http.Path
|
|
|
|
import retrofit2.http.Streaming
|
|
|
|
import retrofit2.http.Url
|
|
|
|
|
|
|
|
|
|
|
|
interface GithubRawApiServices {
|
|
|
|
|
|
|
|
//region topjohnwu/magisk_files
|
|
|
|
|
|
|
|
@GET("$MAGISK_FILES/master/stable.json")
|
2019-06-17 01:47:30 +02:00
|
|
|
fun fetchStableUpdate(): Single<UpdateInfo>
|
2019-05-06 19:03:28 +02:00
|
|
|
|
|
|
|
@GET("$MAGISK_FILES/master/beta.json")
|
2019-06-17 01:47:30 +02:00
|
|
|
fun fetchBetaUpdate(): Single<UpdateInfo>
|
2019-05-06 19:03:28 +02:00
|
|
|
|
|
|
|
@GET("$MAGISK_FILES/master/canary_builds/release.json")
|
2019-06-17 01:47:30 +02:00
|
|
|
fun fetchCanaryUpdate(): Single<UpdateInfo>
|
2019-05-06 19:03:28 +02:00
|
|
|
|
|
|
|
@GET("$MAGISK_FILES/master/canary_builds/canary.json")
|
2019-06-17 01:47:30 +02:00
|
|
|
fun fetchCanaryDebugUpdate(): Single<UpdateInfo>
|
2019-05-06 19:03:28 +02:00
|
|
|
|
2019-05-23 18:11:23 +02:00
|
|
|
@GET
|
2019-06-17 01:47:30 +02:00
|
|
|
fun fetchCustomUpdate(@Url url: String): Single<UpdateInfo>
|
2019-05-23 18:11:23 +02:00
|
|
|
|
2019-05-06 19:03:28 +02:00
|
|
|
@GET("$MAGISK_FILES/{$REVISION}/snet.apk")
|
|
|
|
@Streaming
|
2019-06-08 09:41:03 +02:00
|
|
|
fun fetchSafetynet(@Path(REVISION) revision: String = Const.SNET_REVISION): Single<ResponseBody>
|
2019-05-06 19:03:28 +02:00
|
|
|
|
|
|
|
@GET("$MAGISK_FILES/{$REVISION}/bootctl")
|
|
|
|
@Streaming
|
2019-06-08 09:41:03 +02:00
|
|
|
fun fetchBootctl(@Path(REVISION) revision: String = Const.BOOTCTL_REVISION): Single<ResponseBody>
|
2019-05-06 19:03:28 +02:00
|
|
|
|
|
|
|
//endregion
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This method shall be used exclusively for fetching files from urls from previous requests.
|
|
|
|
* Him, who uses it in a wrong way, shall die in an eternal flame.
|
|
|
|
* */
|
|
|
|
@GET
|
|
|
|
@Streaming
|
|
|
|
fun fetchFile(@Url url: String): Single<ResponseBody>
|
|
|
|
|
|
|
|
|
|
|
|
companion object {
|
|
|
|
private const val REVISION = "revision"
|
|
|
|
private const val MODULE = "module"
|
|
|
|
private const val FILE = "file"
|
|
|
|
|
|
|
|
|
2019-06-10 13:37:56 +02:00
|
|
|
private const val MAGISK_FILES = "topjohnwu/magisk_files"
|
2019-05-06 19:03:28 +02:00
|
|
|
private const val MAGISK_MASTER = "topjohnwu/Magisk/master"
|
|
|
|
private const val MAGISK_MODULES = "Magisk-Modules-Repo"
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|