Skip to content

Commit

Permalink
Merge branch 'tiann:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
whyakari authored Oct 26, 2023
2 parents 4ee1ffe + 426fde5 commit a5080f1
Show file tree
Hide file tree
Showing 13 changed files with 108 additions and 35 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/build-kernel-a12.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,12 @@ jobs:
echo "$BOOT_SIGN_KEY" > ./kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem
fi
- name: Setup mutex for uploading
uses: ben-z/[email protected]
- name: Bot session cache
id: bot_session_cache
uses: actions/cache@v3
with:
path: scripts/ksubot.session
key: ${{ runner.os }}-bot-session

- name: Build boot images
run: |
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/build-kernel-a13.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,12 @@ jobs:
echo "$BOOT_SIGN_KEY" > ./kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem
fi
- name: Setup mutex for uploading
uses: ben-z/[email protected]
- name: Bot session cache
id: bot_session_cache
uses: actions/cache@v3
with:
path: scripts/ksubot.session
key: ${{ runner.os }}-bot-session

- name: Build boot images
run: |
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/build-kernel-a14.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,12 @@ jobs:
echo "$BOOT_SIGN_KEY" > ./kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem
fi
- name: Setup mutex for uploading
uses: ben-z/[email protected]
- name: Bot session cache
id: bot_session_cache
uses: actions/cache@v3
with:
path: scripts/ksubot.session
key: ${{ runner.os }}-bot-session

- name: Build boot images
run: |
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/build-kernel-arcvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,14 @@ jobs:
name: kernel-ARCVM-${{ matrix.arch }}-${{ matrix.version }}
path: "${{ env.file_path }}"

- name: Bot session cache
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/main' ) || github.ref_type == 'tag' }}
id: bot_session_cache
uses: actions/cache@v3
with:
path: scripts/ksubot.session
key: ${{ runner.os }}-bot-session

- name: Post to Telegram
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/main' ) || github.ref_type == 'tag' }}
env:
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/build-kernel-wsa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ jobs:
name: kernel-WSA-${{ matrix.arch }}-${{ matrix.version }}
path: "${{ env.file_path }}"

- name: Bot session cache
if: github.event_name == 'push' && github.ref == 'refs/heads/main' || github.ref_type == 'tag'
id: bot_session_cache
uses: actions/cache@v3
with:
path: scripts/ksubot.session
key: ${{ runner.os }}-bot-session

