diff --git a/src/Controller/ModuleController.php b/src/Controller/ModuleController.php index 3369861..992d52e 100644 --- a/src/Controller/ModuleController.php +++ b/src/Controller/ModuleController.php @@ -120,12 +120,43 @@ class ModuleController extends AbstractController } } + // Format quoted message + if (preg_match('/^[A-z0-9]{64}$/', $request->get('txid'))) + { + $message = str_replace( + [ + sprintf( + '@%s', + $request->get('txid') + ) + ], + false, + $request->get('message') + ); + + $message = trim( + $message + ); + + $message = sprintf( + '@%s%s%s', + $request->get('txid'), + PHP_EOL, + $request->get('message') + ); + } + + else + { + $message = $request->get('message'); + } + return $this->render( 'default/module/post.html.twig', [ 'enabled' => in_array($request->get('namespace'), $public), 'namespace' => $request->get('namespace'), - 'message' => $request->get('message'), + 'message' => $message, 'user' => $request->get('user'), 'ip' => $request->getClientIp() ] diff --git a/src/Controller/RoomController.php b/src/Controller/RoomController.php index c62e830..5ddb020 100644 --- a/src/Controller/RoomController.php +++ b/src/Controller/RoomController.php @@ -29,11 +29,16 @@ class RoomController extends AbstractController } #[Route( - '/room/{namespace}', + '/room/{namespace}/{txid}', name: 'room_namespace', requirements: [ 'namespace' => '^[A-z0-9]{34}$', + 'txid' => '^[A-z0-9]{64}$', + ], + defaults: + [ + 'txid' => null, ], methods: [ diff --git a/templates/default/module/room.html.twig b/templates/default/module/room.html.twig index 825d6b6..9c6d9b1 100644 --- a/templates/default/module/room.html.twig +++ b/templates/default/module/room.html.twig @@ -1,4 +1,4 @@ -
{% if list %} @@ -6,10 +6,10 @@ {% for namespace, name in list %} {% if i %}•{% endif %}{{ post.value }}