updated default config values

This commit is contained in:
Danny Coates 2019-02-28 16:31:37 -08:00
parent 3bd2996c14
commit 421967ea81
No known key found for this signature in database
GPG Key ID: 4C442633C62E00CB
3 changed files with 12 additions and 10 deletions

View File

@ -408,7 +408,7 @@ module.exports.empty = function(state, emit) {
}}" }}"
> >
${state.translate('signInSizeBump', { ${state.translate('signInSizeBump', {
size: bytes(state.LIMITS.MAX_FILE_SIZE, 0) size: bytes(state.LIMITS.MAX_FILE_SIZE)
})} })}
</button> </button>
`; `;
@ -445,11 +445,11 @@ module.exports.empty = function(state, emit) {
role="button" role="button"
class="btn rounded-lg flex items-center mt-4" class="btn rounded-lg flex items-center mt-4"
title="${state.translate('addFilesButtonWithSize', { title="${state.translate('addFilesButtonWithSize', {
size: bytes(state.user.maxSize, 0) size: bytes(state.user.maxSize)
})}" })}"
> >
${state.translate('addFilesButtonWithSize', { ${state.translate('addFilesButtonWithSize', {
size: bytes(state.user.maxSize, 0) size: bytes(state.user.maxSize)
})} })}
</label> </label>
${upsell} ${upsell}

View File

@ -57,13 +57,15 @@ const LOCALIZE_NUMBERS = !!(
); );
const UNITS = ['B', 'kB', 'MB', 'GB']; const UNITS = ['B', 'kB', 'MB', 'GB'];
function bytes(num, decimalDigits = 1) { function bytes(num) {
if (num < 1) { if (num < 1) {
return '0B'; return '0B';
} }
const exponent = Math.min(Math.floor(Math.log10(num) / 3), UNITS.length - 1); const exponent = Math.min(Math.floor(Math.log10(num) / 3), UNITS.length - 1);
const n = Number(num / Math.pow(1024, exponent)); 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) { if (LOCALIZE_NUMBERS) {
try { try {
const locale = document.querySelector('html').lang; const locale = document.querySelector('html').lang;

View File

@ -36,17 +36,17 @@ const conf = convict({
}, },
download_counts: { download_counts: {
format: Array, format: Array,
default: [1, 2, 3, 4, 5, 20, 50, 100, 200], default: [1, 2, 3, 4, 5, 20, 50, 100],
env: 'DOWNLOAD_COUNTS' env: 'DOWNLOAD_COUNTS'
}, },
max_downloads: { max_downloads: {
format: Number, format: Number,
default: 200, default: 100,
env: 'MAX_DOWNLOADS' env: 'MAX_DOWNLOADS'
}, },
anon_max_downloads: { anon_max_downloads: {
format: Number, format: Number,
default: 20, default: 5,
env: 'ANON_MAX_DOWNLOADS' env: 'ANON_MAX_DOWNLOADS'
}, },
max_files_per_archive: { max_files_per_archive: {
@ -107,12 +107,12 @@ const conf = convict({
}, },
max_file_size: { max_file_size: {
format: Number, format: Number,
default: 1024 * 1024 * 1024 * 4, default: 1024 * 1024 * 1024 * 2.5,
env: 'MAX_FILE_SIZE' env: 'MAX_FILE_SIZE'
}, },
anon_max_file_size: { anon_max_file_size: {
format: Number, format: Number,
default: 1024 * 1024 * 500, default: 1024 * 1024 * 1024,
env: 'ANON_MAX_FILE_SIZE' env: 'ANON_MAX_FILE_SIZE'
}, },
l10n_dev: { l10n_dev: {