forked from vendetta-mod/VendettaTweak
-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathbuild-local.sh
executable file
·143 lines (114 loc) · 3.42 KB
/
build-local.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/bin/bash
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
NC='\033[0m'
print_status() {
echo -e "${BLUE}[*]${NC} $1"
}
print_success() {
echo -e "${GREEN}[+]${NC} $1"
}
print_error() {
echo -e "${RED}[-]${NC} $1"
}
IPA_FILE=$(find . -maxdepth 1 -name "*.ipa" -print -quit)
if [ -z "$IPA_FILE" ]; then
print_status "No IPA found. Please enter Discord IPA URL:"
read DISCORD_URL
if [ -z "$DISCORD_URL" ]; then
print_error "No URL provided"
exit 1
fi
print_status "Downloading Discord IPA..."
curl -L -o discord.ipa "$DISCORD_URL"
if [ $? -ne 0 ]; then
print_error "Failed to download Discord IPA"
exit 1
fi
IPA_FILE="discord.ipa"
print_success "Downloaded Discord IPA"
fi
print_status "Building tweak..."
make package
if [ $? -ne 0 ]; then
print_error "Failed to build tweak"
exit 1
fi
print_success "Built tweak"
print_status "Downloading IPA icons..."
curl -L -o ipa-icons.zip https://raw.githubusercontent.com/pyoncord/assets/main/ipa-icons.zip
if [ $? -ne 0 ]; then
print_error "Failed to download IPA icons"
exit 1
fi
print_success "Downloaded IPA icons"
print_status "Downloading patcher..."
curl -L -o patcher https://github.com/amsyarasyiq/bunny-ipa-patcher/releases/download/release-pyon/patcher.mac-amd64
chmod +x patcher
if [ $? -ne 0 ]; then
print_error "Failed to download patcher"
exit 1
fi
print_success "Downloaded patcher"
print_status "Cloning Safari extension..."
rm -rf OpenInDiscord
git clone https://github.com/castdrian/OpenInDiscord
if [ $? -ne 0 ]; then
print_error "Failed to clone Safari extension"
exit 1
fi
print_success "Cloned Safari extension"
print_status "Building Safari extension..."
cd OpenInDiscord
xcodebuild build \
-target "OpenInDiscord Extension" \
-configuration Release \
-sdk iphoneos \
CONFIGURATION_BUILD_DIR="build" \
PRODUCT_NAME="OpenInDiscord" \
PRODUCT_BUNDLE_IDENTIFIER="com.hammerandchisel.discord.OpenInDiscord" \
PRODUCT_MODULE_NAME="OpenInDiscordExt" \
SKIP_INSTALL=NO \
DEVELOPMENT_TEAM="" \
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGNING_ALLOWED=NO \
ONLY_ACTIVE_ARCH=NO
cd ..
if [ $? -ne 0 ]; then
print_error "Failed to build Safari extension"
exit 1
fi
print_success "Built Safari extension"
print_status "Patching IPA..."
./patcher -d "$IPA_FILE" -o discord-patched.ipa -i ./ipa-icons.zip
if [ $? -ne 0 ]; then
print_error "Failed to patch IPA"
exit 1
fi
print_success "Patched IPA"
print_status "Setting up Python environment..."
python3 -m venv venv
source venv/bin/activate
pip install --force-reinstall https://github.com/asdfzxcvbn/pyzule-rw/archive/main.zip Pillow
if [ $? -ne 0 ]; then
print_error "Failed to install cyan"
exit 1
fi
print_success "Installed cyan"
NAME=$(grep '^Name:' control | cut -d ' ' -f 2)
PACKAGE=$(grep '^Package:' control | cut -d ' ' -f 2)
VERSION=$(grep '^Version:' control | cut -d ' ' -f 2)
DEB_FILE="packages/${PACKAGE}_${VERSION}_iphoneos-arm.deb"
print_status "Injecting tweak..."
cyan -duwsgq -i discord-patched.ipa -o "$NAME.ipa" -f "$DEB_FILE" OpenInDiscord/build/OpenInDiscord.appex
if [ $? -ne 0 ]; then
print_error "Failed to inject tweak"
exit 1
fi
deactivate
print_success "Successfully created $NAME.ipa"
print_status "Cleaning up..."
rm -f patcher ipa-icons.zip discord-patched.ipa
print_success "Successfully created $NAME.ipa"