Verified Commit 4d5fed4d authored by Luc Didry's avatar Luc Didry Committed by Luc Didry
Browse files

Merge branch 'fix-84' into 'development'

Fix #84 - Add link to generate random file in collection

See merge request luc/lutim!48
parents b088db9c ea358d4a
......@@ -19,6 +19,7 @@ Revision history for Lutim
- Fix stats files place when using non-default theme
- Allow to use a fixed domain
- Add localStorage export and import feature
- Add link to generate random file in collection
0.10.4 2018-05-07
- Fix bug in cache system that would allow someone to view an image with an incorrect decryption key
......
......@@ -243,6 +243,10 @@ sub startup {
->to('Controller#zip')
->name('zip');
$r->get('/random')
->to('Controller#random')
->name('random');
$r->post('/')->
to('Controller#add')->
name('add');
......
......@@ -13,6 +13,7 @@ use File::MimeInfo::Magic qw(mimetype extensions);
use IO::Scalar;
use Image::ExifTool;
use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
use Data::Entropy qw(entropy_source);
use vars qw($im_loaded);
BEGIN {
......@@ -786,4 +787,16 @@ sub zip {
}
}
sub random {
my $c = shift;
my $imgs = $c->every_param('i');
my $img_nb = scalar(@{$imgs});
if ($img_nb) {
$c->redirect_to($c->prefix.$imgs->[entropy_source->get_int($img_nb)]);
} else {
$c->render_not_found;
}
}
1;
......@@ -28,7 +28,7 @@ msgstr ""
msgid "%1 sent images on this instance from beginning."
msgstr ""
#: themes/default/templates/index.html.ep:190
#: themes/default/templates/index.html.ep:208
msgid "-or-"
msgstr ""
......@@ -40,7 +40,7 @@ msgstr ""
msgid "24 hours"
msgstr ""
#: themes/default/templates/partial/myfiles.js.ep:120
#: themes/default/templates/partial/myfiles.js.ep:124
msgid ": Error while trying to get the counter."
msgstr ""
......@@ -52,7 +52,7 @@ msgstr ""
msgid "Active images"
msgstr ""
#: lib/Lutim/Controller.pm:326
#: lib/Lutim/Controller.pm:327
msgid "An error occured while downloading the image."
msgstr ""
......@@ -60,11 +60,11 @@ msgstr ""
msgid "Archives download"
msgstr ""
#: themes/default/templates/about.html.ep:44 themes/default/templates/myfiles.html.ep:69 themes/default/templates/stats.html.ep:25
#: themes/default/templates/about.html.ep:44 themes/default/templates/myfiles.html.ep:87 themes/default/templates/stats.html.ep:25
msgid "Back to homepage"
msgstr ""
#: themes/default/templates/index.html.ep:193 themes/default/templates/index.html.ep:194
#: themes/default/templates/index.html.ep:211 themes/default/templates/index.html.ep:212
msgid "Click to open the file browser"
msgstr ""
......@@ -76,19 +76,19 @@ msgstr ""
msgid "Contributors"
msgstr ""
#: themes/default/templates/partial/common.js.ep:75 themes/default/templates/partial/common.js.ep:95
#: themes/default/templates/partial/common.js.ep:113 themes/default/templates/partial/common.js.ep:93
msgid "Copied to clipboard"
msgstr ""
#: themes/default/templates/partial/lutim.js.ep:215 themes/default/templates/partial/lutim.js.ep:276 themes/default/templates/partial/lutim.js.ep:361
#: themes/default/templates/partial/lutim.js.ep:215 themes/default/templates/partial/lutim.js.ep:278 themes/default/templates/partial/lutim.js.ep:364
msgid "Copy all view links to clipboard"
msgstr ""
#: themes/default/templates/index.html.ep:18 themes/default/templates/index.html.ep:36 themes/default/templates/index.html.ep:69 themes/default/templates/index.html.ep:77 themes/default/templates/index.html.ep:85 themes/default/templates/index.html.ep:93 themes/default/templates/myfiles.html.ep:20 themes/default/templates/myfiles.html.ep:38 themes/default/templates/partial/common.js.ep:168 themes/default/templates/partial/lutim.js.ep:106 themes/default/templates/partial/lutim.js.ep:121 themes/default/templates/partial/lutim.js.ep:80 themes/default/templates/partial/lutim.js.ep:92 themes/default/templates/partial/myfiles.js.ep:88
#: themes/default/templates/index.html.ep:103 themes/default/templates/index.html.ep:111 themes/default/templates/index.html.ep:18 themes/default/templates/index.html.ep:36 themes/default/templates/index.html.ep:54 themes/default/templates/index.html.ep:87 themes/default/templates/index.html.ep:95 themes/default/templates/myfiles.html.ep:20 themes/default/templates/myfiles.html.ep:38 themes/default/templates/myfiles.html.ep:56 themes/default/templates/partial/common.js.ep:186 themes/default/templates/partial/lutim.js.ep:106 themes/default/templates/partial/lutim.js.ep:121 themes/default/templates/partial/lutim.js.ep:80 themes/default/templates/partial/lutim.js.ep:92 themes/default/templates/partial/myfiles.js.ep:92
msgid "Copy to clipboard"
msgstr ""
#: themes/default/templates/myfiles.html.ep:57
#: themes/default/templates/myfiles.html.ep:75
msgid "Counter"
msgstr ""
......@@ -100,7 +100,7 @@ msgstr ""
msgid "Delay repartition chart for enabled images"
msgstr ""
#: themes/default/templates/index.html.ep:115 themes/default/templates/index.html.ep:147 themes/default/templates/index.html.ep:178 themes/default/templates/myfiles.html.ep:58 themes/default/templates/partial/lutim.js.ep:161
#: themes/default/templates/index.html.ep:133 themes/default/templates/index.html.ep:165 themes/default/templates/index.html.ep:196 themes/default/templates/myfiles.html.ep:76 themes/default/templates/partial/lutim.js.ep:161
msgid "Delete at first view?"
msgstr ""
......@@ -112,7 +112,7 @@ msgstr ""
msgid "Deleted images in 30 days"
msgstr ""
#: themes/default/templates/index.html.ep:98 themes/default/templates/myfiles.html.ep:61 themes/default/templates/partial/common.js.ep:160 themes/default/templates/partial/common.js.ep:163
#: themes/default/templates/index.html.ep:116 themes/default/templates/myfiles.html.ep:79 themes/default/templates/partial/common.js.ep:178 themes/default/templates/partial/common.js.ep:181
msgid "Deletion link"
msgstr ""
......@@ -120,7 +120,7 @@ msgstr ""
msgid "Download all images"
msgstr ""
#: themes/default/templates/index.html.ep:81 themes/default/templates/index.html.ep:83 themes/default/templates/partial/lutim.js.ep:102 themes/default/templates/partial/lutim.js.ep:98
#: themes/default/templates/index.html.ep:101 themes/default/templates/index.html.ep:99 themes/default/templates/partial/lutim.js.ep:102 themes/default/templates/partial/lutim.js.ep:98
msgid "Download link"
msgstr ""
......@@ -128,7 +128,7 @@ msgstr ""
msgid "Download zip link"
msgstr ""
#: themes/default/templates/index.html.ep:189
#: themes/default/templates/index.html.ep:207
msgid "Drag & drop images here"
msgstr ""
......@@ -136,7 +136,7 @@ msgstr ""
msgid "Drag and drop an image in the appropriate area or use the traditional way to send files and Lutim will provide you four URLs. One to view the image, an other to directly download it, one you can use on social networks and a last to delete the image when you want."
msgstr ""
#: themes/default/templates/index.html.ep:150 themes/default/templates/index.html.ep:181
#: themes/default/templates/index.html.ep:168 themes/default/templates/index.html.ep:199
msgid "Encrypt the image (Lutim does not keep the key)."
msgstr ""
......@@ -148,15 +148,15 @@ msgstr ""
msgid "Evolution of total files"
msgstr ""
#: themes/default/templates/myfiles.html.ep:60
#: themes/default/templates/myfiles.html.ep:78
msgid "Expires at"
msgstr ""
#: themes/default/templates/myfiles.html.ep:46
#: themes/default/templates/myfiles.html.ep:64
msgid "Export localStorage data"
msgstr ""
#: themes/default/templates/myfiles.html.ep:55
#: themes/default/templates/myfiles.html.ep:73
msgid "File name"
msgstr ""
......@@ -172,7 +172,7 @@ msgstr ""
msgid "Gallery link"
msgstr ""
#: themes/default/templates/partial/common.js.ep:116 themes/default/templates/partial/common.js.ep:98
#: themes/default/templates/partial/common.js.ep:116 themes/default/templates/partial/common.js.ep:134
msgid "Hit Ctrl+C, then Enter to copy the short link"
msgstr ""
......@@ -196,7 +196,7 @@ msgstr ""
msgid "If the files are deleted if you ask it while posting it, their SHA512 footprint are retained."
msgstr ""
#: themes/default/templates/index.html.ep:163 themes/default/templates/index.html.ep:203
#: themes/default/templates/index.html.ep:181 themes/default/templates/index.html.ep:221
msgid "Image URL"
msgstr ""
......@@ -204,15 +204,15 @@ msgstr ""
msgid "Image delay"
msgstr ""
#: themes/default/templates/partial/common.js.ep:139
#: themes/default/templates/partial/common.js.ep:157
msgid "Image deleted"
msgstr ""
#: lib/Lutim/Controller.pm:752
#: lib/Lutim/Controller.pm:753
msgid "Image not found."
msgstr ""
#: themes/default/templates/myfiles.html.ep:47
#: themes/default/templates/myfiles.html.ep:65
msgid "Import localStorage data"
msgstr ""
......@@ -240,7 +240,7 @@ msgstr ""
msgid "Juste like you pronounce the French word <a href=\"https://fr.wikipedia.org/wiki/Lutin\">lutin</a> (/ly.tɛ̃/)."
msgstr ""
#: themes/default/templates/index.html.ep:153 themes/default/templates/index.html.ep:184
#: themes/default/templates/index.html.ep:171 themes/default/templates/index.html.ep:202
msgid "Keep EXIF tags"
msgstr ""
......@@ -248,7 +248,7 @@ msgstr ""
msgid "Language"
msgstr ""
#: themes/default/templates/index.html.ep:118 themes/default/templates/index.html.ep:166 themes/default/templates/index.html.ep:206 themes/default/templates/partial/lutim.js.ep:165
#: themes/default/templates/index.html.ep:136 themes/default/templates/index.html.ep:184 themes/default/templates/index.html.ep:224 themes/default/templates/partial/lutim.js.ep:165
msgid "Let's go!"
msgstr ""
......@@ -256,7 +256,7 @@ msgstr ""
msgid "License:"
msgstr ""
#: themes/default/templates/index.html.ep:89 themes/default/templates/index.html.ep:91 themes/default/templates/partial/lutim.js.ep:112 themes/default/templates/partial/lutim.js.ep:116
#: themes/default/templates/index.html.ep:107 themes/default/templates/index.html.ep:109 themes/default/templates/partial/lutim.js.ep:112 themes/default/templates/partial/lutim.js.ep:116
msgid "Link for share on social networks"
msgstr ""
......@@ -272,7 +272,7 @@ msgstr ""
msgid "Main developers"
msgstr ""
#: themes/default/templates/index.html.ep:73 themes/default/templates/index.html.ep:75 themes/default/templates/partial/lutim.js.ep:86 themes/default/templates/partial/lutim.js.ep:89
#: themes/default/templates/index.html.ep:91 themes/default/templates/index.html.ep:93 themes/default/templates/partial/lutim.js.ep:86 themes/default/templates/partial/lutim.js.ep:89
msgid "Markdown syntax"
msgstr ""
......@@ -284,11 +284,11 @@ msgstr ""
msgid "Next (arrow right)"
msgstr ""
#: themes/default/templates/partial/myfiles.js.ep:78
#: themes/default/templates/partial/myfiles.js.ep:82
msgid "No limit"
msgstr ""
#: themes/default/templates/index.html.ep:165 themes/default/templates/index.html.ep:198
#: themes/default/templates/index.html.ep:183 themes/default/templates/index.html.ep:216
msgid "Only images are allowed"
msgstr ""
......@@ -313,20 +313,24 @@ msgstr ""
msgid "Previous (arrow left)"
msgstr ""
#: themes/default/templates/index.html.ep:46 themes/default/templates/index.html.ep:49 themes/default/templates/myfiles.html.ep:48 themes/default/templates/myfiles.html.ep:51
msgid "Random image link"
msgstr ""
#: themes/default/templates/stats.html.ep:22
msgid "Raw stats"
msgstr ""
#: themes/default/templates/index.html.ep:158
#: themes/default/templates/index.html.ep:176
msgid "Send an image"
msgstr ""
#: themes/default/templates/index.html.ep:133 themes/default/templates/partial/gallery.js.ep:211 themes/default/templates/partial/lutim.js.ep:176
#: themes/default/templates/index.html.ep:151 themes/default/templates/partial/gallery.js.ep:211 themes/default/templates/partial/lutim.js.ep:176
msgid "Something bad happened"
msgstr ""
#. ($c->config('contact')
#: lib/Lutim/Controller.pm:759
#: lib/Lutim/Controller.pm:760
msgid "Something went wrong when creating the zip file. Try again later or contact the administrator (%1)."
msgstr ""
......@@ -354,7 +358,7 @@ msgstr ""
msgid "The Lutim software is a <a href=\"http://en.wikipedia.org/wiki/Free_software\">free software</a>, which allows you to download and install it on you own server. Have a look at the <a href=\"https://www.gnu.org/licenses/agpl-3.0.html\">AGPL</a> to see what you can do."
msgstr ""
#: lib/Lutim/Controller.pm:345
#: lib/Lutim/Controller.pm:346
msgid "The URL is not valid."
msgstr ""
......@@ -366,19 +370,19 @@ msgstr ""
msgid "The data has been successfully imported."
msgstr ""
#: lib/Lutim/Controller.pm:158 lib/Lutim/Controller.pm:226
#: lib/Lutim/Controller.pm:159 lib/Lutim/Controller.pm:227
msgid "The delete token is invalid."
msgstr ""
#. ($upload->filename)
#: lib/Lutim/Controller.pm:486
#: lib/Lutim/Controller.pm:487
msgid "The file %1 is not an image."
msgstr ""
#. ($tx->res->max_message_size)
#. ($c->req->max_message_size)
#. (config('max_file_size')
#: lib/Lutim/Controller.pm:309 lib/Lutim/Controller.pm:378 themes/default/templates/partial/lutim.js.ep:247
#: lib/Lutim/Controller.pm:310 lib/Lutim/Controller.pm:379 themes/default/templates/partial/lutim.js.ep:249
msgid "The file exceed the size limit (%1)"
msgstr ""
......@@ -387,20 +391,20 @@ msgid "The graph's datas are not updated in real-time."
msgstr ""
#. ($image->filename)
#: lib/Lutim/Controller.pm:228
#: lib/Lutim/Controller.pm:229
msgid "The image %1 has already been deleted."
msgstr ""
#. ($image->filename)
#: lib/Lutim/Controller.pm:237 lib/Lutim/Controller.pm:242
#: lib/Lutim/Controller.pm:238 lib/Lutim/Controller.pm:243
msgid "The image %1 has been successfully deleted"
msgstr ""
#: lib/Lutim/Controller.pm:166
#: lib/Lutim/Controller.pm:167
msgid "The image's delay has been successfully modified"
msgstr ""
#: themes/default/templates/index.html.ep:45
#: themes/default/templates/index.html.ep:63
msgid "The images are encrypted on the server (Lutim does not keep the key)."
msgstr ""
......@@ -413,7 +417,7 @@ msgid "There is XXXX image(s) in the gallery"
msgstr ""
#. ($c->config->{contact})
#: lib/Lutim/Controller.pm:483
#: lib/Lutim/Controller.pm:484
msgid "There is no more available URL. Retry or contact the administrator. %1"
msgstr ""
......@@ -429,24 +433,24 @@ msgstr ""
msgid "Total"
msgstr ""
#: themes/default/templates/index.html.ep:60 themes/default/templates/partial/lutim.js.ep:17
#: themes/default/templates/index.html.ep:78 themes/default/templates/partial/lutim.js.ep:17
msgid "Tweet it!"
msgstr ""
#: themes/default/templates/partial/common.js.ep:72 themes/default/templates/partial/common.js.ep:92
#: themes/default/templates/partial/common.js.ep:110 themes/default/templates/partial/common.js.ep:90
msgid "Unable to copy to clipboard"
msgstr ""
#. ($short)
#: lib/Lutim/Controller.pm:106 lib/Lutim/Controller.pm:200 lib/Lutim/Controller.pm:271
#: lib/Lutim/Controller.pm:107 lib/Lutim/Controller.pm:201 lib/Lutim/Controller.pm:272
msgid "Unable to find the image %1."
msgstr ""
#: lib/Lutim/Controller.pm:572 lib/Lutim/Controller.pm:617 lib/Lutim/Controller.pm:656 lib/Lutim/Controller.pm:699 lib/Lutim/Controller.pm:711 lib/Lutim/Controller.pm:722 lib/Lutim/Controller.pm:749 lib/Lutim/Plugin/Helpers.pm:88
#: lib/Lutim/Controller.pm:573 lib/Lutim/Controller.pm:618 lib/Lutim/Controller.pm:657 lib/Lutim/Controller.pm:700 lib/Lutim/Controller.pm:712 lib/Lutim/Controller.pm:723 lib/Lutim/Controller.pm:750 lib/Lutim/Plugin/Helpers.pm:88
msgid "Unable to find the image: it has been deleted."
msgstr ""
#: lib/Lutim/Controller.pm:143
#: lib/Lutim/Controller.pm:144
msgid "Unable to get counter"
msgstr ""
......@@ -454,11 +458,11 @@ msgstr ""
msgid "Unlike many image sharing services, you don't give us rights on uploaded images."
msgstr ""
#: themes/default/templates/index.html.ep:162 themes/default/templates/index.html.ep:201
#: themes/default/templates/index.html.ep:180 themes/default/templates/index.html.ep:219
msgid "Upload an image with its URL"
msgstr ""
#: themes/default/templates/myfiles.html.ep:59
#: themes/default/templates/myfiles.html.ep:77
msgid "Uploaded at"
msgstr ""
......@@ -471,7 +475,7 @@ msgstr ""
msgid "Uploading is currently disabled, please try later or contact the administrator (%1)."
msgstr ""
#: themes/default/templates/index.html.ep:65 themes/default/templates/index.html.ep:67 themes/default/templates/myfiles.html.ep:56 themes/default/templates/partial/lutim.js.ep:72 themes/default/templates/partial/lutim.js.ep:76
#: themes/default/templates/index.html.ep:83 themes/default/templates/index.html.ep:85 themes/default/templates/myfiles.html.ep:74 themes/default/templates/partial/lutim.js.ep:72 themes/default/templates/partial/lutim.js.ep:76
msgid "View link"
msgstr ""
......
This diff is collapsed.
......@@ -9,7 +9,7 @@
.icon-twitter:before { content: '\e807'; } /* '' */
.icon-clipboard:before { content: '\e808'; } /* '' */
.icon-spinner:before { content: '\e809'; } /* '' */
.icon-flattr:before { content: '\e80a'; } /* '' */
.icon-shuffle:before { content: '\e80a'; } /* '' */
.icon-cancel:before { content: '\e80b'; } /* '' */
.icon-picture:before { content: '\e80c'; } /* '' */
.icon-file-archive:before { content: '\e80d'; } /* '' */
......
......@@ -9,7 +9,7 @@
.icon-twitter { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe807;&nbsp;'); }
.icon-clipboard { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe808;&nbsp;'); }
.icon-spinner { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe809;&nbsp;'); }
.icon-flattr { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe80a;&nbsp;'); }
.icon-shuffle { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe80a;&nbsp;'); }
.icon-cancel { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe80b;&nbsp;'); }
.icon-picture { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe80c;&nbsp;'); }
.icon-file-archive { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe80d;&nbsp;'); }
......
......@@ -20,7 +20,7 @@
.icon-twitter { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe807;&nbsp;'); }
.icon-clipboard { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe808;&nbsp;'); }
.icon-spinner { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe809;&nbsp;'); }
.icon-flattr { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe80a;&nbsp;'); }
.icon-shuffle { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe80a;&nbsp;'); }
.icon-cancel { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe80b;&nbsp;'); }
.icon-picture { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe80c;&nbsp;'); }
.icon-file-archive { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe80d;&nbsp;'); }
......
@font-face {
font-family: 'fontello';
src: url('../font/fontello.eot?84200725');
src: url('../font/fontello.eot?84200725#iefix') format('embedded-opentype'),
url('../font/fontello.woff2?84200725') format('woff2'),
url('../font/fontello.woff?84200725') format('woff'),
url('../font/fontello.ttf?84200725') format('truetype'),
url('../font/fontello.svg?84200725#fontello') format('svg');
src: url('../font/fontello.eot?84232201');
src: url('../font/fontello.eot?84232201#iefix') format('embedded-opentype'),
url('../font/fontello.woff2?84232201') format('woff2'),
url('../font/fontello.woff?84232201') format('woff'),
url('../font/fontello.ttf?84232201') format('truetype'),
url('../font/fontello.svg?84232201#fontello') format('svg');
font-weight: normal;
font-style: normal;
}
......@@ -15,7 +15,7 @@
@media screen and (-webkit-min-device-pixel-ratio:0) {
@font-face {
font-family: 'fontello';
src: url('../font/fontello.svg?84200725#fontello') format('svg');
src: url('../font/fontello.svg?84232201#fontello') format('svg');
}
}
*/
......@@ -65,7 +65,7 @@
.icon-twitter:before { content: '\e807'; } /* '' */
.icon-clipboard:before { content: '\e808'; } /* '' */
.icon-spinner:before { content: '\e809'; } /* '' */
.icon-flattr:before { content: '\e80a'; } /* '' */
.icon-shuffle:before { content: '\e80a'; } /* '' */
.icon-cancel:before { content: '\e80b'; } /* '' */
.icon-picture:before { content: '\e80c'; } /* '' */
.icon-file-archive:before { content: '\e80d'; } /* '' */
......
......@@ -26,7 +26,7 @@
<glyph glyph-name="spinner" unicode="&#xe809;" d="M469 614v204q129 0 237-61t169-170 62-237h-204q0 72-36 133t-95 96-133 35z" horiz-adv-x="937.5" />
<glyph glyph-name="flattr" unicode="&#xe80a;" d="M0-37l0 514q0 179 85 278t259 99l548 0q-5-5-52-53t-100-101-109-109-95-93-42-37q-15 0-15 16l0 156-48 0q-59 0-94-6t-63-26-39-57-12-96l0-262z m67-117q5 5 53 53t100 101 109 110 95 93 41 36q15 0 15-16l0-156 48 0q116 0 162 36t45 149l0 262 224 223 0-514q0-179-84-278t-260-99l-548 0z" horiz-adv-x="959" />
<glyph glyph-name="shuffle" unicode="&#xe80a;" d="M754 516q-54 0-105-32t-80-66-83-104q-48-62-75-94t-78-77-107-66-122-21l-104 0 0 140 104 0q54 0 106 32t81 66 83 104q62 82 101 126t116 88 163 44l36 0 0 120 210-180-210-180 0 100-36 0z m-484-88q-74 78-166 78l-104 0 0 140 104 0q140 0 254-108-14-16-37-45t-27-33q-8-12-24-32z m520-242l0 100 210-180-210-180 0 120-36 0q-140 0-260 116 46 58 72 92 0 2 6 9t8 11q84-88 174-88l36 0z" horiz-adv-x="1000" />
<glyph glyph-name="cancel" unicode="&#xe80b;" d="M0 71l279 279-279 279 221 221 279-279 279 279 221-221-279-279 279-279-221-221-279 279-279-279z" horiz-adv-x="1000" />
......
......@@ -40,6 +40,24 @@
</div>
</form>
</div>
<div id="random-url" class="hidden row">
<form class="form col-sm-12">
<div class="form-group">
<label for="random-url-input"><%= l('Random image link') %></label>
<div class="input-group">
<div class="input-group-addon">
<a id="random-url-link" href="#" target="_blank" title="<%= l('Random image link') %>">
<span class="icon icon-shuffle"></span>
</a>
</div>
<input class="form-control" name="random-url-input" type="text" id="random-url-input" readonly></input>
<a href="#" class="input-group-addon jsonly copy-to-clipboard-link" title="<%= l('Copy to clipboard') %>">
<span class="icon icon-clipboard"></span>
</a>
</div>
</div>
</form>
</div>
<div class="messages">
% if (config('always_encrypt')) {
<p><%= l('The images are encrypted on the server (Lutim does not keep the key).') %></p>
......
......@@ -42,6 +42,24 @@
</div>
</form>
</div>
<div id="random-url" class="hidden row">
<form class="form col-sm-12">
<div class="form-group">
<label for="random-url-input"><%= l('Random image link') %></label>
<div class="input-group">
<div class="input-group-addon">
<a id="random-url-link" href="#" target="_blank" title="<%= l('Random image link') %>">
<span class="icon icon-shuffle"></span>
</a>
</div>
<input class="form-control" name="random-url-input" type="text" id="random-url-input" readonly></input>
<a href="#" class="input-group-addon jsonly copy-to-clipboard-link" title="<%= l('Copy to clipboard') %>">
<span class="icon icon-clipboard"></span>
</a>
</div>
</div>
</form>
</div>
<div class="files-buttons">
<a href="#" id="json-export" class="btn btn-info"><%= l('Export localStorage data') %></a>
<a href="#" id="json-import" class="btn btn-info"><%= l('Import localStorage data') %></a>
......
% # vim:set sw=4 ts=4 sts=4 ft=javascript expandtab:
window.gallery_url = '<%= prefix().'gallery' %>#';
window.zip_url = '<%= prefix().'zip' %>?i=';
window.random_url = '<%= prefix().'random' %>?i=';
window.short_hash = {};
window.zip_hash = {};
window.random_hash = {};
function addToShortHash(short) {
window.short_hash[short] = 1;
if (Object.keys(window.short_hash).length > 0) {
......@@ -35,6 +37,22 @@ function rmFromZipHash(short) {
$('#zip-url').addClass('hidden');
}
}
function addToRandomHash(short) {
window.random_hash[short] = 1;
if (Object.keys(window.random_hash).length > 0) {
$('#random-url').removeClass('hidden');
$('#random-url-input').val(window.random_url+Object.keys(window.random_hash).join('&i='));
$('#random-url-link').attr('href', window.random_url+Object.keys(window.random_hash).join('&i='));
}
}
function rmFromRandomHash(short) {
delete window.random_hash[short];
$('#random-url-input').val(window.random_url+Object.keys(window.random_hash).join('&i='));
$('#random-url-link').attr('href', window.random_url+Object.keys(window.random_hash).join('&i='));
if (Object.keys(window.random_hash).length === 0) {
$('#random-url').addClass('hidden');
}
}
/* Stolen from https://github.com/mozilla-services/push-dev-dashboard/blob/3ad4de737380d0842f40c82301d1f748c1b20f2b/push/static/js/validation.js */
function createNode(text) {
var node = document.createElement('pre');
......
......@@ -222,11 +222,13 @@ function bindddz(firstview, deleteday) {
e.preventDefault();
rmFromShortHash(data.msg.short+'.'+data.msg.ext)
rmFromZipHash(data.msg.short);
rmFromRandomHash(data.msg.short);
});
$('#del-'+data.msg.real_short).on('click', delImage);
if (data.success) {
addToShortHash(data.msg.short+'.'+data.msg.ext);
addToZipHash(data.msg.short);
addToRandomHash(data.msg.short);
$('.close').unbind('click', evaluateCopyAll);
$('.close').on('click', evaluateCopyAll);
$('input[type=\'text\']').unbind("click", selectInput);
......@@ -281,6 +283,7 @@ function upload_url(e) {
$('#lutim-file-url').val('');
addToShortHash(data.msg.short+'.'+data.msg.ext);
addToZipHash(data.msg.short);
addToRandomHash(data.msg.short);
$('#del-'+data.msg.real_short).on('click', delImage);
$('.close').unbind('click', evaluateCopyAll);
$('.close').on('click', evaluateCopyAll);
......
......@@ -57,9 +57,11 @@ function onCheck(e, short, ext) {
if ($(this).is(':checked')) {
addToShortHash(short+'.'+ext);
addToZipHash(short);
addToRandomHash(short);
} else {
rmFromShortHash(short+'.'+ext);
rmFromZipHash(short);
rmFromRandomHash(short);
}
}
function populateFilesTable() {
......
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