Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
928b3425
Commit
928b3425
authored
Jan 27, 2022
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Embed module installer in APK
parent
0726a00e
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
6 additions
and
21 deletions
+6
-21
DownloadService.kt
...ava/com/topjohnwu/magisk/core/download/DownloadService.kt
+1
-1
NetworkServices.kt
...java/com/topjohnwu/magisk/data/network/NetworkServices.kt
+0
-10
NetworkService.kt
...va/com/topjohnwu/magisk/data/repository/NetworkService.kt
+3
-8
ServiceLocator.kt
app/src/main/java/com/topjohnwu/magisk/di/ServiceLocator.kt
+0
-1
Setup.kt
buildSrc/src/main/java/Setup.kt
+2
-1
No files found.
app/src/main/java/com/topjohnwu/magisk/core/download/DownloadService.kt
View file @
928b3425
...
@@ -66,7 +66,7 @@ class DownloadService : BaseService() {
...
@@ -66,7 +66,7 @@ class DownloadService : BaseService() {
val
stream
=
service
.
fetchFile
(
subject
.
url
).
toProgressStream
(
subject
)
val
stream
=
service
.
fetchFile
(
subject
.
url
).
toProgressStream
(
subject
)
when
(
subject
)
{
when
(
subject
)
{
is
Subject
.
Manager
->
handleAPK
(
subject
,
stream
)
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
val
activity
=
ActivityTracker
.
foreground
if
(
activity
!=
null
&&
subject
.
autoStart
)
{
if
(
activity
!=
null
&&
subject
.
autoStart
)
{
...
...
app/src/main/java/com/topjohnwu/magisk/data/network/NetworkServices.kt
View file @
928b3425
...
@@ -6,26 +6,16 @@ import com.topjohnwu.magisk.core.model.UpdateInfo
...
@@ -6,26 +6,16 @@ import com.topjohnwu.magisk.core.model.UpdateInfo
import
okhttp3.ResponseBody
import
okhttp3.ResponseBody
import
retrofit2.http.*
import
retrofit2.http.*
private
const
val
REVISION
=
"revision"
private
const
val
BRANCH
=
"branch"
private
const
val
BRANCH
=
"branch"
private
const
val
REPO
=
"repo"
private
const
val
REPO
=
"repo"
private
const
val
FILE
=
"file"
private
const
val
FILE
=
"file"
const
val
MAGISK_MAIN
=
"topjohnwu/Magisk"
interface
GithubPageServices
{
interface
GithubPageServices
{
@GET
(
"{$FILE}"
)
@GET
(
"{$FILE}"
)
suspend
fun
fetchUpdateJSON
(
@Path
(
FILE
)
file
:
String
):
UpdateInfo
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
{
interface
RawServices
{
@GET
@GET
...
...
app/src/main/java/com/topjohnwu/magisk/data/repository/NetworkService.kt
View file @
928b3425
...
@@ -7,7 +7,9 @@ import com.topjohnwu.magisk.core.Config.Value.CUSTOM_CHANNEL
...
@@ -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.DEFAULT_CHANNEL
import
com.topjohnwu.magisk.core.Config.Value.STABLE_CHANNEL
import
com.topjohnwu.magisk.core.Config.Value.STABLE_CHANNEL
import
com.topjohnwu.magisk.core.Info
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
retrofit2.HttpException
import
timber.log.Timber
import
timber.log.Timber
import
java.io.IOException
import
java.io.IOException
...
@@ -15,7 +17,6 @@ import java.io.IOException
...
@@ -15,7 +17,6 @@ import java.io.IOException
class
NetworkService
(
class
NetworkService
(
private
val
pages
:
GithubPageServices
,
private
val
pages
:
GithubPageServices
,
private
val
raw
:
RawServices
,
private
val
raw
:
RawServices
,
private
val
jsd
:
JSDelivrServices
,
private
val
api
:
GithubApiServices
private
val
api
:
GithubApiServices
)
{
)
{
suspend
fun
fetchUpdate
()
=
safe
{
suspend
fun
fetchUpdate
()
=
safe
{
...
@@ -59,13 +60,7 @@ class NetworkService(
...
@@ -59,13 +60,7 @@ class NetworkService(
}
}
// Fetch files
// Fetch files
suspend
fun
fetchInstaller
()
=
wrap
{
val
sha
=
fetchMainVersion
()
jsd
.
fetchInstaller
(
sha
)
}
suspend
fun
fetchFile
(
url
:
String
)
=
wrap
{
raw
.
fetchFile
(
url
)
}
suspend
fun
fetchFile
(
url
:
String
)
=
wrap
{
raw
.
fetchFile
(
url
)
}
suspend
fun
fetchString
(
url
:
String
)
=
wrap
{
raw
.
fetchString
(
url
)
}
suspend
fun
fetchString
(
url
:
String
)
=
wrap
{
raw
.
fetchString
(
url
)
}
suspend
fun
fetchModuleJson
(
url
:
String
)
=
wrap
{
raw
.
fetchModuleJson
(
url
)
}
suspend
fun
fetchModuleJson
(
url
:
String
)
=
wrap
{
raw
.
fetchModuleJson
(
url
)
}
private
suspend
fun
fetchMainVersion
()
=
api
.
fetchBranch
(
MAGISK_MAIN
,
"master"
).
commit
.
sha
}
}
app/src/main/java/com/topjohnwu/magisk/di/ServiceLocator.kt
View file @
928b3425
...
@@ -47,7 +47,6 @@ object ServiceLocator {
...
@@ -47,7 +47,6 @@ object ServiceLocator {
NetworkService
(
NetworkService
(
createApiService
(
retrofit
,
Const
.
Url
.
GITHUB_PAGE_URL
),
createApiService
(
retrofit
,
Const
.
Url
.
GITHUB_PAGE_URL
),
createApiService
(
retrofit
,
Const
.
Url
.
GITHUB_RAW_URL
),
createApiService
(
retrofit
,
Const
.
Url
.
GITHUB_RAW_URL
),
createApiService
(
retrofit
,
Const
.
Url
.
JS_DELIVR_URL
),
createApiService
(
retrofit
,
Const
.
Url
.
GITHUB_API_URL
)
createApiService
(
retrofit
,
Const
.
Url
.
GITHUB_API_URL
)
)
)
}
}
...
...
buildSrc/src/main/java/Setup.kt
View file @
928b3425
...
@@ -123,7 +123,8 @@ fun Project.setupApp() {
...
@@ -123,7 +123,8 @@ fun Project.setupApp() {
inputs
.
property
(
"versionCode"
,
Config
.
versionCode
)
inputs
.
property
(
"versionCode"
,
Config
.
versionCode
)
into
(
"src/main/assets"
)
into
(
"src/main/assets"
)
from
(
rootProject
.
file
(
"scripts"
))
{
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"
))
from
(
rootProject
.
file
(
"tools/bootctl"
))
into
(
"chromeos"
)
{
into
(
"chromeos"
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment