diff --git a/README.md b/README.md index 2859316..be54290 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,10 @@ to expireCron: cli +### Security + +https://github.com/blueimp/jQuery-File-Upload/blob/master/SECURITY.md#secure-file-upload-serving-configurations + ## Changelog - futur @@ -80,6 +84,28 @@ to - Housekeeping in files expired by cron job or by web traffic on the page - Personnalize content page with include header-page.php, header.php, footer-page.php, footer.php, start-home.php, end-home.php +# Monitoring with munin + +```bash +cd munin +cp file2link_* /etc/munin/plugins/ +``` + +On /etc/munin/plugin-conf.d/munin-node file, add your "files" dir : + +```ini + [...] + + [file2link_*] + env.dir /var/www/dl.zici.fr/files +``` + +And restart munin node + +```bash +/etc/init.d/munin-node restart +``` + # Licence Beerware : https://en.wikipedia.org/wiki/Beerware diff --git a/config.yaml.dist b/config.yaml.dist index 8532e56..50e8757 100644 --- a/config.yaml.dist +++ b/config.yaml.dist @@ -32,7 +32,7 @@ maxUploadPerFile: 30M minUploadPerFile: 1 # Exemple 100K, 30M, 12G maxUploadTotal: 90M # Exemple 100K, 30M, 12G maxUploadNb: 100 -acceptFileTypes: '/(\.|\/)(pdf|od[a-z]|doc[a-z]?|xls[a-z]?|csv|ppt[a-z]?|7z|zip|bz|bz2|rar|tar|gz|tgz|txt|md|gif|jpe?g|png|bmp|ico|mp3|aac|mid|wav|ov[a-z]|web.?|avi|mp[a-z]?g|mp.+|wm.+|xml|iso|torrent)$/i' +acceptFileTypes: '/(\.|\/)(pdf|xml|od[a-z]|doc[a-z]?|xls[a-z]?|csv|ppt[a-z]?|7z|zip|bz|bz2|rar|tar|gz|tgz|txt|md|gif|jpe?g|png|svg|bmp|ico|mp3|aac|mid|wav|ov[a-z]|web.?|avi|mp[a-z]?g|mov|mp.+|wm.+|xml|iso|torrent)$/i' #~ Set to 0 to use the GD library to scale and orient images, #~ set to 1 to use imagick (if installed, falls back to GD), #~ set to 2 to use the ImageMagick convert binary directly: diff --git a/index.php b/index.php index 6ee0711..56cbe7e 100644 --- a/index.php +++ b/index.php @@ -1038,10 +1038,12 @@ if ($passwordForm == false) { } }, failed: function (e, data) { + console.log(data); + console.log(e); // Si un upload est en cours if (data.loaded > 0) { //~ console.log(data); - location.href='/'+$('#files_id').val()+'/'; + //~ location.href='/'+$('#files_id').val()+'/'; $('#files_id').val(idGen()); $('#shareUrl').val('/' + $('#files_id').val() + '/'); var keyGen = Math.floor(Math.random() * (999999999999 - 100000000000) + 100000000000); @@ -1089,8 +1091,7 @@ if ($passwordForm == false) { setTimeout(redirectToFiles, 1000); } }); - - + $('#files_id').val(''); diff --git a/munin/file2link_count b/munin/file2link_count new file mode 100755 index 0000000..f6ef42f --- /dev/null +++ b/munin/file2link_count @@ -0,0 +1,47 @@ +#!/bin/sh + +if [ -z $dir ]; then + dir='/var/www/file2link/files/' +fi + +output_config() { + echo "graph_title File2link Statistic Count" + echo "file2link_nb.label count files hosting" +} + +output_values() { + printf "file2link_nb.value %d\n" $(number_of_file) +} + +number_of_file() { + ls $dir | wc -l +} +size_of_file() { + du -s $dir/ | cut -f1 +} + +output_usage() { + printf >&2 "%s - munin plugin to graph file2link\n" ${0##*/} + printf >&2 "Usage: %s [config]\n" ${0##*/} +} + +case $# in + 0) + output_values + ;; + 1) + case $1 in + config) + output_config + ;; + *) + output_usage + exit 1 + ;; + esac + ;; + *) + output_usage + exit 1 + ;; +esac diff --git a/munin/file2link_size b/munin/file2link_size new file mode 100755 index 0000000..1792755 --- /dev/null +++ b/munin/file2link_size @@ -0,0 +1,47 @@ +#!/bin/sh + +if [ -z $dir ]; then + dir='/var/www/file2link/files/' +fi + +output_config() { + echo "graph_title File2link Statistic Size" + echo "file2link_size.label Total size of files hosting" +} + +output_values() { + printf "file2link_size.value %d000\n" $(size_of_file) +} + +number_of_file() { + ls $dir | wc -l +} +size_of_file() { + du -s $dir/ | cut -f1 +} + +output_usage() { + printf >&2 "%s - munin plugin to graph file2link\n" ${0##*/} + printf >&2 "Usage: %s [config]\n" ${0##*/} +} + +case $# in + 0) + output_values + ;; + 1) + case $1 in + config) + output_config + ;; + *) + output_usage + exit 1 + ;; + esac + ;; + *) + output_usage + exit 1 + ;; +esac