mirror of
https://framagit.org/fiat-tux/hat-softwares/lutim.git
synced 2026-08-07 17:33:03 +02:00
Add file extension to view link
This commit is contained in:
@@ -14,6 +14,7 @@ Revision history for Lutim
|
||||
- Update twitter bootstrap
|
||||
- Add "Copy to clipboard" buttons to each link
|
||||
- Add "Copy all links" button
|
||||
- Add file extension to view link
|
||||
- bugfixes
|
||||
|
||||
0.6 2014-10-03
|
||||
|
||||
+5
-1
@@ -333,10 +333,14 @@ sub startup {
|
||||
to('Controller#modify')->
|
||||
name('modify');
|
||||
|
||||
$r->get('/:short')->
|
||||
$r->get('/(:short).(:f)')->
|
||||
to('Controller#short')->
|
||||
name('short');
|
||||
$r->get('/:short')->
|
||||
to('Controller#short');
|
||||
|
||||
$r->get('/:short/(:key).(:f)')->
|
||||
to('Controller#short');
|
||||
$r->get('/:short/:key')->
|
||||
to('Controller#short');
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ use DateTime;
|
||||
use Digest::file qw(digest_file_hex);
|
||||
use Text::Unidecode;
|
||||
use Data::Validate::URI qw(is_http_uri is_https_uri);
|
||||
use File::MimeInfo::Magic;
|
||||
use File::MimeInfo::Magic qw(mimetype extensions);
|
||||
use IO::Scalar;
|
||||
use Image::ExifTool;
|
||||
|
||||
@@ -253,6 +253,8 @@ sub add {
|
||||
my $io_scalar = new IO::Scalar \$upload->slurp();
|
||||
my $mediatype = mimetype($io_scalar);
|
||||
|
||||
my ($ext) = ($upload->filename =~ m/.*\.(.*)$/);
|
||||
|
||||
my $ip = $c->ip;
|
||||
|
||||
my ($msg, $short, $real_short, $token, $thumb);
|
||||
@@ -375,6 +377,7 @@ sub add {
|
||||
short => $short,
|
||||
real_short => $real_short,
|
||||
token => $token,
|
||||
ext => $ext || extensions($mediatype),
|
||||
thumb => $thumb
|
||||
};
|
||||
} else {
|
||||
@@ -398,6 +401,7 @@ sub add {
|
||||
$c->stash(short => $short) if (defined($short));
|
||||
$c->stash(real_short => $real_short);
|
||||
$c->stash(token => $token);
|
||||
$c->stash(ext => $ext || extensions($mediatype));
|
||||
$c->stash(thumb => $thumb);
|
||||
$c->stash(filename => $upload->filename);
|
||||
return $c->render(
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<label class="sr-only" for="view"><%= l('View link') %></label>
|
||||
<div class="input-group col-sm-6">
|
||||
<div class="input-group-addon"><span class="icon icon-eye" title =" <%= l('View link') %>"></span></div>
|
||||
<input type="text" class="form-control" id="view" value="<%= $url %>" readonly>
|
||||
<input type="text" class="form-control" id="view" value="<%= $url.'.'.stash('ext') %>" readonly>
|
||||
<a href="#" onClick="copyToClipboard($(this));" class="input-group-addon jsonly" title="<%= l('Copy to clipboard') %>"><span class="icon icon-clipboard"></span></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
+tw_url(msg.short)
|
||||
+'</h4>'
|
||||
+'<form class="form"><div class="form-group"><label class="sr-only" for="view'+msg.real_short+'"><%= l('View link') %></label><div class="input-group col-sm-6"><div class="input-group-addon"><span class="icon icon-eye" title =" <%= l('View link') %>"></span></div><input type="text" class="form-control view-link-input" id="view'+msg.real_short+'" value="'
|
||||
+link(msg.short, '')
|
||||
+link(msg.short+'.'+msg.ext, '')
|
||||
+'" readonly><a href="#" onClick="copyToClipboard($(this));" class="input-group-addon" title="<%= l('Copy to clipboard') %>"><span class="icon icon-clipboard"></span></a></div></div><div class="form-group"><label class="sr-only" for="markdown'+msg.real_short+'"><%= l('Markdown syntax') %></label><div class="input-group col-sm-6"><div class="input-group-addon"><span class="markdown-mark-solid" title ="<%= l('Markdown syntax') %>"></span></div><input type="text" class="form-control" id="markdown'+msg.real_short+'" value="
|
||||
+')" readonly><a href="#" onClick="copyToClipboard($(this));" class="input-group-addon" title="<%= l('Copy to clipboard') %>"><span class="icon icon-clipboard"></span></a></div></div><div class="form-group"><label class="sr-only" for="download'+msg.real_short+'"><%= l('Download link') %></label><div class="input-group col-sm-6"><div class="input-group-addon"><span class="icon icon-download" title ="<%= l('Download link') %>"></span></div><input type="text" class="form-control" id="download'+msg.real_short+'" value="'
|
||||
|
||||
Reference in New Issue
Block a user