Le mirroring des dépôts vers Github est maintenant natif dans Gitlab (et donc Framagit). Merci de passer à la fonction native pour que nous puissions couper notre solution maison. Détails sur https://docs.gitlab.com/ee/workflow/repository_mirroring.html#pushing-to-a-remote-repository (pensez à supprimer le webhook de notre solution maison).

Commit 878b0360 by Luc Didry

Add QRCode generation

parent a3a50374
Pipeline #11506 passed with stages
in 5 minutes 46 seconds
......@@ -3,6 +3,7 @@ stages:
- sqlite
- postgresql
before_script:
- apt-get install -y libpng12-dev
- carton install
- rm -f *db
sqlite:
......
Revision history for Perl application Lstu
0.09 ?
- Add QRcode generation
0.08 Wed Feb 08 18:49:00 1017 +0100
- Add Piwik tracking option
- Add Minion option for async counters increasing
......
......@@ -15,3 +15,4 @@ requires 'Net::Abuse::Utils::Spamhaus';
requires 'IO::Socket::SSL';
requires 'Net::LDAP';
requires 'Apache::Htpasswd';
requires 'Image::PNG::QRCode';
......@@ -7,6 +7,8 @@ use Lstu::DB::Session;
use Data::Validate::URI qw(is_http_uri is_https_uri);
use Mojo::JSON qw(to_json decode_json);
use Mojo::URL;
use Mojo::Util qw(b64_encode);
use Image::PNG::QRCode 'qrpng';
sub add {
my $c = shift;
......@@ -122,13 +124,16 @@ sub add {
my $prefix = $c->prefix;
my $qrcode = b64_encode(qrpng(text => $prefix.$short));
$c->respond_to(
json => { json => { success => Mojo::JSON->true, url => $url, short => $prefix.$short } },
json => { json => { success => Mojo::JSON->true, url => $url, short => $prefix.$short, qrcode => $qrcode } },
any => sub {
my $c = shift;
$c->flash('url' => $url);
$c->flash('short' => $prefix.$short);
$c->flash('url' => $url);
$c->flash('short' => $prefix.$short);
$c->flash('qrcode' => $qrcode);
$c->redirect_to('index');
}
);
......@@ -203,16 +208,27 @@ sub stats {
short => $prefix.$url->{short},
url => $url->{url},
counter => $url->{counter},
created_at => $url->{timestamp}
created_at => $url->{timestamp},
qrcode => b64_encode(qrpng(text => $prefix.$url->{short}))
};
}
$c->render( json => \@struct );
},
any => sub {
shift->render(
my @struct;
for my $url (@urls) {
push @struct, {
short => $url->{short},
url => $url->{url},
counter => $url->{counter},
timestamp => $url->{timestamp},
qrcode => b64_encode(qrpng(text => $prefix.$url->{short}))
};
}
$c->render(
template => 'stats',
prefix => $prefix,
urls => \@urls
urls => \@struct
)
}
)
......
......@@ -47,7 +47,7 @@ $t->get_ok('/')
$t->post_ok('/a' => form => { lsturl => 'https://lstu.fr', format => 'json' })
->status_is(200)
->json_has('url', 'short', 'success')
->json_has('url', 'short', 'success', 'qrcode')
->json_is('/success' => true, '/url' => 'https://lstu.fr')
->json_like('/short' => qr#http://127\.0\.0\.1:\d+/[-_a-zA-Z0-9]{8}#);
......@@ -75,7 +75,7 @@ sleep 4;
$t->get_ok('/stats.json')
->status_is(200)
->json_has('/0/created_at', '/0/counter', '/0/short', '/0/url')
->json_has('/0/created_at', '/0/counter', '/0/short', '/0/url', '/0/qrcode')
->json_is('/0/url' => 'https://lstu.fr', '/0/short' => $a)
->json_is('/0/counter' => 2)
->json_like('/0/created_at' => qr#\d+#);
......@@ -139,7 +139,7 @@ $t->post_ok('/a' => form => { lsturl => 'https://lstu.fr', format => 'json' })
Lstu::DB::Ban->new(app => $m)->delete_all; # reset banishing
$t->post_ok('/a' => form => { lsturl => ' https://fiat-tux.fr', format => 'json' })
->status_is(200)
->json_has('url', 'short', 'success')
->json_has('url', 'short', 'success', 'qrcode')
->json_is('/success' => true, '/url' => 'https://fiat-tux.fr')
->json_like('/short' => qr#http://127\.0\.0\.1:\d+/[-_a-zA-Z0-9]{8}#);
......@@ -173,7 +173,7 @@ $t->post_ok('/login' => form => { login => 'luc', password => 'toto' })
$t->post_ok('/a' => form => { lsturl => 'https://lstu.fr', format => 'json' })
->status_is(200)
->json_has('url', 'short', 'success')
->json_has('url', 'short', 'success', 'qrcode')
->json_is('/success' => true, '/url' => 'https://lstu.fr')
->json_like('/short' => qr#http://127\.0\.0\.1:\d+/[-_a-zA-Z0-9]{8}#);
......@@ -196,7 +196,7 @@ $t->ua->post('/a' => form => { lsturl => 'https://lstu.fr', format => 'json' });
$t->post_ok('/a' => form => { lsturl => 'https://lstu.fr', format => 'json' })
->status_is(200)
->json_has('url', 'short', 'success')
->json_has('url', 'short', 'success', 'qrcode')
->json_is('/success' => true, '/url' => 'https://lstu.fr')
->json_like('/short' => qr#http://127\.0\.0\.1:\d+/[-_a-zA-Z0-9]{8}#);
......
......@@ -21,7 +21,7 @@ msgstr ""
"X-Poedit-SourceCharset: UTF-8\n"
#. ($url)
#: lib/Lstu/Controller/Lstu.pm:98
#: lib/Lstu/Controller/Lstu.pm:100
msgid "%1 is not a valid URL."
msgstr "%1 n'eo ket un URL talvoudek."
......@@ -45,7 +45,7 @@ msgstr "Ger-tremen didalvoudek"
msgid "Browser extensions"
msgstr ""
#: themes/default/templates/index.html.ep:20
#: themes/default/templates/index.html.ep:21
msgid "Copy to clipboard"
msgstr "Eilañ"
......@@ -61,7 +61,7 @@ msgstr "Krouet"
msgid "Custom shortened text"
msgstr "Testenn verr personelaet"
#: themes/default/templates/stats.html.ep:35
#: themes/default/templates/stats.html.ep:37
msgid "Delete"
msgstr "Dilemel"
......@@ -81,7 +81,7 @@ msgstr "Henny Penny"
msgid "HennyPenny-Regular"
msgstr "HennyPenny-Regular"
#: themes/default/templates/index.html.ep:52
#: themes/default/templates/index.html.ep:53
msgid "Hit Enter, then Ctrl+C to copy the short link"
msgstr "Pouezit war Enankañ, ha Reol+C evit eilañ an ere berr"
......@@ -134,12 +134,12 @@ msgstr ""
msgid "Logout from admin stats"
msgstr "Digennaskañ eus stadegoù an ardoer"
#: themes/default/templates/stats.html.ep:65
#: themes/default/templates/stats.html.ep:69
msgid "Next"
msgstr "Da-heul"
#. ($c->config('contact')
#: lib/Lstu/Controller/Lstu.pm:92
#: lib/Lstu/Controller/Lstu.pm:94
msgid "No shortened URL available. Please retry or contact the administrator at %1. Your URL to shorten: %2"
msgstr "N'eus URL berr ebet hegerz. Klaskit en-dro pe kit e darempred gant an ardoer e %1. Hoc'h URL da verraat: %2"
......@@ -155,10 +155,14 @@ msgstr ""
msgid "Please, check your credentials: unable to authenticate."
msgstr ""
#: themes/default/templates/stats.html.ep:63
#: themes/default/templates/stats.html.ep:67
msgid "Previous"
msgstr "Kent"
#: themes/default/templates/stats.html.ep:35
msgid "QRCode"
msgstr ""
#: themes/default/templates/api.html.ep:103 themes/default/templates/api.html.ep:123 themes/default/templates/api.html.ep:130 themes/default/templates/api.html.ep:146 themes/default/templates/api.html.ep:24 themes/default/templates/api.html.ep:37 themes/default/templates/api.html.ep:59
msgid "Response for HTML format"
msgstr "Respont evit ar mentrezh HTML"
......@@ -198,17 +202,17 @@ msgid "The URL redirects 3 times or most. It's most likely a dangerous URL (spam
msgstr "Adheñchet eo an URL teir gwech pe ouzhpenn. Moarvat eo un URL arvarus (spam, phishing...). Ne fell ket din e verraat."
#. ($c->url_for('/')
#: lib/Lstu/Controller/Admin.pm:131 lib/Lstu/Controller/Lstu.pm:279
#: lib/Lstu/Controller/Admin.pm:131 lib/Lstu/Controller/Lstu.pm:295
msgid "The shortened URL %1 doesn't exist."
msgstr "N'eus ket eus an URL berraet %1."
#. ($custom_url)
#: lib/Lstu/Controller/Lstu.pm:56
#: lib/Lstu/Controller/Lstu.pm:58
msgid "The shortened text (%1) is already used. Please choose another one."
msgstr "An destenn berraet (%1) a zo diouti endeo. Dibabit unan all mar plij."
#. ($url)
#: lib/Lstu/Controller/Lstu.pm:54
#: lib/Lstu/Controller/Lstu.pm:56
msgid "The shortened text can contain only numbers, letters and the - and _ character, can't be \"a\", \"api\", \"d\" or \"stats\" or end with \".json\". Your URL to shorten: %1"
msgstr "An destenn berraet n'hall enderc'hel niverennoù, lizherennoù hag an arouezennoù - ha _ nemetken. N'hall ket bezañ \"a\", \"api\", \"d\" pe \"stats\" pe echuiñ gant \".json\". Hoc'h URL da verraat: %1"
......@@ -233,7 +237,7 @@ msgid "URL to shorten"
msgstr "URL da verraat"
#. ($penalty/3600)
#: lib/Lstu/Controller/Lstu.pm:30
#: lib/Lstu/Controller/Lstu.pm:32
msgid "You asked to shorten too many URLs too quickly. You're banned for %1 hour(s)."
msgstr "Goulennet hoc'h eus da verraat re a URLoù en un amzer re verr. Forbannet hoc'h e-pad %1 eur."
......
......@@ -20,7 +20,7 @@ msgstr ""
"X-Poedit-SourceCharset: UTF-8\n"
#. ($url)
#: lib/Lstu/Controller/Lstu.pm:98
#: lib/Lstu/Controller/Lstu.pm:100
msgid "%1 is not a valid URL."
msgstr ""
......@@ -44,7 +44,7 @@ msgstr ""
msgid "Browser extensions"
msgstr ""
#: themes/default/templates/index.html.ep:20
#: themes/default/templates/index.html.ep:21
msgid "Copy to clipboard"
msgstr ""
......@@ -60,7 +60,7 @@ msgstr ""
msgid "Custom shortened text"
msgstr ""
#: themes/default/templates/stats.html.ep:35
#: themes/default/templates/stats.html.ep:37
msgid "Delete"
msgstr ""
......@@ -80,7 +80,7 @@ msgstr ""
msgid "HennyPenny-Regular"
msgstr ""
#: themes/default/templates/index.html.ep:52
#: themes/default/templates/index.html.ep:53
msgid "Hit Enter, then Ctrl+C to copy the short link"
msgstr ""
......@@ -133,12 +133,12 @@ msgstr ""
msgid "Logout from admin stats"
msgstr ""
#: themes/default/templates/stats.html.ep:65
#: themes/default/templates/stats.html.ep:69
msgid "Next"
msgstr ""
#. ($c->config('contact')
#: lib/Lstu/Controller/Lstu.pm:92
#: lib/Lstu/Controller/Lstu.pm:94
msgid "No shortened URL available. Please retry or contact the administrator at %1. Your URL to shorten: %2"
msgstr ""
......@@ -154,10 +154,14 @@ msgstr ""
msgid "Please, check your credentials: unable to authenticate."
msgstr ""
#: themes/default/templates/stats.html.ep:63
#: themes/default/templates/stats.html.ep:67
msgid "Previous"
msgstr ""
#: themes/default/templates/stats.html.ep:35
msgid "QRCode"
msgstr ""
#: themes/default/templates/api.html.ep:103 themes/default/templates/api.html.ep:123 themes/default/templates/api.html.ep:130 themes/default/templates/api.html.ep:146 themes/default/templates/api.html.ep:24 themes/default/templates/api.html.ep:37 themes/default/templates/api.html.ep:59
msgid "Response for HTML format"
msgstr ""
......@@ -197,17 +201,17 @@ msgid "The URL redirects 3 times or most. It's most likely a dangerous URL (spam
msgstr ""
#. ($c->url_for('/')
#: lib/Lstu/Controller/Admin.pm:131 lib/Lstu/Controller/Lstu.pm:279
#: lib/Lstu/Controller/Admin.pm:131 lib/Lstu/Controller/Lstu.pm:295
msgid "The shortened URL %1 doesn't exist."
msgstr ""
#. ($custom_url)
#: lib/Lstu/Controller/Lstu.pm:56
#: lib/Lstu/Controller/Lstu.pm:58
msgid "The shortened text (%1) is already used. Please choose another one."
msgstr ""
#. ($url)
#: lib/Lstu/Controller/Lstu.pm:54
#: lib/Lstu/Controller/Lstu.pm:56
msgid "The shortened text can contain only numbers, letters and the - and _ character, can't be \"a\", \"api\", \"d\" or \"stats\" or end with \".json\". Your URL to shorten: %1"
msgstr ""
......@@ -232,7 +236,7 @@ msgid "URL to shorten"
msgstr ""
#. ($penalty/3600)
#: lib/Lstu/Controller/Lstu.pm:30
#: lib/Lstu/Controller/Lstu.pm:32
msgid "You asked to shorten too many URLs too quickly. You're banned for %1 hour(s)."
msgstr ""
......
......@@ -23,7 +23,7 @@ msgstr ""
"X-Poedit-SourceCharset: UTF-8\n"
#. ($url)
#: lib/Lstu/Controller/Lstu.pm:98
#: lib/Lstu/Controller/Lstu.pm:100
msgid "%1 is not a valid URL."
msgstr "%1 n’est pas une URL valide."
......@@ -47,7 +47,7 @@ msgstr "Mot de passe incorrect"
msgid "Browser extensions"
msgstr "Extensions navigateur"
#: themes/default/templates/index.html.ep:20
#: themes/default/templates/index.html.ep:21
msgid "Copy to clipboard"
msgstr "Copier dans le presse-papier"
......@@ -63,7 +63,7 @@ msgstr "Créé le"
msgid "Custom shortened text"
msgstr "Texte du raccourci personnalisé"
#: themes/default/templates/stats.html.ep:35
#: themes/default/templates/stats.html.ep:37
msgid "Delete"
msgstr "Supprimer"
......@@ -83,7 +83,7 @@ msgstr ""
msgid "HennyPenny-Regular"
msgstr ""
#: themes/default/templates/index.html.ep:52
#: themes/default/templates/index.html.ep:53
msgid "Hit Enter, then Ctrl+C to copy the short link"
msgstr "Appuyez sur Entrée puis faites Ctrl+C pour copier le lien"
......@@ -140,12 +140,12 @@ msgstr "Déconnexion"
msgid "Logout from admin stats"
msgstr "Déconnexion des stats admin"
#: themes/default/templates/stats.html.ep:65
#: themes/default/templates/stats.html.ep:69
msgid "Next"
msgstr "Suivant"
#. ($c->config('contact')
#: lib/Lstu/Controller/Lstu.pm:92
#: lib/Lstu/Controller/Lstu.pm:94
msgid "No shortened URL available. Please retry or contact the administrator at %1. Your URL to shorten: %2"
msgstr "Il n’y a plus d’URL raccourcie disponible. Veuillez réessayer ou contactez l’administrateur sur %1. Rappel de l’URL à raccourcir : %2"
......@@ -161,10 +161,14 @@ msgstr "Mot de passe"
msgid "Please, check your credentials: unable to authenticate."
msgstr "Impossible de s’authentifier, veuillez vérifier vos identifiants"
#: themes/default/templates/stats.html.ep:63
#: themes/default/templates/stats.html.ep:67
msgid "Previous"
msgstr "Précédent"
#: themes/default/templates/stats.html.ep:35
msgid "QRCode"
msgstr ""
#: themes/default/templates/api.html.ep:103 themes/default/templates/api.html.ep:123 themes/default/templates/api.html.ep:130 themes/default/templates/api.html.ep:146 themes/default/templates/api.html.ep:24 themes/default/templates/api.html.ep:37 themes/default/templates/api.html.ep:59
msgid "Response for HTML format"
msgstr "Réponse pour le format HTML"
......@@ -204,17 +208,17 @@ msgid "The URL redirects 3 times or most. It's most likely a dangerous URL (spam
msgstr "L'URL redirige 3 fois ou plus vers un autre site. Il est probable qu'il s'agisse d'une URL dangereuse (pourriel, hameçonnage, etc.). Je refuse de la raccourcir."
#. ($c->url_for('/')
#: lib/Lstu/Controller/Admin.pm:131 lib/Lstu/Controller/Lstu.pm:279
#: lib/Lstu/Controller/Admin.pm:131 lib/Lstu/Controller/Lstu.pm:295
msgid "The shortened URL %1 doesn't exist."
msgstr "L’URL raccourcie %1 n’existe pas"
#. ($custom_url)
#: lib/Lstu/Controller/Lstu.pm:56
#: lib/Lstu/Controller/Lstu.pm:58
msgid "The shortened text (%1) is already used. Please choose another one."
msgstr "Le texte du raccourci (%1) est déjà utilisé. Veuillez en choisir un autre"
#. ($url)
#: lib/Lstu/Controller/Lstu.pm:54
#: lib/Lstu/Controller/Lstu.pm:56
msgid "The shortened text can contain only numbers, letters and the - and _ character, can't be \"a\", \"api\", \"d\" or \"stats\" or end with \".json\". Your URL to shorten: %1"
msgstr "Le texte du raccourci ne doit contenir que des chiffres, des lettres et les caractères - et _, ne peut être \"a\", \"api\", \"d\" ou \"stats\" ou se terminer par \".json\". Rappel de l’URL à raccourcir : %1"
......@@ -239,7 +243,7 @@ msgid "URL to shorten"
msgstr "URL à raccourcir"
#. ($penalty/3600)
#: lib/Lstu/Controller/Lstu.pm:30
#: lib/Lstu/Controller/Lstu.pm:32
msgid "You asked to shorten too many URLs too quickly. You're banned for %1 hour(s)."
msgstr "Vous avez demandé à réduire trop d’URLs en trop peu de temps. Vous êtes banni pour %1 heure(s)."
......
......@@ -24,7 +24,7 @@ msgstr ""
"X-Poedit-SourceCharset: UTF-8\n"
#. ($url)
#: lib/Lstu/Controller/Lstu.pm:98
#: lib/Lstu/Controller/Lstu.pm:100
msgid "%1 is not a valid URL."
msgstr "%1 es pas una URL valida."
......@@ -48,7 +48,7 @@ msgstr "Senhal incorrèct"
msgid "Browser extensions"
msgstr "Extensions navigator"
#: themes/default/templates/index.html.ep:20
#: themes/default/templates/index.html.ep:21
msgid "Copy to clipboard"
msgstr "Copiar al quichapapièrs"
......@@ -64,7 +64,7 @@ msgstr "Creat lo"
msgid "Custom shortened text"
msgstr "Tèxte de l’acorchi personalizat"
#: themes/default/templates/stats.html.ep:35
#: themes/default/templates/stats.html.ep:37
msgid "Delete"
msgstr "Suprimir"
......@@ -84,7 +84,7 @@ msgstr "Henny Penny"
msgid "HennyPenny-Regular"
msgstr "HennyPenny-Regular"
#: themes/default/templates/index.html.ep:52
#: themes/default/templates/index.html.ep:53
msgid "Hit Enter, then Ctrl+C to copy the short link"
msgstr "Picatz sus Entrada puèi fasètz Ctrl+C per copiar lo ligam"
......@@ -137,12 +137,12 @@ msgstr "Desconnexion"
msgid "Logout from admin stats"
msgstr "Desconnexion de las estatisticas admin"
#: themes/default/templates/stats.html.ep:65
#: themes/default/templates/stats.html.ep:69
msgid "Next"
msgstr "Seguent"
#. ($c->config('contact')
#: lib/Lstu/Controller/Lstu.pm:92
#: lib/Lstu/Controller/Lstu.pm:94
msgid "No shortened URL available. Please retry or contact the administrator at %1. Your URL to shorten: %2"
msgstr "I a pas mai d’URL acorchadas disponiblas. Mercés de tornar ensajar o de contactar l’administrator sus %1. Recòrd de l’URL per acorchar : %2"
......@@ -158,10 +158,14 @@ msgstr "Senhal"
msgid "Please, check your credentials: unable to authenticate."
msgstr "Mercés de verificar vòstres identificants : fracàs de l’autentificacion."
#: themes/default/templates/stats.html.ep:63
#: themes/default/templates/stats.html.ep:67
msgid "Previous"
msgstr "Precedent"
#: themes/default/templates/stats.html.ep:35
msgid "QRCode"
msgstr ""
#: themes/default/templates/api.html.ep:103 themes/default/templates/api.html.ep:123 themes/default/templates/api.html.ep:130 themes/default/templates/api.html.ep:146 themes/default/templates/api.html.ep:24 themes/default/templates/api.html.ep:37 themes/default/templates/api.html.ep:59
msgid "Response for HTML format"
msgstr "Reponsa pel format HTML"
......@@ -201,17 +205,17 @@ msgid "The URL redirects 3 times or most. It's most likely a dangerous URL (spam
msgstr "L’URL endralha 3 còps o mai cap a un a autre site. Pòt èsser una URL dangerossa (porrièl, pesca electronica, etc). Refusi de l’acorchar"
#. ($c->url_for('/')
#: lib/Lstu/Controller/Admin.pm:131 lib/Lstu/Controller/Lstu.pm:279
#: lib/Lstu/Controller/Admin.pm:131 lib/Lstu/Controller/Lstu.pm:295
msgid "The shortened URL %1 doesn't exist."
msgstr "L’URL acorchada %1 existís pas"
#. ($custom_url)
#: lib/Lstu/Controller/Lstu.pm:56
#: lib/Lstu/Controller/Lstu.pm:58
msgid "The shortened text (%1) is already used. Please choose another one."
msgstr "Lo tèxte de l’acorchi (%1) es ja utilizat. Mercés de ne causir un autre"
#. ($url)
#: lib/Lstu/Controller/Lstu.pm:54
#: lib/Lstu/Controller/Lstu.pm:56
msgid "The shortened text can contain only numbers, letters and the - and _ character, can't be \"a\", \"api\", \"d\" or \"stats\" or end with \".json\". Your URL to shorten: %1"
msgstr "Lo tèxte de l’acorchi deu pas que contenir de chifras, letras e los caractèrs - e _, èsser \"a\", \"api\", \"d\" o \"stats\" o acabar per \".json\". Recòrd de l’URL per acorchar : %1"
......@@ -236,7 +240,7 @@ msgid "URL to shorten"
msgstr "URL per acorchar"
#. ($penalty/3600)
#: lib/Lstu/Controller/Lstu.pm:30
#: lib/Lstu/Controller/Lstu.pm:32
msgid "You asked to shorten too many URLs too quickly. You're banned for %1 hour(s)."
msgstr "Avètz demandat d’acorchar tròp d’URL en pauc de temps. Sètz bandit per %1 ora(s)."
......
......@@ -14,6 +14,7 @@
% if (defined(flash('short')) && defined(flash('url'))) {
<h3 class="alert alert-success form-inline">
<img alt="QRCode" src="data:image/png;base64,<%= flash('qrcode') %>">
<div class="form-group">
<label><%= link_to flash('url') => begin %><%= flash('url') %><%= end %></a></label>
<br> =&gt; <input id="input-short" value="<%== flash('short') %>" class="form-control">
......
......@@ -31,7 +31,9 @@
<th><%= l('Counter') %></th>
<th><%= l('Created') %></th>
% if (defined(config('adminpwd')) || defined(config('hashed_adminpwd'))) {
% if (defined(stash('admin'))) {
% unless (defined(stash('admin'))) {
<th><%= l('QRCode') %></th>
% } else {
<th><%= l('Delete') %></th>
% }
% }
......@@ -49,7 +51,9 @@
<td><%= $url->{counter} %></td>
<td><%= Mojo::Date->new($url->{timestamp})->to_string %></td>
% if (defined(config('adminpwd')) || defined(config('hashed_adminpwd'))) {
% if (defined(stash('admin'))) {
% unless (defined(stash('admin'))) {
<td><img class="qrcode-stat" alt="QRCode" src="data:image/png;base64,<%= $url->{qrcode} %>"></td>
% } else {
<td><a href="<%= url_for('delete', {short => $url->{short}}) %>"><span class="icon icon-trash"></span></a></td>
% }
% }
......
......@@ -39,3 +39,6 @@ ul.pager li {
display: none !important;
}
}
.qrcode-result {
float: right;
}
......@@ -12,6 +12,7 @@
% if (defined(flash('short')) && defined(flash('url'))) {
<fieldset class="result">
<img class="qrcode-result" alt="QRCode" src="data:image/png;base64,<%= flash('qrcode') %>">
<label><%= link_to flash('url') => begin %><h4><%= flash('url') %></h4><%= end %></label>
<input id="input-short" value="<%== flash('short') %>" class="form-control">
<span id="js" class="hidden"><a href="#" id="clipboard" class="button button-clear" title="<%= l('Copy to clipboard') %>"><h5><span class="icon icon-clipboard"></span></h5></a><span>
......
......@@ -31,7 +31,9 @@
<th><%= l('Counter') %></th>
<th><%= l('Created') %></th>
% if (defined(config('adminpwd')) || defined(config('hashed_adminpwd'))) {
% if (defined(stash('admin'))) {
% unless (defined(stash('admin'))) {
<th><%= l('QRCode') %></th>
% } else {
<th><%= l('Delete') %></th>
% }
% }
......@@ -49,7 +51,9 @@
<td><%= $url->{counter} %></td>
<td><%= Mojo::Date->new($url->{timestamp})->to_string %></td>
% if (defined(config('adminpwd')) || defined(config('hashed_adminpwd'))) {
% if (defined(stash('admin'))) {
% unless (defined(stash('admin'))) {
<td><img class="qrcode-stat" alt="QRCode" src="data:image/png;base64,<%= $url->{qrcode} %>"></td>
% } else {
<td><a href="<%= url_for('delete', {short => $url->{short}}) %>"><h5><span class="icon icon-trash"></span></h5></a></td>
% }
% }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment