Skip to content

Commit 7969a9a

Browse files
committed
function for appledb requests, add run uicache option
should also help fix #866
1 parent 5992ef0 commit 7969a9a

File tree

2 files changed

+60
-37
lines changed

2 files changed

+60
-37
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
run: cp -R ./exclude/bin/* ./bin
7676

7777
- name: Zip complete files
78-
run: zip -r ${{ github.event.repository.name }}_complete_v${{ env.DATE }}.${{ env.COUNT }}.zip bin/ LICENSE resources/ restore.cmd restore.sh README.md saved/
78+
run: zip -r ${{ github.event.repository.name }}_complete_v${{ env.DATE }}.${{ env.COUNT }}.zip bin/ LICENSE resources/ restore.sh README.md saved/
7979

8080
- name: Create this file to get latest git hash
8181
run: |

restore.sh

Lines changed: 59 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -971,9 +971,7 @@ device_get_name() {
971971
esac
972972
if [[ -z $device_name && -n $device_type ]]; then
973973
log "Getting device name"
974-
rm -f tmp.json
975-
$aria2c "https://raw.githubusercontent.com/littlebyteorg/appledb/refs/heads/gh-pages/device/$device_type.json" -o tmp.json
976-
[[ $? != 0 ]] && $curl -L "https://raw.githubusercontent.com/littlebyteorg/appledb/refs/heads/gh-pages/device/$device_type.json" -o tmp.json
974+
download_appledb "device/$device_type"
977975
device_name="$(cat tmp.json | $jq -r ".name")"
978976
fi
979977
}
@@ -2267,7 +2265,7 @@ device_fw_key_check() {
22672265

22682266
if [[ ! -e "$keys_path/index.html" ]]; then
22692267
mkdir -p "$keys_path" 2>/dev/null
2270-
local try=("https://github.com/LukeZGD/Legacy-iOS-Kit-Keys/raw/master/$device_type/$build/index.html"
2268+
local try=("https://raw.githubusercontent.com/LukeZGD/Legacy-iOS-Kit-Keys/master/$device_type/$build/index.html"
22712269
"http://127.0.0.1:8888/firmware/$device_type/$build"
22722270
"https://api.m1sta.xyz/wikiproxy/$device_type/$build")
22732271
for i in "${try[@]}"; do
@@ -2315,20 +2313,7 @@ ipsw_get_url() {
23152313
fi
23162314
if [[ -z $url ]]; then
23172315
log "Getting URL for $device_type-$build_id"
2318-
local phone="OS" # iOS
2319-
case $build_id in
2320-
[23][0123456789]* | 7B405 | 7B500 ) :;;
2321-
1[AC]* | [2345]* ) phone="Phone%20Software";; # iPhone Software
2322-
7* ) phone="Phone%20OS";; # iPhone OS
2323-
esac
2324-
if [[ $device_type == "iPad"* ]]; then
2325-
case $build_id in
2326-
1[789]* | [23]* ) phone="PadOS";; # iPadOS
2327-
esac
2328-
fi
2329-
rm -f tmp.json
2330-
$aria2c "https://raw.githubusercontent.com/littlebyteorg/appledb/refs/heads/gh-pages/ios/i${phone};$build_id.json" -o tmp.json
2331-
[[ $? != 0 ]] && $curl -L "https://raw.githubusercontent.com/littlebyteorg/appledb/refs/heads/gh-pages/ios/i${phone};$build_id.json" -o tmp.json
2316+
download_appledb ios $build_id
23322317
url="$(cat tmp.json | $jq -r ".sources[] | select(.type == \"ipsw\" and any(.deviceMap[]; . == \"$device_type\")) | .links[0].url")"
23332318
local url2="$(echo "$url" | tr '[:upper:]' '[:lower:]')"
23342319
local build_id2="$(echo "$build_id" | tr '[:upper:]' '[:lower:]')"
@@ -2350,6 +2335,38 @@ ipsw_get_url() {
23502335
ipsw_url="$url"
23512336
}
23522337

2338+
download_appledb() {
2339+
local query="$1"
2340+
if [[ $query == "ios" ]]; then
2341+
local phone="iOS" # iOS
2342+
local build_id="$2"
2343+
case $build_id in
2344+
[23][0123456789]* | 7B405 | 7B500 ) :;;
2345+
1[AC]* | [2345]* ) phone="iPhone%20Software";; # iPhone Software
2346+
7* ) phone="iPhone%20OS";; # iPhone OS
2347+
esac
2348+
if [[ $device_type == "iPad"* ]]; then
2349+
case $build_id in
2350+
1[789]* | [23]* ) phone="iPadOS";; # iPadOS
2351+
esac
2352+
fi
2353+
query="ios/${phone};${build_id}"
2354+
fi
2355+
2356+
local try=("https://api.appledb.dev/${query}.json"
2357+
"https://raw.githubusercontent.com/littlebyteorg/appledb/gh-pages/${query}.json")
2358+
for request in "${try[@]}"; do
2359+
rm -f tmp.json
2360+
log "AppleDB request: $request"
2361+
$aria2c "$request" -o tmp.json
2362+
[[ $? != 0 ]] && $curl -L "$request" -o tmp.json
2363+
[[ -s tmp.json ]] && break
2364+
done
2365+
if [[ ! -s tmp.json ]]; then
2366+
error "Failed to get AppleDB request. Please run the script again"
2367+
fi
2368+
}
2369+
23532370
download_comp() {
23542371
# usage: download_comp [build_id] [comp]
23552372
local build_id="$1"
@@ -2761,20 +2778,7 @@ ipsw_verify() {
27612778
fi
27622779

27632780
log "Getting SHA1 hash from AppleDB..."
2764-
local phone="OS" # iOS
2765-
case $build_id in
2766-
[23][0123456789]* | 7B405 | 7B500 ) :;;
2767-
1[AC]* | [2345]* ) phone="Phone%20Software";; # iPhone Software
2768-
7* ) phone="Phone%20OS";; # iPhone OS
2769-
esac
2770-
if [[ $device_type == "iPad"* ]]; then
2771-
case $build_id in
2772-
1[789]* | [23]* ) phone="PadOS";; # iPadOS
2773-
esac
2774-
fi
2775-
rm -f tmp.json
2776-
$aria2c "https://raw.githubusercontent.com/littlebyteorg/appledb/refs/heads/gh-pages/ios/i${phone};$build_id.json" -o tmp.json
2777-
[[ $? != 0 ]] && $curl -L "https://raw.githubusercontent.com/littlebyteorg/appledb/refs/heads/gh-pages/ios/i${phone};$build_id.json" -o tmp.json
2781+
download_appledb ios $build_id
27782782
IPSWSHA1="$(cat tmp.json | $jq -r ".sources[] | select(.type == \"ipsw\" and any(.deviceMap[]; . == \"$device_type\")) | .hashes.sha1")"
27792783
mkdir -p $device_fw_dir/$build_id 2>/dev/null
27802784

@@ -5839,7 +5843,7 @@ device_ramdisk64() {
58395843
fi
58405844
if [[ ! -e $sshtar.gz ]]; then
58415845
log "Downloading ssh.tar from SSHRD_Script..."
5842-
file_download https://github.com/LukeZGD/sshtars/raw/eed9dcb6aa7562c185eb8b3b66c6035c0b026d47/ssh.tar.gz ssh.tar.gz
5846+
file_download https://raw.githubusercontent.com/LukeZGD/sshtars/eed9dcb6aa7562c185eb8b3b66c6035c0b026d47/ssh.tar.gz ssh.tar.gz
58435847
mv ssh.tar.gz $sshtar.gz
58445848
fi
58455849
cp $sshtar.gz ssh.tar.gz
@@ -9193,7 +9197,7 @@ menu_usefulutilities() {
91939197
if (( device_proc <= 10 )) && [[ $device_latest_vers != "16"* && $device_checkm8ipad != 1 ]]; then
91949198
menu_items+=("SSH Ramdisk")
91959199
fi
9196-
menu_items+=("Update DateTime" "DFU Mode Helper")
9200+
menu_items+=("Run uicache" "Update DateTime" "DFU Mode Helper")
91979201
menu_items+=("Go Back")
91989202
menu_print_info
91999203
# other utilities menu
@@ -9222,6 +9226,16 @@ menu_usefulutilities() {
92229226
"Just Boot" ) menu_justboot;;
92239227
"Update DateTime" ) device_update_datetime;;
92249228
"DFU Mode Helper" ) mode="device_dfuhelper";;
9229+
"Run uicache" )
9230+
print "* This will run the uicache command via SSH to help fix missing jailbreak app icons."
9231+
print "* In order for this to work, OpenSSH must be installed on your device."
9232+
print "* If your device is restored/jailbroken with Legacy iOS Kit, OpenSSH is already installed."
9233+
select_yesno
9234+
if [[ $? != 1 ]]; then
9235+
continue
9236+
fi
9237+
mode="device_uicache"
9238+
;;
92259239
"Go Back" ) back=1;;
92269240
esac
92279241
done
@@ -10325,8 +10339,7 @@ device_fourthree_app() {
1032510339
log "Installing FourThree app"
1032610340
$scp -P $ssh_port $jelbrek/fourthree.tar root@127.0.0.1:/tmp
1032710341
$ssh -p $ssh_port root@127.0.0.1 "tar -h -xvf /tmp/fourthree.tar -C /; cd /Applications/FourThree.app; chmod 6755 boot.sh FourThree kloader_ios5 /usr/bin/runasroot"
10328-
log "Running uicache"
10329-
$ssh -p $ssh_port mobile@127.0.0.1 "uicache"
10342+
device_uicache $1
1033010343
}
1033110344

1033210345
device_fourthree_boot() {
@@ -10378,6 +10391,16 @@ device_fourthree_check() {
1037810391
return 0
1037910392
}
1038010393

10394+
device_uicache() {
10395+
if [[ $1 != "install" ]]; then
10396+
device_iproxy
10397+
print "* The default root password is: alpine"
10398+
device_sshpass
10399+
fi
10400+
log "Running uicache"
10401+
$ssh -p $ssh_port mobile@127.0.0.1 "uicache"
10402+
}
10403+
1038110404
device_backup_create() {
1038210405
print "* A backup of your device will be created. Please see the notes above."
1038310406
pause

0 commit comments

Comments
 (0)