Skip to content

Commit 485782c

Browse files
authored
Merge pull request #1 from itsaschoolbus/master
Add support for Gofile
2 parents a82817e + fa16d80 commit 485782c

2 files changed

Lines changed: 33 additions & 8 deletions

File tree

ci_bot.sh

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ send_sticker() {
147147
# --- Upload Function ---
148148

149149
# Function to upload a file to PixelDrain
150-
upload_file() {
150+
upload_file_pd() {
151151
local file_path="$1"
152152
local response
153153
response=$(curl -s -T "$file_path" -u ":$CONFIG_PDUP_API" https://pixeldrain.com/api/file/)
@@ -161,6 +161,18 @@ upload_file() {
161161
fi
162162
}
163163

164+
upload_file_gofile() {
165+
FILE_UPLOAD_PATH="$1"
166+
GOFILE_SERVER=$(curl -s https://api.gofile.io/servers | grep -oP '"name":"\K[^"]+' | head -n 1)
167+
GOFILE_LINK=$(curl -F "file=@$FILE_UPLOAD_PATH" "https://${GOFILE_SERVER}.gofile.io/uploadFile" | grep -oP '"downloadPage":"\K[^"]+' | head -n 1) 2>&1
168+
169+
if [[ -n "$GOFILE_LINK" ]]; then
170+
echo "$GOFILE_LINK"
171+
else
172+
echo "Upload failed"
173+
fi
174+
}
175+
164176
# --- Build Functions ---
165177

166178
# Function to get build progress
@@ -335,21 +347,31 @@ else
335347

336348
echo -e "$BOLD_GREEN\nUploading build artifacts...$RESET"
337349

338-
zip_file_url=$(upload_file "$zip_file")
350+
pd_file_url=$(upload_file_pd "$zip_file")
351+
352+
if [[ "$CONFIG_GOFILE" == "true" ]]; then
353+
gofile_file_url=$(upload_file_gofile "$zip_file")
354+
fi
355+
339356
zip_file_md5sum=$(md5sum "$zip_file" | awk '{print $1}')
340357
zip_file_size=$(ls -sh "$zip_file" | awk '{print $1}')
341-
342358
json_file_url=""
359+
343360
if [[ -n "$json_file" ]]; then
344-
json_file_url=$(upload_file "$json_file")
361+
json_file_url=$(upload_file_pd "$json_file")
345362
fi
346363

347364
details="<b>• ROM:</b> <code>$ROM_NAME</code>\n<b>• DEVICE:</b> <code>$DEVICE</code>\n<b>• ANDROID VERSION:</b> <code>$ANDROID_VERSION</code>\n<b>• TYPE:</b> <code>$BUILD_TYPE</code>\n<b>• SIZE:</b> <code>$zip_file_size</code>\n<b>• MD5SUM:</b> <code>$zip_file_md5sum</code>"
348365
if [[ -n "$json_file_url" && "$json_file_url" != "Upload failed" ]]; then
349366
details+="\n<b>• JSON:</b> <a href=\"$json_file_url\">Here</a>"
350367
fi
351-
if [[ -n "$zip_file_url" && "$zip_file_url" != "Upload failed" ]]; then
352-
details+="\n<b>• DOWNLOAD:</b> <a href=\"$zip_file_url\">Here</a>"
368+
if [[ -n "$pd_file_url" && "$pd_file_url" != "Upload failed" ]]; then
369+
details+="\n<b>• PIXELDRAIN:</b> <a href=\"$pd_file_url\">Here</a>"
370+
fi
371+
if [[ "$CONFIG_GOFILE" == "true" ]]; then
372+
if [[ -n "$gofile_file_url" && "$gofile_file_url" != "Upload failed" ]]; then
373+
details+="\n<b>• GOFILE:</b> <a href=\"$gofile_file_url\">Here</a>"
374+
fi
353375
fi
354376

355377
build_finished_message=$(generate_telegram_message "🟢" "ROM compiled successfully!" "$details" "Compilation took $build_duration.")
@@ -361,4 +383,4 @@ fi
361383
if [[ "$POWEROFF" == "true" ]]; then
362384
echo -e "$BOLD_GREEN\nPowering off server...$RESET"
363385
sudo poweroff
364-
fi
386+
fi

config.env.example

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@ CONFIG_ERROR_CHATID="" # Optional: If not set, errors are sent to CONFIG_CHATID
1111
# PixelDrain API Key
1212
CONFIG_PDUP_API=""
1313

14+
# Enable Gofile upload
15+
CONFIG_GOFILE="true"
16+
1417
# Power off after build
15-
POWEROFF="false"
18+
POWEROFF="false"

0 commit comments

Comments
 (0)