#!/usr/bin/env bash

if [[ $# -eq 0 ]]; then
    echo "Error: No arguments provided. Usage: $0 <file.zip>" >&2
    exit 1
fi

if [[ $# -gt 1 ]]; then
    echo "Error: Too many arguments. Usage: $0 <file.zip>" >&2
    exit 1
fi

FILE="$1"

if [[ "$FILE" != *.zip ]]; then
    echo "Error: '$FILE' does not have a .zip extension." >&2
    exit 1
fi

if [[ ! -f "$FILE" ]]; then
    echo "Error: File '$FILE' does not exist." >&2
    exit 1
fi

echo "OK: '$FILE' is a valid zip file."
curl -# -F "reqtype=fileupload" -F "time=72h" -F "fileToUpload=@$FILE" https://litterbox.catbox.moe/resources/internals/api.php
