Skip to content
Snippets Groups Projects
Commit aa48840e authored by echicken's avatar echicken :chicken:
Browse files

Prevent download if !dir is_exempt and file credits > user

total credits.
Set an 'error' property on reply if file not found or not
enough credits.
parent a03cd7df
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
load('sbbsdefs.js');
var settings = load('modopts.js', 'web');
load(settings.web_directory + '/lib/init.js');
......@@ -29,7 +30,14 @@ if ((http_request.method === 'GET' || http_request.method === 'POST') &&
return true;
}
});
if (file === null) break;
if (file === null) {
reply.error = 'File not found';
break;
}
if (!file_area.dir[dircode].is_exempt && file.credits > (user.security.credits + user.security.free_credits)) {
reply.error = 'Not enough credits to download this file';
break;
}
http_reply.header['Content-Type'] = 'application/octet-stream';
http_reply.header['Content-Disposition'] = 'attachment; filename="' + file.base + '.' + file.ext + '"';
http_reply.header['Content-Encoding'] = 'binary';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment