Compare commits

...

5 Commits

Author SHA1 Message Date
a8289ceadc add logs 2025-02-13 19:26:08 +03:00
d8f693651d kek 2025-02-13 18:32:17 +03:00
4ae36306aa )) 2025-02-13 18:25:14 +03:00
0a94936389 aaaa 2025-02-13 18:23:49 +03:00
ac7e8d846b sosi2 2025-02-13 16:38:39 +03:00
6 changed files with 65 additions and 9 deletions

13
.env
View File

@@ -0,0 +1,13 @@
APP_ENV=dev
APP_SECRET=1b2b121bb212b12
SERVER_NAME=:80
#forum.lisoveliy.su
HTTP_PORT=12000
HTTPS_PORT=12001
HTTP3_PORT=12002
DATABASE_URL=postgresql://app:app@database:5432/app?serverVersion=16&charset=utf8
MERCURE_URL=https://forum.lisoveliy.su/.well-known/mercure
MERCURE_PUBLIC_URL=https://forum.lisoveliy.su/.well-known/mercure
MERCURE_JWT_SECRET="!ChangeThisMercureHubJWTSecretKey!"
CADDY_MERCURE_JWT_SECRET="1212121212123kkk322k3k"

View File

@@ -95,4 +95,5 @@ RUN set -eux; \
composer dump-autoload --classmap-authoritative --no-dev; \ composer dump-autoload --classmap-authoritative --no-dev; \
composer dump-env prod; \ composer dump-env prod; \
composer run-script --no-dev post-install-cmd; \ composer run-script --no-dev post-install-cmd; \
chmod +x bin/console; sync; chmod +x bin/console; \
sync;

View File

@@ -1,19 +1,53 @@
:root { :root {
--primary-color: #f6cd26; --primary-color: #f6cd26;
--second-color: black;
--line-width: 2px;
--space: 12px;
} }
body { body {
background-color: black; background-color: var(--second-color);
color: var(--primary-color); color: var(--primary-color);
} }
.block { .block {
border: solid var(--primary-color) 2px; border: solid var(--primary-color) var(--line-width);
padding: 12px; padding: var(--space);
} }
.list { .list {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 12px; gap: var(--space);
} }
a:visited, a:hover {
color: var(--primary-color);
}
button {
align-items: center;
padding: var(--space);
background: var(--second-color);
color: var(--primary-color);
border: solid var(--primary-color) var(--line-width);
}
button:hover,
button:focus {
background: var(--primary-color);
color: black;
cursor: pointer;
border: solid var(--second-color) var(--line-width);
outline: calc(var(--line-width) * 2) var(--primary-color);
}
textarea {
padding: var(--space);
color: var(--primary-color);
background-color: var(--second-color);
border: solid var(--primary-color) var(--line-width);
}

View File

@@ -6,8 +6,6 @@ services:
SERVER_NAME: ${SERVER_NAME:-localhost}, php:80 SERVER_NAME: ${SERVER_NAME:-localhost}, php:80
MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!} MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!}
MERCURE_SUBSCRIBER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!} MERCURE_SUBSCRIBER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!}
# Run "composer require symfony/orm-pack" to install and configure Doctrine ORM
DATABASE_URL: postgresql://${POSTGRES_USER:-app}:${POSTGRES_PASSWORD:-app}@database:5432/${POSTGRES_DB:-app}?serverVersion=${POSTGRES_VERSION:-16}&charset=${POSTGRES_CHARSET:-utf8}
# Run "composer require symfony/mercure-bundle" to install and configure the Mercure integration # Run "composer require symfony/mercure-bundle" to install and configure the Mercure integration
MERCURE_URL: ${CADDY_MERCURE_URL:-http://php/.well-known/mercure} MERCURE_URL: ${CADDY_MERCURE_URL:-http://php/.well-known/mercure}
MERCURE_PUBLIC_URL: ${CADDY_MERCURE_PUBLIC_URL:-https://${SERVER_NAME:-localhost}:${HTTPS_PORT:-443}/.well-known/mercure} MERCURE_PUBLIC_URL: ${CADDY_MERCURE_PUBLIC_URL:-https://${SERVER_NAME:-localhost}:${HTTPS_PORT:-443}/.well-known/mercure}

View File

@@ -63,6 +63,7 @@
"scripts": { "scripts": {
"auto-scripts": { "auto-scripts": {
"cache:clear": "symfony-cmd", "cache:clear": "symfony-cmd",
"asset-map:compile": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd", "assets:install %PUBLIC_DIR%": "symfony-cmd",
"importmap:install": "symfony-cmd" "importmap:install": "symfony-cmd"
}, },

View File

@@ -6,6 +6,7 @@ use App\Entity\Branch;
use App\Entity\Message; use App\Entity\Message;
use App\Form\CreateMessageType; use App\Form\CreateMessageType;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
@@ -14,8 +15,10 @@ use Symfony\Component\Routing\Attribute\Route;
#[Route('/branches')] #[Route('/branches')]
final class BranchController extends AbstractController final class BranchController extends AbstractController
{ {
public function __construct(private readonly EntityManagerInterface $entityManager) public function __construct(
{ private readonly EntityManagerInterface $entityManager,
private readonly LoggerInterface $logger,
) {
} }
#[Route('/{id}', name: 'branch', methods: ['GET'])] #[Route('/{id}', name: 'branch', methods: ['GET'])]
@@ -39,6 +42,12 @@ final class BranchController extends AbstractController
$this->entityManager->persist($message); $this->entityManager->persist($message);
$this->entityManager->flush(); $this->entityManager->flush();
$this->logger->info('Created message with id {messageId}', ['messageId' => $message->getId()]);
} else {
$this->logger->warning('Cant create message', [
'isFormSubmitted' => $form->isSubmitted(),
'isFormValid' => $form->isValid(),
]);
} }
return $this->redirectToRoute('branch', ['id' => $branch->getId()]); return $this->redirectToRoute('branch', ['id' => $branch->getId()]);