splewis / get5

CS:GO Sourcemod plugin for competitive matches/scrims
GNU General Public License v3.0
558 stars 176 forks source link

Cleaned up remote match load logic #896

Closed nickdnk closed 1 year ago

nickdnk commented 1 year ago

This cleans up the implementation of remote loading of match configurations.

  1. Reuse the HTTP "client" from http.sp.
  2. Remove g_LoadedConfigUrl global variable and use HTTP context datapack.
  3. Giver better feedback on errors, such as missing quotes around URLs.
  4. Early return where applicable.
  5. Remove unnecessary stock modifier.
  6. Delete temporary local match configuration files if they load successfully; let them remain if not for debugging.
  7. Remove duplicate SteamWorks dependency check.
  8. Consistently use MatchConfigFail instead of LogError in this context.
  9. Validate the input for the get5_loadmatch_url command before rejecting it due to already loaded config.
  10. Only set g_LoadedConfigFile to the loaded URL if the config successfully loads.

Tested and works fine. Tested invalid parameters, invalid URL, request timeout, 404 (non-200 range), invalid match config file, successful load etc.