:-'Generic Commit'

This commit is contained in:
Your Name
2025-05-30 00:00:19 +12:00
parent 5d00b31bbb
commit ba306611a6
2 changed files with 16 additions and 6 deletions

18
sos/sos
View File

@ -32,6 +32,10 @@ function die() {
exit 1
}
function datetime() {
date -u +"%Y.%m%d.%H%M"
}
function upload() {
if [ "$#" -ne 3 ]; then
@ -57,7 +61,8 @@ function upload() {
METADATA_JSON=$(cat <<EOF
{
"labeltags": ["$label"],
"description": "Uploaded by sos"
"description": "Uploaded by sos",
"version": "$(datetime)"
}
EOF
)
@ -70,14 +75,19 @@ EOF
HASH=""
UPLOAD_RESPONSE=$(curl -s -X PUT \
curl --progress-bar -X PUT \
-H "Authorization: Bearer ${WRITE_TOKEN}" \
-F "file=@${file}" \
-F "metadata=${METADATA_JSON}" \
"$TARGET_URL" \
) || die "Failed to upload $file to $TARGET_URL"
|| die "Failed to upload $file to $TARGET_URL"
echo " "
echo " "
JSON1=$(eval "curl -s \"https://$server/hash/$label\"")
HASH=$(echo "$JSON1" | jq -r '.hash')
HASH=$(echo "$UPLOAD_RESPONSE" | jq -r '.hash')
JSON2=$(eval "curl -s \"https://$server/meta/$HASH\"") || die "Failed to get meta for $HASH"
FILENAME=$(echo "$JSON2" | jq -r '.metadata.filename')