diff options
author | epoch <epoch@hacking.allowed.org> | 2020-11-15 19:11:16 -0600 |
---|---|---|
committer | epoch <epoch@hacking.allowed.org> | 2020-11-15 19:11:16 -0600 |
commit | 4f9509b7fe0e345f5d8fa7540adba45b1a363f81 (patch) | |
tree | 1c914753fc1f41debbe4ebc666dc521484fdd5f1 /data_handler | |
parent | 29ec2d6b6dccab65335be8bf203f0f139d876f97 (diff) | |
download | uritools-4f9509b7fe0e345f5d8fa7540adba45b1a363f81.tar.gz uritools-4f9509b7fe0e345f5d8fa7540adba45b1a363f81.zip |
added unshorten.sh which attempts to unshorten shortened URLs. and data_handler... no comment.
Diffstat (limited to 'data_handler')
-rwxr-xr-x | data_handler | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/data_handler b/data_handler new file mode 100755 index 0000000..b3936be --- /dev/null +++ b/data_handler @@ -0,0 +1,17 @@ +#!/bin/sh +hash="$(printf "$1" | sha256sum | cut '-d ' -f1)" +mime_data="$(printf "%s\n" "$1" | cut -d, -f1)" +data="$(printf "%s\n" "$1" | cut -d, -f2-)" +#echo $mime_data +is_base64="$(printf "%s\n" "$mime_data" | tr ';' '\n' | grep '^base64$')" +media_type="$(printf "%s\n" "$mime_data" | tr ';' '\n' | head -n1)" +### what are we going to do with this file? +mkdir -p ~/.local/var/cache/data +printf "%s\n" "$data" \ + | if [ "$is_base64" ];then + base64 -d + else + uriunescape + fi \ + > ~/.local/var/cache/data/$hash +uristart "file:///home/epoch/.local/var/cache/data/$hash?mime-type=$media_type" |