Fix #3
This commit is contained in:
parent
2dfb0e5998
commit
60e157ff71
|
@ -217,19 +217,34 @@ sub get_counter {
|
|||
my $short = $c->param('short');
|
||||
my $token = $c->param('token');
|
||||
|
||||
my @records = LufiDB::Files->select('WHERE short = ? AND mod_token = ?', ($short, $token));
|
||||
my @records = LufiDB::Files->select('WHERE short = ?', $short);
|
||||
if (scalar(@records)) {
|
||||
return $c->render(
|
||||
json => {
|
||||
success => true,
|
||||
counter => $records[0]->counter
|
||||
}
|
||||
);
|
||||
if ($records[0]->mod_token eq $token) {
|
||||
return $c->render(
|
||||
json => {
|
||||
success => true,
|
||||
short => $short,
|
||||
counter => $records[0]->counter,
|
||||
deleted => ($records[0]->deleted) ? true : false
|
||||
}
|
||||
);
|
||||
} else {
|
||||
return $c->render(
|
||||
json => {
|
||||
success => false,
|
||||
missing => false,
|
||||
short => $short,
|
||||
msg => $c->l('Unable to get counter for %1. The token is unvalid.', $short)
|
||||
}
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return $c->render(
|
||||
json => {
|
||||
success => false,
|
||||
msg => $c->l('Unable to get counter for %1. The file does not exists.', $short)
|
||||
missing => true,
|
||||
short => $short,
|
||||
msg => $c->l('Unable to get counter for %1. The file does not exists. It will be removed from your localStorage.', $short)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -29,14 +29,10 @@ msgstr ""
|
|||
msgid "24 hours"
|
||||
msgstr ""
|
||||
|
||||
#: templates/mail.html.ep:70
|
||||
#: templates/mail.html.ep:69
|
||||
msgid ":"
|
||||
msgstr ""
|
||||
|
||||
#: templates/files.html.ep:84
|
||||
msgid ": Error while trying to get the counter."
|
||||
msgstr ""
|
||||
|
||||
#: templates/layouts/default.html.ep:41
|
||||
msgid "About"
|
||||
msgstr ""
|
||||
|
@ -57,7 +53,7 @@ msgstr ""
|
|||
msgid "Copy to clipboard"
|
||||
msgstr ""
|
||||
|
||||
#: lib/Lufi/Controller/Files.pm:267
|
||||
#: lib/Lufi/Controller/Files.pm:282
|
||||
msgid "Could not find the file. Are you sure of the URL and the token?"
|
||||
msgstr ""
|
||||
|
||||
|
@ -65,15 +61,15 @@ msgstr ""
|
|||
msgid "Could not find the file. Are you sure of the URL?"
|
||||
msgstr ""
|
||||
|
||||
#: templates/files.html.ep:15
|
||||
#: templates/files.html.ep:16
|
||||
msgid "Counter"
|
||||
msgstr ""
|
||||
|
||||
#: templates/files.html.ep:16 templates/index.html.ep:52
|
||||
#: templates/files.html.ep:17 templates/index.html.ep:52
|
||||
msgid "Delete at first download?"
|
||||
msgstr ""
|
||||
|
||||
#: templates/files.html.ep:19 templates/index.html.ep:79
|
||||
#: templates/files.html.ep:20 templates/index.html.ep:79
|
||||
msgid "Deletion link"
|
||||
msgstr ""
|
||||
|
||||
|
@ -85,7 +81,7 @@ msgstr ""
|
|||
msgid "Download"
|
||||
msgstr ""
|
||||
|
||||
#: templates/files.html.ep:14 templates/index.html.ep:80
|
||||
#: templates/files.html.ep:15 templates/index.html.ep:80
|
||||
msgid "Download link"
|
||||
msgstr ""
|
||||
|
||||
|
@ -121,19 +117,19 @@ msgstr ""
|
|||
msgid "Expiration:"
|
||||
msgstr ""
|
||||
|
||||
#: templates/files.html.ep:18
|
||||
#: templates/files.html.ep:19
|
||||
msgid "Expires at"
|
||||
msgstr ""
|
||||
|
||||
#: lib/Lufi/Controller/Files.pm:251
|
||||
#: lib/Lufi/Controller/Files.pm:266
|
||||
msgid "File deleted"
|
||||
msgstr ""
|
||||
|
||||
#: templates/files.html.ep:13
|
||||
#: templates/files.html.ep:14
|
||||
msgid "File name"
|
||||
msgstr ""
|
||||
|
||||
#: templates/mail.html.ep:65
|
||||
#: templates/mail.html.ep:64
|
||||
msgid "Hello,\\n\\nHere's some files I want to share with you:\\n"
|
||||
msgstr ""
|
||||
|
||||
|
@ -178,11 +174,11 @@ msgstr ""
|
|||
msgid "No enough space available on the server for this file (size: %1)."
|
||||
msgstr ""
|
||||
|
||||
#: templates/files.html.ep:34 templates/index.html.ep:86
|
||||
#: templates/index.html.ep:86
|
||||
msgid "No expiration delay"
|
||||
msgstr ""
|
||||
|
||||
#: templates/files.html.ep:6
|
||||
#: templates/files.html.ep:7
|
||||
msgid "Only the files sent with this browser will be listed here. The informations are stored in localStorage: if you delete your localStorage data, you'll loose this informations."
|
||||
msgstr ""
|
||||
|
||||
|
@ -190,6 +186,10 @@ msgstr ""
|
|||
msgid "Please wait while we are getting your file"
|
||||
msgstr ""
|
||||
|
||||
#: templates/files.html.ep:6
|
||||
msgid "Purge expired files from localStorage"
|
||||
msgstr ""
|
||||
|
||||
#: templates/index.html.ep:85
|
||||
msgid "Send all links by email"
|
||||
msgstr ""
|
||||
|
@ -203,7 +203,7 @@ msgid "Send with your own mail software"
|
|||
msgstr ""
|
||||
|
||||
#. (url_for('/')
|
||||
#: templates/mail.html.ep:78
|
||||
#: templates/mail.html.ep:77
|
||||
msgid "Share your files in total privacy on %1"
|
||||
msgstr ""
|
||||
|
||||
|
@ -223,7 +223,7 @@ msgstr ""
|
|||
msgid "The email subject can't be empty."
|
||||
msgstr ""
|
||||
|
||||
#: lib/Lufi/Controller/Files.pm:248
|
||||
#: lib/Lufi/Controller/Files.pm:263
|
||||
msgid "The file has already been deleted"
|
||||
msgstr ""
|
||||
|
||||
|
@ -241,15 +241,20 @@ msgid "This server sets limitations according to the file size. The expiration d
|
|||
msgstr ""
|
||||
|
||||
#. ($short)
|
||||
#: lib/Lufi/Controller/Files.pm:232
|
||||
msgid "Unable to get counter for %1. The file does not exists."
|
||||
#: lib/Lufi/Controller/Files.pm:247
|
||||
msgid "Unable to get counter for %1. The file does not exists. It will be removed from your localStorage."
|
||||
msgstr ""
|
||||
|
||||
#. ($short)
|
||||
#: lib/Lufi/Controller/Files.pm:237
|
||||
msgid "Unable to get counter for %1. The token is unvalid."
|
||||
msgstr ""
|
||||
|
||||
#: templates/layouts/default.html.ep:39
|
||||
msgid "Upload files"
|
||||
msgstr ""
|
||||
|
||||
#: templates/files.html.ep:17
|
||||
#: templates/files.html.ep:18
|
||||
msgid "Uploaded at"
|
||||
msgstr ""
|
||||
|
||||
|
@ -288,7 +293,7 @@ msgstr ""
|
|||
msgid "between %1 and %2, the file will be kept forever."
|
||||
msgstr ""
|
||||
|
||||
#: templates/mail.html.ep:72
|
||||
#: templates/mail.html.ep:71
|
||||
msgid "deadline: "
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"PO-Revision-Date: 2015-10-04 16:33+0200\n"
|
||||
"PO-Revision-Date: 2015-10-04 19:44+0200\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
@ -19,7 +19,8 @@ msgstr ""
|
|||
|
||||
#. ($delay)
|
||||
#. (max_delay)
|
||||
#: templates/index.html.ep:29 templates/index.html.ep:38 templates/index.html.ep:39
|
||||
#: templates/index.html.ep:29 templates/index.html.ep:38
|
||||
#: templates/index.html.ep:39
|
||||
msgid "%1 days"
|
||||
msgstr "%1 jours"
|
||||
|
||||
|
@ -31,11 +32,10 @@ msgstr "1 an"
|
|||
msgid "24 hours"
|
||||
msgstr "24 heures"
|
||||
|
||||
#: templates/mail.html.ep:70
|
||||
#: templates/mail.html.ep:69
|
||||
msgid ":"
|
||||
msgstr " :"
|
||||
|
||||
#: templates/files.html.ep:84
|
||||
msgid ": Error while trying to get the counter."
|
||||
msgstr " : erreur en essayant de récupérer le compteur"
|
||||
|
||||
|
@ -59,7 +59,7 @@ msgstr "Copier tous les liens dans le presse-papier"
|
|||
msgid "Copy to clipboard"
|
||||
msgstr "Copier dans le presse-papier"
|
||||
|
||||
#: lib/Lufi/Controller/Files.pm:267
|
||||
#: lib/Lufi/Controller/Files.pm:282
|
||||
msgid "Could not find the file. Are you sure of the URL and the token?"
|
||||
msgstr "Impossible de retrouver le fichier. Êtes-vous sûr de l’URL et du jeton ?"
|
||||
|
||||
|
@ -67,15 +67,15 @@ msgstr "Impossible de retrouver le fichier. Êtes-vous sûr de l’URL et du jet
|
|||
msgid "Could not find the file. Are you sure of the URL?"
|
||||
msgstr "Impossible de retrouver le fichier. Êtes-vous sûr de l’URL ?"
|
||||
|
||||
#: templates/files.html.ep:15
|
||||
#: templates/files.html.ep:16
|
||||
msgid "Counter"
|
||||
msgstr "Compteur"
|
||||
|
||||
#: templates/files.html.ep:16 templates/index.html.ep:52
|
||||
#: templates/files.html.ep:17 templates/index.html.ep:52
|
||||
msgid "Delete at first download?"
|
||||
msgstr "Supprimer après le premier téléchargement ?"
|
||||
|
||||
#: templates/files.html.ep:19 templates/index.html.ep:79
|
||||
#: templates/files.html.ep:20 templates/index.html.ep:79
|
||||
msgid "Deletion link"
|
||||
msgstr "Lien de suppression"
|
||||
|
||||
|
@ -87,7 +87,7 @@ msgstr "Ne vous inquiétez pas : si un utilisateur commence à télécharger le
|
|||
msgid "Download"
|
||||
msgstr "Télécharger"
|
||||
|
||||
#: templates/files.html.ep:14 templates/index.html.ep:80
|
||||
#: templates/files.html.ep:15 templates/index.html.ep:80
|
||||
msgid "Download link"
|
||||
msgstr "Lien de téléchargement"
|
||||
|
||||
|
@ -123,19 +123,19 @@ msgstr "Erreur : impossible de retrouver le fichier. Êtes-vous sûr de l’URL
|
|||
msgid "Expiration:"
|
||||
msgstr "Expiration :"
|
||||
|
||||
#: templates/files.html.ep:18
|
||||
#: templates/files.html.ep:19
|
||||
msgid "Expires at"
|
||||
msgstr "Expire le"
|
||||
|
||||
#: lib/Lufi/Controller/Files.pm:251
|
||||
#: lib/Lufi/Controller/Files.pm:266
|
||||
msgid "File deleted"
|
||||
msgstr "Fichier supprimé"
|
||||
|
||||
#: templates/files.html.ep:13
|
||||
#: templates/files.html.ep:14
|
||||
msgid "File name"
|
||||
msgstr "Nom du fichier"
|
||||
|
||||
#: templates/mail.html.ep:65
|
||||
#: templates/mail.html.ep:64
|
||||
msgid "Hello,\\n\\nHere's some files I want to share with you:\\n"
|
||||
msgstr "Bonjour,\\n\\nVoici quelques fichiers que je souhaite partager avec toi:\\n"
|
||||
|
||||
|
@ -180,15 +180,14 @@ msgstr "Mes fichiers"
|
|||
msgid "No enough space available on the server for this file (size: %1)."
|
||||
msgstr "Espace disque insuffisant sur le serveur pour ce fichier (taille du fichier: %1)."
|
||||
|
||||
#: templates/files.html.ep:34 templates/index.html.ep:86
|
||||
#: templates/index.html.ep:86
|
||||
msgid "No expiration delay"
|
||||
msgstr "Pas de délai d’expiration"
|
||||
|
||||
#:
|
||||
msgid "No limit"
|
||||
msgstr "Aucune limite"
|
||||
|
||||
#: templates/files.html.ep:6
|
||||
#: templates/files.html.ep:7
|
||||
msgid "Only the files sent with this browser will be listed here. The informations are stored in localStorage: if you delete your localStorage data, you'll loose this informations."
|
||||
msgstr "Seuls les fichiers envoyés depuis ce navigateur sont listés ici. Les informations sont stockées en localStorage : si vous supprimez vos données localStorage, vous perdrez ces informations."
|
||||
|
||||
|
@ -196,6 +195,10 @@ msgstr "Seuls les fichiers envoyés depuis ce navigateur sont listés ici. Les i
|
|||
msgid "Please wait while we are getting your file"
|
||||
msgstr "Veuillez patienter pendant la récupération de votre fichier"
|
||||
|
||||
#: templates/files.html.ep:6
|
||||
msgid "Purge expired files from localStorage"
|
||||
msgstr "Supprimer du localStorage les fichiers expirés"
|
||||
|
||||
#: templates/index.html.ep:85
|
||||
msgid "Send all links by email"
|
||||
msgstr "Envoyer tous les liens par mail"
|
||||
|
@ -209,7 +212,7 @@ msgid "Send with your own mail software"
|
|||
msgstr "Envoyer avec votre propre logiciel de mail"
|
||||
|
||||
#. (url_for('/')
|
||||
#: templates/mail.html.ep:78
|
||||
#: templates/mail.html.ep:77
|
||||
msgid "Share your files in total privacy on %1"
|
||||
msgstr "Partagez vos fichiers en toute confidentialité sur %1"
|
||||
|
||||
|
@ -229,7 +232,7 @@ msgstr "Le corps du mail ne peut être vide."
|
|||
msgid "The email subject can't be empty."
|
||||
msgstr "Le sujet du mail ne peut être vide."
|
||||
|
||||
#: lib/Lufi/Controller/Files.pm:248
|
||||
#: lib/Lufi/Controller/Files.pm:263
|
||||
msgid "The file has already been deleted"
|
||||
msgstr "Le fichier a déjà été supprimé"
|
||||
|
||||
|
@ -246,16 +249,24 @@ msgstr "Le mail a été envoyé."
|
|||
msgid "This server sets limitations according to the file size. The expiration delay of your file will be the minimum between what you choose and the following limitations:"
|
||||
msgstr "Ce serveur impose des limitations selon la taille des fichiers. Le délai d’expiration de votre fichier sera le minimum entre ce que vous avez choisi et les limites suivantes :"
|
||||
|
||||
#. ($short)
|
||||
#: lib/Lufi/Controller/Files.pm:232
|
||||
msgid "Unable to get counter for %1. The file does not exists."
|
||||
msgstr "Impossible de récupérer le compteur de %1. Le fichier n’existe pas."
|
||||
|
||||
#. ($short)
|
||||
#: lib/Lufi/Controller/Files.pm:247
|
||||
msgid "Unable to get counter for %1. The file does not exists. It will be removed from your localStorage."
|
||||
msgstr "Impossible de récupérer le compteur pour %1. Le fichier n'existe pas. Il va être supprimé de votre localStorage."
|
||||
|
||||
#. ($short)
|
||||
#: lib/Lufi/Controller/Files.pm:237
|
||||
msgid "Unable to get counter for %1. The token is unvalid."
|
||||
msgstr "Impossible de récupérer le compteur pour %1. Le jeton est invalide."
|
||||
|
||||
#: templates/layouts/default.html.ep:39
|
||||
msgid "Upload files"
|
||||
msgstr "Envoyer des fichiers"
|
||||
|
||||
#: templates/files.html.ep:17
|
||||
#: templates/files.html.ep:18
|
||||
msgid "Uploaded at"
|
||||
msgstr "Envoyé le"
|
||||
|
||||
|
@ -294,7 +305,7 @@ msgstr "entre %1 et %2, le fichier sera conservé %3 jour(s) ;"
|
|||
msgid "between %1 and %2, the file will be kept forever."
|
||||
msgstr "entre %1 et %2, le fichier sera conservé indéfiniment ;"
|
||||
|
||||
#: templates/mail.html.ep:72
|
||||
#: templates/mail.html.ep:71
|
||||
msgid "deadline: "
|
||||
msgstr "dernier délai pour télécharger : "
|
||||
|
||||
|
|
|
@ -4,4 +4,5 @@
|
|||
.icon-trash:before { content: '\e802'; } /* '' */
|
||||
.icon-mail:before { content: '\e803'; } /* '' */
|
||||
.icon-help-circled:before { content: '\e804'; } /* '' */
|
||||
.icon-cancel:before { content: '\e805'; } /* '' */
|
||||
.icon-cancel:before { content: '\e805'; } /* '' */
|
||||
.icon-ok:before { content: '\e806'; } /* '' */
|
File diff suppressed because one or more lines are too long
|
@ -4,4 +4,5 @@
|
|||
.icon-trash { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
||||
.icon-mail { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
||||
.icon-help-circled { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
||||
.icon-cancel { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
||||
.icon-cancel { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
||||
.icon-ok { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
|
@ -15,4 +15,5 @@
|
|||
.icon-trash { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
||||
.icon-mail { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
||||
.icon-help-circled { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
||||
.icon-cancel { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
||||
.icon-cancel { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
||||
.icon-ok { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
|
@ -1,10 +1,10 @@
|
|||
@font-face {
|
||||
font-family: 'fontello';
|
||||
src: url('../font/fontello.eot?5451170');
|
||||
src: url('../font/fontello.eot?5451170#iefix') format('embedded-opentype'),
|
||||
url('../font/fontello.woff?5451170') format('woff'),
|
||||
url('../font/fontello.ttf?5451170') format('truetype'),
|
||||
url('../font/fontello.svg?5451170#fontello') format('svg');
|
||||
src: url('../font/fontello.eot?88898605');
|
||||
src: url('../font/fontello.eot?88898605#iefix') format('embedded-opentype'),
|
||||
url('../font/fontello.woff?88898605') format('woff'),
|
||||
url('../font/fontello.ttf?88898605') format('truetype'),
|
||||
url('../font/fontello.svg?88898605#fontello') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
|||
@media screen and (-webkit-min-device-pixel-ratio:0) {
|
||||
@font-face {
|
||||
font-family: 'fontello';
|
||||
src: url('../font/fontello.svg?5451170#fontello') format('svg');
|
||||
src: url('../font/fontello.svg?88898605#fontello') format('svg');
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
@ -59,4 +59,5 @@
|
|||
.icon-trash:before { content: '\e802'; } /* '' */
|
||||
.icon-mail:before { content: '\e803'; } /* '' */
|
||||
.icon-help-circled:before { content: '\e804'; } /* '' */
|
||||
.icon-cancel:before { content: '\e805'; } /* '' */
|
||||
.icon-cancel:before { content: '\e805'; } /* '' */
|
||||
.icon-ok:before { content: '\e806'; } /* '' */
|
|
@ -0,0 +1,75 @@
|
|||
This webfont is generated by http://fontello.com open source project.
|
||||
|
||||
|
||||
================================================================================
|
||||
Please, note, that you should obey original font licences, used to make this
|
||||
webfont pack. Details available in LICENSE.txt file.
|
||||
|
||||
- Usually, it's enough to publish content of LICENSE.txt file somewhere on your
|
||||
site in "About" section.
|
||||
|
||||
- If your project is open-source, usually, it will be ok to make LICENSE.txt
|
||||
file publically available in your repository.
|
||||
|
||||
- Fonts, used in Fontello, don't require a clickable link on your site.
|
||||
But any kind of additional authors crediting is welcome.
|
||||
================================================================================
|
||||
|
||||
|
||||
Comments on archive content
|
||||
---------------------------
|
||||
|
||||
- /font/* - fonts in different formats
|
||||
|
||||
- /css/* - different kinds of css, for all situations. Should be ok with
|
||||
twitter bootstrap. Also, you can skip <i> style and assign icon classes
|
||||
directly to text elements, if you don't mind about IE7.
|
||||
|
||||
- demo.html - demo file, to show your webfont content
|
||||
|
||||
- LICENSE.txt - license info about source fonts, used to build your one.
|
||||
|
||||
- config.json - keeps your settings. You can import it back into fontello
|
||||
anytime, to continue your work
|
||||
|
||||
|
||||
Why so many CSS files ?
|
||||
-----------------------
|
||||
|
||||
Because we like to fit all your needs :)
|
||||
|
||||
- basic file, <your_font_name>.css - is usually enough, it contains @font-face
|
||||
and character code definitions
|
||||
|
||||
- *-ie7.css - if you need IE7 support, but still don't wish to put char codes
|
||||
directly into html
|
||||
|
||||
- *-codes.css and *-ie7-codes.css - if you like to use your own @font-face
|
||||
rules, but still wish to benefit from css generation. That can be very
|
||||
convenient for automated asset build systems. When you need to update font -
|
||||
no need to manually edit files, just override old version with archive
|
||||
content. See fontello source code for examples.
|
||||
|
||||
- *-embedded.css - basic css file, but with embedded WOFF font, to avoid
|
||||
CORS issues in Firefox and IE9+, when fonts are hosted on the separate domain.
|
||||
We strongly recommend to resolve this issue by `Access-Control-Allow-Origin`
|
||||
server headers. But if you ok with dirty hack - this file is for you. Note,
|
||||
that data url moved to separate @font-face to avoid problems with <IE9, when
|
||||
string is too long.
|
||||
|
||||
- animate.css - use it to get ideas about spinner rotation animation.
|
||||
|
||||
|
||||
Attention for server setup
|
||||
--------------------------
|
||||
|
||||
You MUST setup server to reply with proper `mime-types` for font files -
|
||||
otherwise some browsers will fail to show fonts.
|
||||
|
||||
Usually, `apache` already has necessary settings, but `nginx` and other
|
||||
webservers should be tuned. Here is list of mime types for our file extensions:
|
||||
|
||||
- `application/vnd.ms-fontobject` - eot
|
||||
- `application/x-font-woff` - woff
|
||||
- `application/x-font-ttf` - ttf
|
||||
- `image/svg+xml` - svg
|
Binary file not shown.
|
@ -12,6 +12,7 @@
|
|||
<glyph glyph-name="mail" unicode="" d="m0 28v644q0 8 2 18l460-460q39-39 95-39 55 0 94 39l460 460q2-9 2-18v-644q0-37-26-62t-62-26h-937q-36 0-62 26t-26 62z m63 728q13 4 25 4h937q12 0 25-4l-463-463q-13-12-31-12t-30 12z" horiz-adv-x="1113.3" />
|
||||
<glyph glyph-name="help-circled" unicode="" d="m500 82v107q0 8-5 13t-13 5h-107q-8 0-13-5t-5-13v-107q0-8 5-13t13-5h107q8 0 13 5t5 13z m143 375q0 49-31 91t-77 65-95 23q-136 0-207-119-9-14 4-24l74-55q4-4 10-4 9 0 14 7 30 38 48 51 19 14 48 14 27 0 48-15t21-33q0-21-11-34t-38-25q-35-16-65-48t-29-70v-20q0-8 5-13t13-5h107q8 0 13 5t5 13q0 10 12 27t30 28q18 10 28 16t25 19 25 27 16 34 7 45z m214-107q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
|
||||
<glyph glyph-name="cancel" unicode="" d="m724 112q0-22-15-38l-76-76q-16-15-38-15t-38 15l-164 165-164-165q-16-15-38-15t-38 15l-76 76q-16 16-16 38t16 38l164 164-164 164q-16 16-16 38t16 38l76 76q16 16 38 16t38-16l164-164 164 164q16 16 38 16t38-16l76-76q15-15 15-38t-15-38l-164-164 164-164q15-15 15-38z" horiz-adv-x="785.7" />
|
||||
<glyph glyph-name="ok" unicode="" d="m932 534q0-22-15-38l-404-404-76-76q-16-15-38-15t-38 15l-76 76-202 202q-15 16-15 38t15 38l76 76q16 16 38 16t38-16l164-165 366 367q16 16 38 16t38-16l76-76q15-16 15-38z" horiz-adv-x="1000" />
|
||||
</font>
|
||||
</defs>
|
||||
</svg>
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.6 KiB |
Binary file not shown.
Binary file not shown.
|
@ -6,6 +6,12 @@
|
|||
"units_per_em": 1000,
|
||||
"ascent": 850,
|
||||
"glyphs": [
|
||||
{
|
||||
"uid": "12f4ece88e46abd864e40b35e05b11cd",
|
||||
"css": "ok",
|
||||
"code": 59398,
|
||||
"src": "fontawesome"
|
||||
},
|
||||
{
|
||||
"uid": "5211af474d3a9848f67f945e2ccaf143",
|
||||
"css": "cancel",
|
||||
|
|
|
@ -58,6 +58,7 @@ function spawnWebsocket() {
|
|||
|
||||
if (data.msg !== undefined) {
|
||||
addAlert(data.msg);
|
||||
window.onbeforeunload = null;
|
||||
} else {
|
||||
var slice = JSON.parse(res.shift());
|
||||
var percent = Math.round(100 * (data.part + 1)/data.total);
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
function delItem(name) {
|
||||
var files = localStorage.getItem('files');
|
||||
if (files === null) {
|
||||
files = new Array();
|
||||
} else {
|
||||
files = JSON.parse(files);
|
||||
}
|
||||
var i;
|
||||
for (i = 0; i < files.length; i++) {
|
||||
if (files[i].short === name) {
|
||||
files.splice(i, 1);
|
||||
}
|
||||
}
|
||||
localStorage.setItem('files', JSON.stringify(files));
|
||||
}
|
||||
|
||||
function purgeExpired() {
|
||||
var files = JSON.parse(localStorage.getItem('files'));
|
||||
|
||||
files.forEach(function(element, index, array) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', counterURL);
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState>3 && xhr.status==200) {
|
||||
var data = JSON.parse(xhr.responseText);
|
||||
if (data.success) {
|
||||
if (data.deleted) {
|
||||
document.getElementById('count-'+data.short).parentNode.remove();
|
||||
delItem(data.short);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||
xhr.send('short='+element.short+'&token='+element.token);
|
||||
});
|
||||
}
|
||||
|
||||
function populateFilesTable() {
|
||||
var files = JSON.parse(localStorage.getItem('files'));
|
||||
files.reverse();
|
||||
files.forEach(function(element, index, array) {
|
||||
var del_view = (element.del_at_first_view) ? '<span class="icon icon-ok"></span>' : '<span class="icon icon-cancel"></span>';
|
||||
var dlink = baseURL+'d/'+element.short+'/'+element.token;
|
||||
var limit = (element.delay === 0) ? i18n.noExpiration : moment.unix(element.delay * 86400 + element.created_at).locale(window.navigator.language).format('LLLL');
|
||||
var created_at = moment.unix(element.created_at).locale(window.navigator.language).format('LLLL');
|
||||
|
||||
var tr = document.createElement('tr');
|
||||
tr.innerHTML = '<td class="text-left">'
|
||||
+element.name
|
||||
+'</td><td class="text-left">'
|
||||
+'<a href="'+element.url+'" class="classic">'+element.url+'</a>'
|
||||
+'</td><td id="count-'+element.short+'" class="text-center">'
|
||||
+'</td><td class="text-center">'
|
||||
+del_view
|
||||
+'</td><td>'
|
||||
+created_at
|
||||
+'</td><td>'
|
||||
+limit
|
||||
+'</td><td class="text-left">'
|
||||
+'<a href="'+dlink+'" class="classic">'+dlink+'</a>'
|
||||
+'</td>';
|
||||
document.getElementById('myfiles').appendChild(tr);
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', counterURL);
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState>3 && xhr.status==200) {
|
||||
var data = JSON.parse(xhr.responseText);
|
||||
if (data.success) {
|
||||
document.getElementById('count-'+data.short).innerHTML = data.counter;
|
||||
} else {
|
||||
alert(data.msg);
|
||||
document.getElementById('count-'+data.short).parentNode.remove();
|
||||
if (data.missing) {
|
||||
delItem(data.short);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||
xhr.send('short='+element.short+'&token='+element.token);
|
||||
});
|
||||
}
|
|
@ -3,6 +3,7 @@
|
|||
<hr>
|
||||
|
||||
<p>
|
||||
<a href="#" onclick="purgeExpired();" class="pull-right btn btn-info btn-xs"><%= l('Purge expired files from localStorage') %></a>
|
||||
<%= l('Only the files sent with this browser will be listed here. The informations are stored in localStorage: if you delete your localStorage data, you\'ll loose this informations.') %>
|
||||
</p>
|
||||
|
||||
|
@ -25,69 +26,14 @@
|
|||
</div>
|
||||
|
||||
%= javascript begin
|
||||
function populateFilesTable() {
|
||||
var files = JSON.parse(localStorage.getItem('files'));
|
||||
files.reverse();
|
||||
files.forEach(function(element, index, array) {
|
||||
var del_view = (element.del_at_first_view) ? '<span class="glyphicon glyphicon-ok"></span>' : '<span class="glyphicon glyphicon-remove"></span>';
|
||||
var dlink = '<%== url_for('/')->to_abs() %>d/'+element.short+'/'+element.token;
|
||||
var limit = (element.delay === 0) ? '<%= l('No expiration delay') %>' : moment.unix(element.delay * 86400 + element.created_at).locale(window.navigator.language).format('LLLL');
|
||||
var created_at = moment.unix(element.created_at).locale(window.navigator.language).format('LLLL');
|
||||
|
||||
var tr = document.createElement('tr');
|
||||
tr.innerHTML = '<td class="text-left">'
|
||||
+element.name
|
||||
+'</td><td class="text-left">'
|
||||
+'<a href="'+element.url+'" class="classic">'+element.url+'</a>'
|
||||
+'</td><td id="count-'+element.short+'" class="text-center">'
|
||||
+'</td><td class="text-center">'
|
||||
+del_view
|
||||
+'</td><td>'
|
||||
+created_at
|
||||
+'</td><td>'
|
||||
+limit
|
||||
+'</td><td class="text-left">'
|
||||
+'<a href="'+dlink+'" class="classic">'+dlink+'</a>'
|
||||
+'</td>';
|
||||
document.getElementById('myfiles').appendChild(tr);
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', '<%== url_for('counter') %>');
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState>3 && xhr.status==200) {
|
||||
var data = JSON.parse(xhr.responseText);
|
||||
if (data.success) {
|
||||
document.getElementById('count-'+element.short).innerHTML = data.counter;
|
||||
} else {
|
||||
alert(data.msg);
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||
xhr.send('short='+element.short+'&token='+element.token);
|
||||
|
||||
/*$.ajax({
|
||||
url : '<%== url_for('counter') %>',
|
||||
type : 'POST',
|
||||
data : {
|
||||
'short': element.short,
|
||||
'token': element.token
|
||||
},
|
||||
success: function(data) {
|
||||
if (data.success) {
|
||||
$('#count-'+element.id).text(data.counter);
|
||||
} else {
|
||||
alert(data.msg);
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
alert(element.filename+'<%= l(': Error while trying to get the counter.') %>');
|
||||
}
|
||||
});*/
|
||||
});
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
populateFilesTable();
|
||||
});
|
||||
var baseURL = '<%== url_for('/')->to_abs() %>';
|
||||
var counterURL = '<%== url_for('counter') %>';
|
||||
var i18n = {
|
||||
noExpiration: '<%== url_for('counter') %>',
|
||||
};
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
populateFilesTable();
|
||||
});
|
||||
% end
|
||||
%= javascript '/js/lufi-files.js'
|
||||
%= javascript '/js/moment-with-locales.min.js'
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
} else {
|
||||
files = JSON.parse(files);
|
||||
}
|
||||
var r = null;
|
||||
var i;
|
||||
for (i = 0; i < files.length; i++) {
|
||||
if (files[i].short === name) {
|
||||
|
|
Loading…
Reference in New Issue