From: Jakub Czajka Date: Tue, 21 Nov 2023 23:30:33 +0000 (+0100) Subject: Wrap `download` to return HTTP responses. X-Git-Url: https://git.ekhem.eu.org/?a=commitdiff_plain;h=b36633e6de9279172d1d3d3e2485d03710d8c89f;p=gdrive_proxy.git Wrap `download` to return HTTP responses. --- diff --git a/download.sh b/download.sh new file mode 100755 index 0000000..2cc5bf9 --- /dev/null +++ b/download.sh @@ -0,0 +1,29 @@ +#!/bin/sh +# Copyright (c) 2023 Jakub Czajka +# License: GPL-3.0 or later. + +. /etc/environment + +# Replace %2F with '/' and remove %0D%0A. +NAME=$(echo ${NAME_ON_DRIVE} | sed 's/%2F/\//g; s/%0D%0A//g') + +echo "HTTP/1.1 200 OK" +echo "Content-Type: text/html" +echo " + + + + + + +" +echo "Downloading ${NAME}" +python3 -u -m gdrive_knife 2>&1 download --token ${gdrive_auth_token} \ + --key ${gdrive_encryption_key} --leave-as-archive ${NAME} /tmp +echo "\ + +"