X-Git-Url: http://git.plutz.net/?p=invoices;a=blobdiff_plain;f=invoices.cgi;h=bec02be117a48964f1a14c5b2ddb17bd3f5973ab;hp=71ab2b1e79a6aa540ec0167c3648ba4e4e7b725e;hb=82b730d7926c9d7141639c1305beaab3f843918a;hpb=1d50621aa549b7a5c673a72de1dc74f368a5c58a diff --git a/invoices.cgi b/invoices.cgi index 71ab2b1..bec02be 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) @@ -70,8 +70,8 @@ case $info in ;; /invoices) . "$_EXEC/invoices.sh" - { list_invoices - printf '[a .new href="/invoices/%s" New]' "$(timeid)" + { printf '[a .new href="/invoices/%s" New]' "$(timeid)" + list_invoices } | yield_page invoices ;; /invoices/*)