You've already forked Tricky-Addon-Update-Target-List
mirror of
https://github.com/KOWX712/Tricky-Addon-Update-Target-List.git
synced 2025-09-06 06:37:09 +00:00
misc: code cleanup
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
# This file is the backend of JavaScript
|
# This file is the backend of JavaScript
|
||||||
|
|
||||||
MODPATH=${0%/*}
|
MODPATH=${0%/*}
|
||||||
ORG_PATH="$PATH"
|
|
||||||
SKIPLIST="$MODPATH/tmp/skiplist"
|
SKIPLIST="$MODPATH/tmp/skiplist"
|
||||||
XPOSED="$MODPATH/tmp/xposed"
|
XPOSED="$MODPATH/tmp/xposed"
|
||||||
|
|
||||||
|
|||||||
@@ -203,10 +203,9 @@ document.getElementById("aospkb").addEventListener("click", async () => aospkb()
|
|||||||
* Fetch encoded keybox and decode
|
* Fetch encoded keybox and decode
|
||||||
* @param {String} link - link to fetch
|
* @param {String} link - link to fetch
|
||||||
* @param {String} fallbackLink - fallback link
|
* @param {String} fallbackLink - fallback link
|
||||||
* @param {Boolean} valid - fetching valid kb or not, default = false
|
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
async function fetchkb(link, fallbackLink, valid = false) {
|
async function fetchkb(link, fallbackLink) {
|
||||||
fetch(link)
|
fetch(link)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
|
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
@@ -221,7 +220,7 @@ async function fetchkb(link, fallbackLink, valid = false) {
|
|||||||
})
|
})
|
||||||
.then(data => {
|
.then(data => {
|
||||||
if (!data.trim()) {
|
if (!data.trim()) {
|
||||||
showPrompt(valid ? "prompt.no_valid" : "prompt.key_set_error", false);
|
showPrompt("prompt.no_valid", false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@@ -230,7 +229,7 @@ async function fetchkb(link, fallbackLink, valid = false) {
|
|||||||
const source = atob(decodedHex);
|
const source = atob(decodedHex);
|
||||||
const result = setKeybox(source);
|
const result = setKeybox(source);
|
||||||
if (result) {
|
if (result) {
|
||||||
showPrompt(valid ? "prompt.valid_key_set" : "prompt.unknown_key_set");
|
showPrompt("prompt.valid_key_set");
|
||||||
} else {
|
} else {
|
||||||
throw new Error("Failed to copy valid keybox");
|
throw new Error("Failed to copy valid keybox");
|
||||||
}
|
}
|
||||||
@@ -256,8 +255,7 @@ document.getElementById("devicekb").addEventListener("click", async () => {
|
|||||||
document.getElementById("validkb").addEventListener("click", () => {
|
document.getElementById("validkb").addEventListener("click", () => {
|
||||||
fetchkb(
|
fetchkb(
|
||||||
"https://raw.githubusercontent.com/KOWX712/Tricky-Addon-Update-Target-List/main/.extra",
|
"https://raw.githubusercontent.com/KOWX712/Tricky-Addon-Update-Target-List/main/.extra",
|
||||||
"https://raw.gitmirror.com/KOWX712/Tricky-Addon-Update-Target-List/main/.extra",
|
"https://raw.gitmirror.com/KOWX712/Tricky-Addon-Update-Target-List/main/.extra"
|
||||||
true
|
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user