new short expiring url for files

This commit is contained in:
2019-10-31 12:37:13 +02:00
parent 3195c87840
commit fbbef99305
6 changed files with 173 additions and 3 deletions

View File

@@ -15,6 +15,9 @@ _help() {
(c)opy Copy file/folder
(p)aste Paste file/folder (will overwrite)
url Get the direct share url
short Get a short share url. Add argument as days of expiration
Default: 14 days
short-del Delete short share url for a file.
upload Get URL for uploads [no arguments]
update Update flip client [no arguments]
self Get URL to install this client to another computer
@@ -194,6 +197,14 @@ _url() { # name
curl -L -s "$FLEES_ROOTURL/file/direct/$FLEES_SHARE/$FLEES_TOKEN/$1"
echo ''
}
_short() {
curl -L -s "$FLEES_ROOTURL/file/expiring/$FLEES_SHARE/$FLEES_TOKEN/$2/$1"
echo ''
}
_short_del() {
curl -L -s "$FLEES_ROOTURL/file/expiring_remove/$FLEES_SHARE/$FLEES_TOKEN/$1"
echo ''
}
_upload_url() {
echo "This information is a security risk, watch where it's shared"
echo "# python2 <( curl -L -s $FLEES_ROOTURL/script/upload_split/$FLEES_SHARE/$FLEES_TOKEN ) file_to_upload.ext"
@@ -283,6 +294,8 @@ CMD=list
[[ "$1" = "simplelist" ]] && { CMD=simple_list; ARG1=$CMD; }
[[ "$1" = "autocomplete" ]] && { _get_completer; }
[[ "$1" = "url" ]] && { CMD=url; ARG1=$CMD; }
[[ "$1" = "short" ]] && { CMD=short; ARG1=$CMD; }
[[ "$1" = "short-del" ]] && { CMD=short-del; ARG1=$CMD; }
[[ "$1" = "update" ]] && { _update_client; }
[[ "$1" = "upload" ]] && { _upload_url; }
[[ "$1" = "self" ]] && { _self_url; }
@@ -324,3 +337,15 @@ _get_file
_url "$NAME"
exit $?
}
[[ "$CMD" = short ]] && {
EXPIRY=14
if [ -n "$3" ]; then
EXPIRY="$3"
fi
_short "$NAME" $EXPIRY
exit $?
}
[[ "$CMD" = short-del ]] && {
_short_del "$NAME"
exit $?
}