1
0
Fork 0
mirror of https://codeberg.org/demostf/plugin.git synced 2026-06-04 00:54:08 +02:00

Merge pull request #9 from TheBv/master

Fixed issues with handling responses that don't link to the STV
This commit is contained in:
Robin Appelman 2022-12-23 19:19:32 +01:00 committed by GitHub
commit 62f7dc8fc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 13 deletions

Binary file not shown.

View file

@ -7,7 +7,7 @@ public Plugin:myinfo =
name = "demos.tf uploader", name = "demos.tf uploader",
author = "Icewind", author = "Icewind",
description = "Auto-upload match stv to demos.tf", description = "Auto-upload match stv to demos.tf",
version = "0.3", version = "0.3.1",
url = "https://demos.tf" url = "https://demos.tf"
}; };
@ -164,22 +164,26 @@ public ShowResponse()
strcopy(url, sizeof(url), output); strcopy(url, sizeof(url), output);
// Get the url part if (StrContains(url, "STV available at: ") != -1)
ReplaceString(url, sizeof(url), "STV available at: ", "");
// Split the string on '/'
ExplodeString(url, "/", url_parts, sizeof(url_parts), sizeof(url_parts[]));
// Find the last part of the url
for (int i = sizeof(url_parts) -1; i >= 0; i--)
{ {
if (!StrEqual(url_parts[i], "")){ // Get the url part
demoid = url_parts[i]; ReplaceString(url, sizeof(url), "STV available at: ", "");
break; // Split the string on '/'
ExplodeString(url, "/", url_parts, sizeof(url_parts), sizeof(url_parts[]));
// Find the last part of the url
for (int i = sizeof(url_parts) -1; i >= 0; i--)
{
if (!StrEqual(url_parts[i], "")){
demoid = url_parts[i];
break;
}
} }
CallDemoUploaded(true, demoid, url);
return;
} }
CallDemoUploaded(true, demoid, url); CallDemoUploaded(false, "", "");
return; return;
} }