- name: Post to Telegram
if: github.event_name == 'push' && github.ref == 'refs/heads/main' || github.ref_type == 'tag'
env:
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/build-manager.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,13 @@ jobs:
name: manager
path: manager/app/build/outputs/apk/release/*.apk

- name: Setup mutex for uploading
uses: ben-z/[email protected]
- name: Bot session cache
if: github.event_name != 'pull_request' && steps.need_upload.outputs.UPLOAD == 'true'
id: bot_session_cache
uses: actions/cache@v3
with:
path: scripts/ksubot.session
key: ${{ runner.os }}-bot-session

- name: Upload to telegram
if: github.event_name != 'pull_request' && steps.need_upload.outputs.UPLOAD == 'true'
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/build-su.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@ jobs:
with:
name: su
path: ./userspace/su/libs
- name: Setup mutex for uploading
uses: ben-z/[email protected]
- name: Bot session cache
if: github.event_name != 'pull_request' && steps.need_upload.outputs.UPLOAD == 'true'
id: bot_session_cache
uses: actions/cache@v3
with:
path: scripts/ksubot.session
key: ${{ runner.os }}-bot-session
- name: Upload to telegram
if: github.event_name != 'pull_request' && steps.need_upload.outputs.UPLOAD == 'true'
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gki-kernel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ jobs:
- name: Make working directory clean to avoid dirty
working-directory: android-kernel
run: |
sed -i '/^rfkill_/d' common/android/abi_gki_protected_exports_*
sed -i '/^rfkill_/d' common/android/abi_gki_protected_exports_* || echo "No protected exports!"
git config --global user.email "[email protected]"
git config --global user.name "KernelSUBot"
cd common/ && git add -A && git commit -a -m "Add KernelSU"
Expand Down
55 changes: 34 additions & 21 deletions manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Module.kt
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ private fun ModuleList(
val changelogText = stringResource(R.string.module_changelog)
val downloadingText = stringResource(R.string.module_downloading)
val startDownloadingText = stringResource(R.string.module_start_downloading)
val fetchChangeLogFailed = stringResource(R.string.module_changelog_failed)

val dialogHost = LocalDialogHost.current
val snackBarHost = LocalSnackbarHost.current
Expand All @@ -161,36 +162,48 @@ private fun ModuleList(
downloadUrl: String,
fileName: String
) {
val changelog = dialogHost.withLoading {
val changelogResult = dialogHost.withLoading {
withContext(Dispatchers.IO) {
OkHttpClient().newCall(
okhttp3.Request.Builder().url(changelogUrl).build()
).execute().body!!.string()
runCatching {
OkHttpClient().newCall(
okhttp3.Request.Builder().url(changelogUrl).build()
).execute().body!!.string()
}
}
}

if (changelog.isNotEmpty()) {
// changelog is not empty, show it and wait for confirm
val confirmResult = dialogHost.showConfirm(
changelogText,
content = changelog,
markdown = true,
confirm = updateText,
)

if (confirmResult != ConfirmResult.Confirmed) {
return
val showToast: suspend (String) -> Unit = {msg->
withContext(Dispatchers.Main) {
Toast.makeText(
context,
msg,
Toast.LENGTH_SHORT
).show()
}
}

withContext(Dispatchers.Main) {
Toast.makeText(
context,
startDownloadingText.format(module.name),
Toast.LENGTH_SHORT
).show()
val changelog = changelogResult.getOrElse {
showToast(fetchChangeLogFailed.format(it.message))
return
}.ifBlank {
showToast(fetchChangeLogFailed.format(module.name))
return
}

// changelog is not empty, show it and wait for confirm
val confirmResult = dialogHost.showConfirm(
changelogText,
content = changelog,
markdown = true,
confirm = updateText,
)

if (confirmResult != ConfirmResult.Confirmed) {
return
}

showToast(startDownloadingText.format(module.name))

val downloading = downloadingText.format(module.name)
withContext(Dispatchers.IO) {
download(
Expand Down
1 change: 1 addition & 0 deletions manager/app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,5 @@
<string name="app_profile_template_sync">同步在线规则</string>
<string name="app_profile_template_save_failed">模版保存失败!</string>
<string name="app_profile_template_import_empty">剪切板为空!</string>
<string name="module_changelog_failed">获取更新日志失败:%s</string>
</resources>
1 change: 1 addition & 0 deletions manager/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,5 @@
<string name="app_profile_template_sync">Sync online templates</string>
<string name="app_profile_template_save_failed">Failed to save template</string>
<string name="app_profile_template_import_empty">Clipboard is empty!</string>
<string name="module_changelog_failed">Fetch changelog failed: %s</string>
</resources>
5 changes: 3 additions & 2 deletions scripts/ksubot.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ async def main():
print("[-] No files to upload")
exit(1)
print("[+] Logging in Telegram with bot")
async with await TelegramClient(session=None, api_id=API_ID, api_hash=API_HASH).start(bot_token=BOT_TOKEN) as bot:
script_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
session_dir = os.path.join(script_dir, "ksubot.session")
async with await TelegramClient(session=session_dir, api_id=API_ID, api_hash=API_HASH).start(bot_token=BOT_TOKEN) as bot:
caption = [""] * len(files)
caption[-1] = get_caption()
print("[+] Caption: ")
Expand All @@ -83,7 +85,6 @@ async def main():
print("[+] Sending")
await bot.send_file(entity=CHAT_ID, file=files, caption=caption, reply_to=MESSAGE_THREAD_ID, parse_mode="markdown")
print("[+] Done!")
await bot.log_out()

if __name__ == "__main__":
try:
Expand Down
23 changes: 22 additions & 1 deletion website/docs/repos.json
Original file line number Diff line number Diff line change
Expand Up @@ -523,5 +523,26 @@
"kernel_name": "kernel_xiaomi_sm8350",
"kernel_link": "https://github.com/supechicken/kernel_xiaomi_sm8350",
"devices": " Xiaomi 11T Pro (vili)"
},
{
"maintainer": "Vaz15k",
"maintainer_link": "https://github.com/Vaz15k",
"kernel_name": "kernelSU-A70q",
"kernel_link": "https://github.com/Vaz15k/kernelSU-A70q",
"devices": "Samsung Galaxy A70 ( A705MN / A705FN )"
},
{
"maintainer": "whyakari",
"maintainer_link": "https://github.com/whyakari",
"kernel_name": "android_kernel_xiaomi_ginkgo",
"kernel_link": "https://github.com/whyakari/android_kernel_xiaomi_ginkgo",
"devices": "non-GKI ginkgo"
},
{
"maintainer": "wulan17",
"maintainer_link": "https://github.com/wulan17",
"kernel_name": "android_kernel_xiaomi_mt6765",
"kernel_link": "https://github.com/Mayuri-Chan/android_kernel_xiaomi_mt6765/tree/10-ksu",
"devices": "Redmi 6/6A (cereus/cactus)"
}
]
]

0 comments on commit a5080f1

Please sign in to comment.