]> git.plutz.net Git - invoices/commitdiff
allow use in fake proxy, replace tid function with new equivalent from library
authorPaul Hänsch <paul@plutz.net>
Thu, 30 May 2019 12:07:33 +0000 (14:07 +0200)
committerPaul Hänsch <paul@plutz.net>
Thu, 30 May 2019 12:07:33 +0000 (14:07 +0200)
cgilite
clients.sh
invoices.cgi
invoices.sh
senders.sh

diff --git a/cgilite b/cgilite
index 2638ffcf8dc901606f3cdb249fab75e14ca47875..506e2f9f146c13919e65a9bbbd844391b96bbe9d 160000 (submodule)
--- a/cgilite
+++ b/cgilite
@@ -1 +1 @@
-Subproject commit 2638ffcf8dc901606f3cdb249fab75e14ca47875
+Subproject commit 506e2f9f146c13919e65a9bbbd844391b96bbe9d
index 8e6713c4bf5c4753dcb7768d0a21fa5356a81481..052a0c84c897f82a38bbe4b82ad7b86f285442be 100755 (executable)
@@ -19,7 +19,7 @@ edit_client(){
     "$(HTML $id)" \
     "$(UNSTRING "${address#address=}" |HTML)" \
     "$(UNSTRING "${hourly#hourly=}" |grep -xE '[0-9]+')" \
-    "$(tid "clients/$id")"
+    "$(transid "clients/$id")"
 }
 
 list_clients(){
@@ -40,7 +40,7 @@ list_clients(){
 
 update_client(){
   local id="$(POST id |checkid)"
-  if [ "$(POST update)" = "$(tid "clients/$id")" ]; then
+  if [ "$(POST update)" = "$(transid "clients/$id")" ]; then
     mkdir -p clients
     printf 'address=%s hourly=%s' \
       "$(POST address |STRING)" "$(POST hourly |STRING)" \
index 76d989a0dffbee3c28ebb490dafcdba04c15d8c3..464d2849ed44d9d4a4247301f0adbd1101a0ed00 100755 (executable)
@@ -24,16 +24,7 @@ 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}")"
+info="$(PATH "${PATH_INFO#http://*/}")"
 
 which git && [ ! -d .git ] && {
   git init
index c21fe4fe3b597c8cf42b31ca570d1813ea653498..b97c6e79db6c5c9ba8a1a0dd10dd3ec054fae3ff 100755 (executable)
@@ -95,7 +95,7 @@ edit_invoice(){
   && hourly="${hourly#hourly=}" \
   || hourly="${chourly}"
 
-  tid="$(tid "invoices/$id")"
+  tid="$(transid "invoices/$id")"
 
   read -r taxtype nett tax gross x<<-EOF
        $(invoice_total "$id")
@@ -215,7 +215,7 @@ invoice_total(){
 
 update_invoice(){
   local id="$(POST id |checkid)" extra=0 tid
-  tid="$(tid invoices/$id)"
+  tid="$(transid invoices/$id)"
 
   if [ "$(POST update)" = "$tid" ] || [ "$(POST genpdf)" = "$tid" ]; then
     mkdir -p invoices
index a4ff71f171ed3e1bd05f49956eaa7f37ca61a925..757ce22e1aeaa55a54c3374525ce2e1eb60787ac 100755 (executable)
@@ -30,7 +30,7 @@ xxx / 000 / ###
     ]' \
     "$(HTML $id)" "$(HTML "${address}")" \
     "$(HTML "${iban}")" "$(HTML "${bic}")" \
-    "$(tid "senders/$id")"
+    "$(transid "senders/$id")"
 }
 
 list_senders(){
@@ -49,7 +49,7 @@ list_senders(){
 
 update_sender(){
   id="$(POST id |checkid)"
-  if [ "$(POST update)" = "$(tid "senders/$id")" ]; then
+  if [ "$(POST update)" = "$(transid "senders/$id")" ]; then
     mkdir -p senders
     printf 'address=%s iban=%s bic=%s\n' \
     $(POST address |STRING) $(POST iban |STRING) \