From 0f69403c2de98121244d0de0ddb97b1a2b10afcc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andrej=20Rama=C5=A1euski?= <andrej@x2.cz>
Date: Tue, 31 Jan 2023 21:00:42 +0100
Subject: [PATCH] Moznost delsi zkratky

---
 VERSION                           | 2 +-
 lib/PZ/Controller/Shortcut.pm     | 2 +-
 openapi.yaml                      | 2 +-
 sql/migrations.sql                | 4 ++++
 templates/layouts/default.html.ep | 2 +-
 templates/shortcuts.html.ep       | 2 +-
 6 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/VERSION b/VERSION
index 197c4d5..005119b 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.4.0
+2.4.1
diff --git a/lib/PZ/Controller/Shortcut.pm b/lib/PZ/Controller/Shortcut.pm
index 2e7b354..199dd2a 100644
--- a/lib/PZ/Controller/Shortcut.pm
+++ b/lib/PZ/Controller/Shortcut.pm
@@ -5,7 +5,7 @@ use Data::Validate::URI qw(is_uri);
 use Image::PNG::QRCode 'qrpng';
 use Mojo::UserAgent;
 
-use constant SHORTCUT => qr/^[a-z\d\-]{1,8}$/;
+use constant SHORTCUT => qr/^[a-z\d\-]{1,32}$/;
 
 sub redirect ($c) {
     my $shortcut = $c->schema->resultset('Shortcut')->search({
diff --git a/openapi.yaml b/openapi.yaml
index 578a1e9..1c0897c 100644
--- a/openapi.yaml
+++ b/openapi.yaml
@@ -26,7 +26,7 @@ components:
         id:
           type: integer
           readOnly: true
-          maxLength: 8
+          maxLength: 32
         created:
           type: string
           description: Datum přidání
diff --git a/sql/migrations.sql b/sql/migrations.sql
index 6b1bb5c..ac50559 100644
--- a/sql/migrations.sql
+++ b/sql/migrations.sql
@@ -74,3 +74,7 @@ from "log"
 
 -- 6 up
 alter table "shortcuts" add column "counter" integer not null default 0;
+
+-- 7 up
+alter table "shortcuts" alter column "shortcut" type varchar(32);
+
diff --git a/templates/layouts/default.html.ep b/templates/layouts/default.html.ep
index 9ea2c3b..44d69cd 100644
--- a/templates/layouts/default.html.ep
+++ b/templates/layouts/default.html.ep
@@ -82,7 +82,7 @@
   </ui-app>
 </nav>
 
-<div id="App" class="container container--default py-8">
+<div class="container container--default py-8">
   <section>
     <main>
 <%= content %>
diff --git a/templates/shortcuts.html.ep b/templates/shortcuts.html.ep
index f2fc296..10d2b69 100644
--- a/templates/shortcuts.html.ep
+++ b/templates/shortcuts.html.ep
@@ -15,7 +15,7 @@
     <div class="form-field col-span-3">
       <label class="form-field__label" for="shortcut">Zkratka</label>
       <div class="form-field__wrapper form-field__wrapper--shadowed">
-        <input type="text" name="shortcut" class="text-input form-field__control w-40" size="8" maxlength="8" value="" placeholder="thc"  v-model="shortcut.shortcut" @focus="formError=''"/>
+        <input type="text" name="shortcut" class="text-input form-field__control w-40" size="16" maxlength="32" value="" placeholder="thc"  v-model="shortcut.shortcut" @focus="formError=''"/>
         <button class="btn btn--grey-125 btn--hoveractive ml-4">
             <div class="btn__body">Zkrátit</div>
         </button>
-- 
GitLab