From b64281b1ac07fa1d1a9ad81c7f092ecd99f11839 Mon Sep 17 00:00:00 2001 From: Max Leiter Date: Sun, 26 Feb 2023 01:21:08 -0800 Subject: [PATCH] Slight shell script improvements --- tools/upload.sh | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/tools/upload.sh b/tools/upload.sh index 9bc3142c..44226af9 100755 --- a/tools/upload.sh +++ b/tools/upload.sh @@ -1,9 +1,15 @@ #!/bin/bash -url="http://localhost:3000" -# Generated at /settings + +# usage +# ./upload.sh -t "title" -v "visibility" -p "password" file1 file2 file3 + +url="https://drift.lol" + +# Generate one at /settings (don't worry, this ones been revoked) TOKEN="" -set -e # Exit on error +# Exit on error +set -e visibility="unlisted" title="Untitled" @@ -38,13 +44,8 @@ while getopts ":t:d:v:p:" opt; do done shift $((OPTIND - 1)) -# Set the API endpoint URL -# {"id":"clel2nl7b0003p0scejnggjar","title":"test","visibility":"unlisted","password":"","createdAt":"2023-02-26T07:30:48.215Z","updatedAt":"2023-02-26T07:30:48.215Z","deletedAt":null,"expiresAt":null,"parentId":null,"description":"","authorId":"clc4babr80000p0gasef3i5ij"}⏎ -# Set the bearer token - header="Authorization: Bearer $TOKEN" -# Set the JSON payload json=$( cat <