Makes client upload limit a config, bumps admin file size upload limit to 5mb (from 2.5mb) (#77708)

## About The Pull Request
Makes client upload limit a config. Increases max file size admins can
upload to 5mb, up from 2.5mb.
## Why It's Good For The Game
Makes it easier to do custom maps for events. Some of our in-game maps
are already larger than 2.5mb (delta is almost 3mb).
## Changelog
🆑
admin: admins can now upload files to the server up to 5mb (used to be
2.5mb)
config: file upload restriction is now config
/🆑
This commit is contained in:
Striders13
2023-08-19 23:19:55 +05:00
committed by GitHub
parent 7d18b63170
commit bf6648b3a9
3 changed files with 20 additions and 9 deletions
+6 -9
View File
@@ -1,8 +1,6 @@
////////////
//SECURITY//
////////////
#define UPLOAD_LIMIT 524288 //Restricts client uploads to the server to 0.5MB
#define UPLOAD_LIMIT_ADMIN 2621440 //Restricts admin client uploads to the server to 2.5MB
GLOBAL_LIST_INIT(blacklisted_builds, list(
"1407" = "bug preventing client display overrides from working leads to clients being able to see things/mobs they shouldn't be able to see",
@@ -203,12 +201,14 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
//This stops files larger than UPLOAD_LIMIT being sent from client to server via input(), client.Import() etc.
/client/AllowUpload(filename, filelength)
var/client_max_file_size = CONFIG_GET(number/upload_limit)
if (holder)
if(filelength > UPLOAD_LIMIT_ADMIN)
to_chat(src, "<font color='red'>Error: AllowUpload(): File Upload too large. Upload Limit: [UPLOAD_LIMIT_ADMIN/1024]KiB.</font>")
var/admin_max_file_size = CONFIG_GET(number/upload_limit_admin)
if(filelength > admin_max_file_size)
to_chat(src, span_warning("Error: AllowUpload(): File Upload too large. Upload Limit: [admin_max_file_size/1024]KiB."))
return FALSE
else if(filelength > UPLOAD_LIMIT)
to_chat(src, "<font color='red'>Error: AllowUpload(): File Upload too large. Upload Limit: [UPLOAD_LIMIT/1024]KiB.</font>")
else if(filelength > client_max_file_size)
to_chat(src, span_warning("Error: AllowUpload(): File Upload too large. Upload Limit: [client_max_file_size/1024]KiB."))
return FALSE
return TRUE
@@ -911,8 +911,6 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
add_verb(src, /client/proc/export_preferences)
#undef UPLOAD_LIMIT
//checks if a client is afk
//3000 frames = 5 minutes
/client/proc/is_afk(duration = CONFIG_GET(number/inactivity_period))
@@ -1238,4 +1236,3 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
#undef LIMITER_SIZE
#undef MINUTE_COUNT
#undef SECOND_COUNT
#undef UPLOAD_LIMIT_ADMIN