#!/bin/sh
# Copyright (C) 2021-2022 Tianling Shen <cnsztl@immortalwrt.org>

command -v "curl" >"/dev/null" || { echo -e "curl is not found."; exit 1; }

mkdir -p "/tmp"
/usr/share/unblockneteasemusic/debugging.sh 2>&1 | tee "/tmp/unm-debugging-output.txt"

catbox_link="$(curl -fsS -F "reqtype=fileupload" -F "time=72h" -F "fileToUpload=@/tmp/unm-debugging-output.txt" "https://litterbox.catbox.moe/resources/internals/api.php")"
transfer_link="$(curl -fsS --upload-file "/tmp/unm-debugging-output.txt" "https://transfer.sh/unm-debugging-output.txt")"
echo -e "\n"
echo -e "Log is available at:"
echo -e "$catbox_link"
echo -e "$transfer_link"

rm -f "/tmp/unm-debugging-output.txt"
