From 9e8b287ea863d4650a16126202d365b757af0676 Mon Sep 17 00:00:00 2001 From: Jakub Czajka Date: Wed, 22 Nov 2023 00:31:48 +0100 Subject: [PATCH] Wrap `list` to return HTTP responses. --- gdrive_proxy.sh | 75 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100755 gdrive_proxy.sh diff --git a/gdrive_proxy.sh b/gdrive_proxy.sh new file mode 100755 index 0000000..031e6d3 --- /dev/null +++ b/gdrive_proxy.sh @@ -0,0 +1,75 @@ +#!/bin/sh +# Copyright (c) 2023 Jakub Czajka +# License: GPL-3.0 or later. + +. /etc/environment + +# Kill authentication server if already present. +[ ! -z $(pgrep --full ".*gdrive_knife.*") ] && pkill --full ".*gdrive_knife.*" + +. ./auth.sh || exit 0 + +FILES=$(python3 -u -m gdrive_knife 2>&1 list --token ${gdrive_auth_token}) + +format_files() { + echo ${FILES} | xargs --replace={} --delimiter=" " echo "${1}" +} + +echo "HTTP/1.1 200 OK" +echo "Content-type: text/html" +echo " + + + + GdriveProxy + + + +
+

Upload

+
+ + + +
+ +
+ +

Download

+
+ + +
+ +
+ +

Delete

+
+ + +
+
+ +" -- 2.39.5