X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=invoices.cgi;h=464d2849ed44d9d4a4247301f0adbd1101a0ed00;hb=53de77e6d3528e016290821c5d1186788cf361e3;hp=261395f9b417dbc1267de36db383959771c31418;hpb=864a9aad6a2d6ede85c0c3ad6312573f9a0804eb;p=invoices diff --git a/invoices.cgi b/invoices.cgi index 261395f..464d284 100755 --- a/invoices.cgi +++ b/invoices.cgi @@ -24,16 +24,16 @@ printf 'Content-Type: text/html; charset=utf-8\r\n\r\n' EOF } -tid(){ - # transaction ID to modify a given file - local file="$1" - { stat -c %F%i%n%N%s%Y "$file" 2>&- - printf %s "$SESSION_ID" - server_key - } | sha256sum | cut -d\ -f1 -} +info="$(PATH "${PATH_INFO#http://*/}")" -info="$(PATH "${PATH_INFO}")" +which git && [ ! -d .git ] && { + git init + mkdir -p clients/ invoices/ senders/ + printf 'export/ +serverkey' >.gitignore + git add clients/ invoices/ senders/ .gitignore + git commit -m 'initialisation of invoice repo' +} >&2 case $info in /invoices.css) @@ -82,9 +82,10 @@ case $info in . "$_EXEC/invoices.sh" update_invoice ;; - /export/*.pdf) + /export/*.pdf/*) . "$_EXEC/cgilite/file.sh" - FILE "${info#/}" application/pdf + file="${info%/*}" + FILE "${file#/}" application/pdf ;; *) REDIRECT /invoices ;;