diff --git a/.local/share/scripts/nc-create-share.sh b/.local/share/scripts/nc-create-share.sh deleted file mode 100755 index 6a8f89d..0000000 --- a/.local/share/scripts/nc-create-share.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env sh -set -e - -# get login cred and endpoint from config script -source $XDG_CONFIG_HOME/nextcloud.config.sh -# Exported vars from config script -#NC_ENDPOINT -#NC_USERNAME -#NC_PASSWORD - -# get input - -if test -n "$1"; then - REMOTE_PATH=$1 -elif test ! -t 0; then - read -r REMOTE_PATH -else - >&2 echo "Provide a remote file" - exit 1 -fi - -# make request -curl -u "$NC_USERNAME:$NC_PASSWORD" \ - -s \ - -H "OCS-APIRequest: true" \ - -d path="$REMOTE_PATH" \ - -d shareType=3 \ - -X POST \ - "https://$NC_ENDPOINT/ocs/v2.php/apps/files_sharing/api/v1/shares" \ - | perl -n -e'/(.+)<\/url>/ && print $1' diff --git a/.local/share/scripts/nc-share-file.sh b/.local/share/scripts/nc-share-file.sh deleted file mode 100755 index 89d002d..0000000 --- a/.local/share/scripts/nc-share-file.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env sh - -# requires rclone to be setup - -set -e - -SCRIPT=$(readlink -f "$0") -SCRIPTPATH=$(dirname "$SCRIPT") - -source $XDG_CONFIG_HOME/nextcloud.config.sh - -if test -n "$1"; then - FILE_PATH=$1 -elif test ! -t 0; then - read -r FILE_PATH -else - >&2 echo "Provide a file" - exit 1 -fi - -FILENAME=$(basename $FILE_PATH) - -rclone copy "$FILE_PATH" "$NC_RCLONE_REMOTE:/$NC_SHARE_DIR" - -$SCRIPTPATH/nc-create-share.sh "$NC_SHARE_DIR/$FILENAME" diff --git a/.local/share/scripts/nc-share-text.sh b/.local/share/scripts/nc-share-text.sh deleted file mode 100755 index 88485d6..0000000 --- a/.local/share/scripts/nc-share-text.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env sh - -set -e - -SCRIPT=$(readlink -f "$0") -SCRIPTPATH=$(dirname "$SCRIPT") - -source $XDG_CONFIG_HOME/nextcloud.config.sh - -if test -n "$1"; then - FILE_PATH=$1 -elif test ! -t 0; then - read -r FILE_PATH -else - >&2 echo "Provide a file" - exit 1 -fi - -$SCRIPTPATH/nc-share-file.sh "$FILE_PATH" \ - | perl -n -e '/([a-zA-Z0-9]+)$/ && print $1' \ - | awk -n -e '{print "https://pb.kapelle.org/"$1}' - diff --git a/.local/share/scripts/nc-share.sh b/.local/share/scripts/nc-share.sh deleted file mode 100755 index 9b417f9..0000000 --- a/.local/share/scripts/nc-share.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env sh - -set -e - -SCRIPT=$(readlink -f "$0") -SCRIPTPATH=$(dirname "$SCRIPT") - -if test -n "$1"; then - FILE_PATH=$1 -elif test ! -t 0; then - read -r FILE_PATH -else - >&2 echo "Provide a file" - exit 1 -fi - -if file -i -b "$FILE_PATH" | grep "text" &> /dev/null; then - $SCRIPTPATH/nc-share-text.sh "$FILE_PATH" -elif file -i -b "$FILE_PATH" | grep "image" &> /dev/null; then - $SCRIPTPATH/nc-share-file.sh "$FILE_PATH" | awk '{print $1"/preview"}' -else - $SCRIPTPATH/nc-share-file.sh "$FILE_PATH" -fi -