Revert "Disable server-side functionality in custom ASF builds"

This reverts commit 42ceb6d413.
This commit is contained in:
Archi 2023-12-04 23:06:11 +01:00
parent e14d00b760
commit a7b1e01161
No known key found for this signature in database
GPG key ID: 6B138B4C64555AEA
5 changed files with 1 additions and 56 deletions

View file

@ -65,10 +65,6 @@ internal static class Backend {
ArgumentNullException.ThrowIfNull(inventoryRemoved);
ArgumentException.ThrowIfNullOrEmpty(previousInventoryChecksum);
if (SharedInfo.BuildInfo.IsCustomBuild) {
return null;
}
Uri request = new(ArchiNet.URL, "/Api/Listing/AnnounceDiff/v2");
AnnouncementDiffRequest data = new(ASF.GlobalDatabase?.Identifier ?? Guid.NewGuid(), steamID, inventory, inventoryChecksum, acceptedMatchableTypes, totalInventoryCount, matchEverything, ASF.GlobalConfig?.MaxTradeHoldDuration ?? GlobalConfig.DefaultMaxTradeHoldDuration, tradeToken, inventoryRemoved, previousInventoryChecksum, nickname, avatarHash);
@ -100,10 +96,6 @@ internal static class Backend {
throw new ArgumentOutOfRangeException(nameof(tradeToken));
}
if (SharedInfo.BuildInfo.IsCustomBuild) {
return null;
}
Uri request = new(ArchiNet.URL, "/Api/Listing/Announce/v5");
AnnouncementRequest data = new(ASF.GlobalDatabase?.Identifier ?? Guid.NewGuid(), steamID, inventory, inventoryChecksum, acceptedMatchableTypes, totalInventoryCount, matchEverything, ASF.GlobalConfig?.MaxTradeHoldDuration ?? GlobalConfig.DefaultMaxTradeHoldDuration, tradeToken, nickname, avatarHash);
@ -135,10 +127,6 @@ internal static class Backend {
throw new ArgumentNullException(nameof(acceptedMatchableTypes));
}
if (SharedInfo.BuildInfo.IsCustomBuild) {
return null;
}
Uri request = new(ArchiNet.URL, "/Api/Listing/Inventories/v2");
Dictionary<string, string> headers = new(1, StringComparer.Ordinal) {
@ -171,10 +159,6 @@ internal static class Backend {
throw new ArgumentNullException(nameof(realAppIDs));
}
if (SharedInfo.BuildInfo.IsCustomBuild) {
return null;
}
Uri request = new(ArchiNet.URL, "/Api/SetParts/Request");
SetPartsRequest data = new(ASF.GlobalDatabase?.Identifier ?? Guid.NewGuid(), steamID, matchableTypes, realAppIDs);
@ -186,10 +170,6 @@ internal static class Backend {
ArgumentNullException.ThrowIfNull(bot);
ArgumentNullException.ThrowIfNull(webBrowser);
if (SharedInfo.BuildInfo.IsCustomBuild) {
return null;
}
Uri request = new(ArchiNet.URL, "/Api/Listing/HeartBeat");
HeartBeatRequest data = new(ASF.GlobalDatabase?.Identifier ?? Guid.NewGuid(), bot.SteamID);

View file

@ -66,10 +66,6 @@ internal sealed class ItemsMatcherPlugin : OfficialPlugin, IBot, IBotCommand2, I
throw new ArgumentOutOfRangeException(nameof(steamID));
}
if (SharedInfo.BuildInfo.IsCustomBuild) {
return null;
}
return await Commands.OnBotCommand(bot, access, args, steamID).ConfigureAwait(false);
}
@ -94,10 +90,6 @@ internal sealed class ItemsMatcherPlugin : OfficialPlugin, IBot, IBotCommand2, I
await remoteCommunication.DisposeAsync().ConfigureAwait(false);
}
if (SharedInfo.BuildInfo.IsCustomBuild) {
return;
}
remoteCommunication = new RemoteCommunication(bot);
if (!RemoteCommunications.TryAdd(bot, remoteCommunication)) {
@ -140,12 +132,6 @@ internal sealed class ItemsMatcherPlugin : OfficialPlugin, IBot, IBotCommand2, I
}
public override Task OnLoaded() {
if (SharedInfo.BuildInfo.IsCustomBuild) {
ASF.ArchiLogger.LogGenericWarning(Strings.PluginDisabledCustomBuild);
return Task.CompletedTask;
}
Utilities.WarnAboutIncompleteTranslation(Strings.ResourceManager);
return Task.CompletedTask;

View file

@ -74,11 +74,5 @@ namespace ArchiSteamFarm.OfficialPlugins.ItemsMatcher.Localization {
return ResourceManager.GetString("ActivelyMatchingSomeConfirmationsFailed", resourceCulture);
}
}
internal static string PluginDisabledCustomBuild {
get {
return ResourceManager.GetString("PluginDisabledCustomBuild", resourceCulture);
}
}
}
}

View file

@ -82,7 +82,4 @@
<value>Some confirmations have failed, approximately {0} out of {1} trades were sent successfully.</value>
<comment>{0} will be replaced by amount of the trade offers that succeeded (number), {1} will be replaced by amount of the trade offers that were supposed to be sent in total (number)</comment>
</data>
<data name="PluginDisabledCustomBuild" xml:space="preserve">
<value>ItemsMatcherPlugin is not supported in custom ASF builds, the functionality is disabled.</value>
</data>
</root>

View file

@ -51,10 +51,6 @@ internal static class ArchiNet {
throw new InvalidOperationException(nameof(ASF.WebBrowser));
}
if (SharedInfo.BuildInfo.IsCustomBuild) {
return null;
}
Uri request = new(URL, $"/Api/Checksum/{version}/{variant}");
ObjectResponse<GenericResponse<string>>? response = await ASF.WebBrowser.UrlGetToJsonObject<GenericResponse<string>>(request, cancellationToken: cancellationToken).ConfigureAwait(false);
@ -71,10 +67,6 @@ internal static class ArchiNet {
throw new ArgumentOutOfRangeException(nameof(steamID));
}
if (SharedInfo.BuildInfo.IsCustomBuild) {
return null;
}
(_, IReadOnlyCollection<ulong>? badBots) = await CachedBadBots.GetValue(ECacheFallback.FailedNow, cancellationToken).ConfigureAwait(false);
return badBots?.Contains(steamID);
@ -84,7 +76,7 @@ internal static class ArchiNet {
ArgumentNullException.ThrowIfNull(bot);
ArgumentNullException.ThrowIfNull(webBrowser);
if (!bot.IsConnectedAndLoggedOn || SharedInfo.BuildInfo.IsCustomBuild) {
if (!bot.IsConnectedAndLoggedOn) {
return null;
}
@ -188,10 +180,6 @@ internal static class ArchiNet {
throw new InvalidOperationException(nameof(ASF.WebBrowser));
}
if (SharedInfo.BuildInfo.IsCustomBuild) {
return (false, null);
}
Uri request = new(URL, "/Api/BadBots");
ObjectResponse<GenericResponse<ImmutableHashSet<ulong>>>? response = await ASF.WebBrowser.UrlGetToJsonObject<GenericResponse<ImmutableHashSet<ulong>>>(request, cancellationToken: cancellationToken).ConfigureAwait(false);