diff --git a/ci_bot.sh b/ci_bot.sh index 706f276..533ae05 100644 --- a/ci_bot.sh +++ b/ci_bot.sh @@ -147,7 +147,7 @@ send_sticker() { # --- Upload Function --- # Function to upload a file to PixelDrain -upload_file() { +upload_file_pd() { local file_path="$1" local response response=$(curl -s -T "$file_path" -u ":$CONFIG_PDUP_API" https://pixeldrain.com/api/file/) @@ -161,6 +161,18 @@ upload_file() { fi } +upload_file_gofile() { + FILE_UPLOAD_PATH="$1" + GOFILE_SERVER=$(curl -s https://api.gofile.io/servers | grep -oP '"name":"\K[^"]+' | head -n 1) + GOFILE_LINK=$(curl -F "file=@$FILE_UPLOAD_PATH" "https://${GOFILE_SERVER}.gofile.io/uploadFile" | grep -oP '"downloadPage":"\K[^"]+' | head -n 1) 2>&1 + + if [[ -n "$GOFILE_LINK" ]]; then + echo "$GOFILE_LINK" + else + echo "Upload failed" + fi +} + # --- Build Functions --- # Function to get build progress @@ -335,21 +347,31 @@ else echo -e "$BOLD_GREEN\nUploading build artifacts...$RESET" - zip_file_url=$(upload_file "$zip_file") + pd_file_url=$(upload_file_pd "$zip_file") + + if [[ "$CONFIG_GOFILE" == "true" ]]; then + gofile_file_url=$(upload_file_gofile "$zip_file") + fi + zip_file_md5sum=$(md5sum "$zip_file" | awk '{print $1}') zip_file_size=$(ls -sh "$zip_file" | awk '{print $1}') - json_file_url="" + if [[ -n "$json_file" ]]; then - json_file_url=$(upload_file "$json_file") + json_file_url=$(upload_file_pd "$json_file") fi details="• ROM: $ROM_NAME\n• DEVICE: $DEVICE\n• ANDROID VERSION: $ANDROID_VERSION\n• TYPE: $BUILD_TYPE\n• SIZE: $zip_file_size\n• MD5SUM: $zip_file_md5sum" if [[ -n "$json_file_url" && "$json_file_url" != "Upload failed" ]]; then details+="\n• JSON: Here" fi - if [[ -n "$zip_file_url" && "$zip_file_url" != "Upload failed" ]]; then - details+="\n• DOWNLOAD: Here" + if [[ -n "$pd_file_url" && "$pd_file_url" != "Upload failed" ]]; then + details+="\n• PIXELDRAIN: Here" + fi + if [[ "$CONFIG_GOFILE" == "true" ]]; then + if [[ -n "$gofile_file_url" && "$gofile_file_url" != "Upload failed" ]]; then + details+="\n• GOFILE: Here" + fi fi build_finished_message=$(generate_telegram_message "🟢" "ROM compiled successfully!" "$details" "Compilation took $build_duration.") @@ -361,4 +383,4 @@ fi if [[ "$POWEROFF" == "true" ]]; then echo -e "$BOLD_GREEN\nPowering off server...$RESET" sudo poweroff -fi \ No newline at end of file +fi diff --git a/config.env.example b/config.env.example index 5526cae..7290560 100644 --- a/config.env.example +++ b/config.env.example @@ -11,5 +11,8 @@ CONFIG_ERROR_CHATID="" # Optional: If not set, errors are sent to CONFIG_CHATID # PixelDrain API Key CONFIG_PDUP_API="" +# Enable Gofile upload +CONFIG_GOFILE="true" + # Power off after build -POWEROFF="false" \ No newline at end of file +POWEROFF="false"