Browse Source

implement transaction key/value download

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

69
src/Controller/MainController.php

@ -139,13 +139,68 @@ class MainController extends AbstractController
{ {
if ($record['transaction'] === $request->get('transaction')) if ($record['transaction'] === $request->get('transaction'))
{ {
return $this->render( switch ($request->get('get'))
'default/main/transaction.html.twig', {
[ case 'key':
'request' => $request,
'record' => $record $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(
'default/main/transaction.html.twig',
[
'request' => $request,
'record' => $record
]
);
}
} }
} }

Loading…
Cancel
Save