Browse Source

implement transaction key/value download

master
ghost 9 months ago
parent
commit
b38db16386
  1. 55
      src/Controller/MainController.php

55
src/Controller/MainController.php

@ -139,6 +139,60 @@ class MainController extends AbstractController
{ {
if ($record['transaction'] === $request->get('transaction')) if ($record['transaction'] === $request->get('transaction'))
{ {
switch ($request->get('get'))
{
case 'key':
$response = new Response();
$response->headers->set(
'Content-length',
strlen(
$record['key']
)
);
$response->headers->set(
'Content-Disposition',
sprintf(
'attachment; filename="%s.key";',
$request->get('transaction')
)
);
$response->sendHeaders();
return $response->setContent(
$record['key']
);
case 'value':
$response = new Response();
$response->headers->set(
'Content-length',
strlen(
$record['value']
)
);
$response->headers->set(
'Content-Disposition',
sprintf(
'attachment; filename="%s.value";',
$request->get('transaction')
)
);
$response->sendHeaders();
return $response->setContent(
$record['value']
);
default:
return $this->render( return $this->render(
'default/main/transaction.html.twig', 'default/main/transaction.html.twig',
[ [
@ -148,6 +202,7 @@ class MainController extends AbstractController
); );
} }
} }
}
throw $this->createNotFoundException(); throw $this->createNotFoundException();
} }

Loading…
Cancel
Save