From: Metabox Date: Tue, 6 Aug 2019 02:46:18 +0000 (+1000) Subject: Wrapping now json response to be LifeLog specific. X-Git-Url: https://lifelog.hopto.org/gitweb/?a=commitdiff_plain;h=9cec6a2bc8413dacd258f0e2fb0b261eaa1a03b8;p=LifeLog.git Wrapping now json response to be LifeLog specific. --- diff --git a/htdocs/cgi-bin/json.cgi b/htdocs/cgi-bin/json.cgi index 72df8c8..9675152 100755 --- a/htdocs/cgi-bin/json.cgi +++ b/htdocs/cgi-bin/json.cgi @@ -51,6 +51,7 @@ my $password = $session->param('passw'); my $action = $cgi->param('action'); my $lid = $cgi->param('id'); my $doc = $cgi->param('doc'); +my $bg = $cgi->param('bg'); my $error = ""; my ($response, $json) = 'Session Expired'; @@ -103,17 +104,16 @@ exit; sub defaultJSON(){ - my $content = $response; + my $content = ""; if($action eq 'load' && !$error){ - $content = JSON->new->utf8->allow_nonref->decode($response); - $response = "Loaded Document!"; + $content = JSON->new->utf8->decode($doc); } $json = JSON->new->utf8->space_after->pretty->allow_blessed->encode ({date => $strp->format_datetime($today), response_origin => "LifeLog.".$RELEASE_VER, alias => $userid, log_id => $lid, database=>$database, action => $action, error=>$error, - response=>$response, - content=>$content, + response=>$response, + content=>$content #received => $doc }); } @@ -125,8 +125,13 @@ sub processSubmit { try { if($action eq 'store'){ - - my $zip = compress($doc,Z_BEST_COMPRESSION); + +$doc = qq({ +"lid":"$lid", +"bg":"$bg", +"doc":$doc +}); + my $zip = compress($doc, Z_BEST_COMPRESSION); $st = $db->prepare("SELECT LID FROM NOTES WHERE LID = '$lid';"); $st -> execute(); if($st->fetchrow_array() eq undef) { @@ -151,7 +156,12 @@ sub processSubmit { @arr = $st->fetchrow_array(); } $doc = $arr[0]; - $response = uncompress($doc); + $doc = uncompress($doc); + # print $cgi->header( -expires => "+0s", -charset => "UTF-8" ); + # print($doc); + # exit; + $response = "Loaded Document!"; + } else{ $error = "Your action ($action) sux's a lot!";