From 421967ea81a298638dacda71de918692fc63c0dc Mon Sep 17 00:00:00 2001 From: Danny Coates Date: Thu, 28 Feb 2019 16:31:37 -0800 Subject: [PATCH] updated default config values --- app/ui/archiveTile.js | 6 +++--- app/utils.js | 6 ++++-- server/config.js | 10 +++++----- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/app/ui/archiveTile.js b/app/ui/archiveTile.js index f59e8f13..6be02202 100644 --- a/app/ui/archiveTile.js +++ b/app/ui/archiveTile.js @@ -408,7 +408,7 @@ module.exports.empty = function(state, emit) { }}" > ${state.translate('signInSizeBump', { - size: bytes(state.LIMITS.MAX_FILE_SIZE, 0) + size: bytes(state.LIMITS.MAX_FILE_SIZE) })} `; @@ -445,11 +445,11 @@ module.exports.empty = function(state, emit) { role="button" class="btn rounded-lg flex items-center mt-4" title="${state.translate('addFilesButtonWithSize', { - size: bytes(state.user.maxSize, 0) + size: bytes(state.user.maxSize) })}" > ${state.translate('addFilesButtonWithSize', { - size: bytes(state.user.maxSize, 0) + size: bytes(state.user.maxSize) })} ${upsell} diff --git a/app/utils.js b/app/utils.js index 4f2fa648..49c6f7b4 100644 --- a/app/utils.js +++ b/app/utils.js @@ -57,13 +57,15 @@ const LOCALIZE_NUMBERS = !!( ); const UNITS = ['B', 'kB', 'MB', 'GB']; -function bytes(num, decimalDigits = 1) { +function bytes(num) { if (num < 1) { return '0B'; } const exponent = Math.min(Math.floor(Math.log10(num) / 3), UNITS.length - 1); const n = Number(num / Math.pow(1024, exponent)); - let nStr = n.toFixed(1); + const decimalDigits = Math.floor(n) === n ? 0 : 1; + console.log(n, decimalDigits); + let nStr = n.toFixed(decimalDigits); if (LOCALIZE_NUMBERS) { try { const locale = document.querySelector('html').lang; diff --git a/server/config.js b/server/config.js index e0f0bbca..2eec44a8 100644 --- a/server/config.js +++ b/server/config.js @@ -36,17 +36,17 @@ const conf = convict({ }, download_counts: { format: Array, - default: [1, 2, 3, 4, 5, 20, 50, 100, 200], + default: [1, 2, 3, 4, 5, 20, 50, 100], env: 'DOWNLOAD_COUNTS' }, max_downloads: { format: Number, - default: 200, + default: 100, env: 'MAX_DOWNLOADS' }, anon_max_downloads: { format: Number, - default: 20, + default: 5, env: 'ANON_MAX_DOWNLOADS' }, max_files_per_archive: { @@ -107,12 +107,12 @@ const conf = convict({ }, max_file_size: { format: Number, - default: 1024 * 1024 * 1024 * 4, + default: 1024 * 1024 * 1024 * 2.5, env: 'MAX_FILE_SIZE' }, anon_max_file_size: { format: Number, - default: 1024 * 1024 * 500, + default: 1024 * 1024 * 1024, env: 'ANON_MAX_FILE_SIZE' }, l10n_dev: {