Loading secret-api.php +8 −2 Original line number Diff line number Diff line Loading @@ -7,10 +7,10 @@ header('Content-Type: application/json'); require 'vendor/autoload.php'; use Dotenv\Dotenv; use MongoDB\BSON\UTCDateTime; use MongoDB\Client; use Ramsey\Uuid\Uuid; use Dotenv\Dotenv; $dotenv = Dotenv::createImmutable(__DIR__); $dotenv->load(); Loading Loading @@ -45,6 +45,7 @@ if ($method === 'POST') { } $id = Uuid::uuid4()->toString(); $metaDataId = Uuid::uuid4()->toString(); $now = new DateTimeImmutable('now', new DateTimeZone('UTC')); $ttlMinutes = isset($data['ttl_minutes']) ? (int)$data['ttl_minutes'] : 60 * 24 * 7; $expiresAt = $now->modify("+{$ttlMinutes} minutes"); Loading @@ -55,6 +56,11 @@ if ($method === 'POST') { 'encrypted' => !!$data['encrypted'], // cast to bool - dubults neplīst 😂 'createdAt' => new UTCDateTime($now), 'expiresAt' => new UTCDateTime($expiresAt), 'opened' => false, 'openedAt' => null, 'deleted' => false, 'deletedAt' => null, 'metaDataId' => $metaDataId, ]); echo json_encode(['id' => $id]); Loading Loading
secret-api.php +8 −2 Original line number Diff line number Diff line Loading @@ -7,10 +7,10 @@ header('Content-Type: application/json'); require 'vendor/autoload.php'; use Dotenv\Dotenv; use MongoDB\BSON\UTCDateTime; use MongoDB\Client; use Ramsey\Uuid\Uuid; use Dotenv\Dotenv; $dotenv = Dotenv::createImmutable(__DIR__); $dotenv->load(); Loading Loading @@ -45,6 +45,7 @@ if ($method === 'POST') { } $id = Uuid::uuid4()->toString(); $metaDataId = Uuid::uuid4()->toString(); $now = new DateTimeImmutable('now', new DateTimeZone('UTC')); $ttlMinutes = isset($data['ttl_minutes']) ? (int)$data['ttl_minutes'] : 60 * 24 * 7; $expiresAt = $now->modify("+{$ttlMinutes} minutes"); Loading @@ -55,6 +56,11 @@ if ($method === 'POST') { 'encrypted' => !!$data['encrypted'], // cast to bool - dubults neplīst 😂 'createdAt' => new UTCDateTime($now), 'expiresAt' => new UTCDateTime($expiresAt), 'opened' => false, 'openedAt' => null, 'deleted' => false, 'deletedAt' => null, 'metaDataId' => $metaDataId, ]); echo json_encode(['id' => $id]); Loading