Remove obsolete anonymous limits

Related to https://gitlab.com/timvisee/send/-/issues/3
This commit is contained in:
timvisee 2021-04-12 15:19:02 +02:00
parent 9e4c063749
commit 15d37da667
No known key found for this signature in database
GPG Key ID: B8DB720BC383E172
5 changed files with 7 additions and 39 deletions

View File

@ -81,21 +81,15 @@ export default class User {
}
get maxSize() {
return this.loggedIn
? this.limits.MAX_FILE_SIZE
: this.limits.ANON.MAX_FILE_SIZE;
return this.limits.MAX_FILE_SIZE;
}
get maxExpireSeconds() {
return this.loggedIn
? this.limits.MAX_EXPIRE_SECONDS
: this.limits.ANON.MAX_EXPIRE_SECONDS;
return this.limits.MAX_EXPIRE_SECONDS;
}
get maxDownloads() {
return this.loggedIn
? this.limits.MAX_DOWNLOADS
: this.limits.ANON.MAX_DOWNLOADS;
return this.limits.MAX_DOWNLOADS;
}
async metricId() {

View File

@ -2,11 +2,6 @@ const config = require('./config');
module.exports = {
LIMITS: {
ANON: {
MAX_FILE_SIZE: config.anon_max_file_size,
MAX_DOWNLOADS: config.anon_max_downloads,
MAX_EXPIRE_SECONDS: config.anon_max_expire_seconds
},
MAX_FILE_SIZE: config.max_file_size,
MAX_DOWNLOADS: config.max_downloads,
MAX_EXPIRE_SECONDS: config.max_expire_seconds,

View File

@ -39,11 +39,6 @@ const conf = convict({
default: 86400 * 7,
env: 'MAX_EXPIRE_SECONDS'
},
anon_max_expire_seconds: {
format: Number,
default: 86400,
env: 'ANON_MAX_EXPIRE_SECONDS'
},
download_counts: {
format: Array,
default: [1, 2, 3, 4, 5, 20, 50, 100],
@ -54,11 +49,6 @@ const conf = convict({
default: 100,
env: 'MAX_DOWNLOADS'
},
anon_max_downloads: {
format: Number,
default: 5,
env: 'ANON_MAX_DOWNLOADS'
},
max_files_per_archive: {
format: Number,
default: 64,
@ -120,11 +110,6 @@ const conf = convict({
default: 1024 * 1024 * 1024 * 2.5,
env: 'MAX_FILE_SIZE'
},
anon_max_file_size: {
format: Number,
default: 1024 * 1024 * 1024,
env: 'ANON_MAX_FILE_SIZE'
},
l10n_dev: {
format: Boolean,
default: false,

View File

@ -2,7 +2,7 @@ const config = require('../config');
const storage = require('../storage');
module.exports = function(req, res) {
const max = req.user ? config.max_downloads : config.anon_max_downloads;
const max = config.max_downloads;
const dlimit = req.body.dlimit;
if (!dlimit || dlimit > max) {
return res.sendStatus(400);

View File

@ -30,15 +30,9 @@ module.exports = function(ws, req) {
const metadata = fileInfo.fileMetadata;
const auth = fileInfo.authorization;
const user = await fxa.verify(fileInfo.bearer);
const maxFileSize = user
? config.max_file_size
: config.anon_max_file_size;
const maxExpireSeconds = user
? config.max_expire_seconds
: config.anon_max_expire_seconds;
const maxDownloads = user
? config.max_downloads
: config.anon_max_downloads;
const maxFileSize = config.max_file_size;
const maxExpireSeconds = config.max_expire_seconds;
const maxDownloads = config.max_downloads;
if (config.fxa_required && !user) {
ws.send(