STD: Api V2

This commit is contained in:
JustArchi 2021-05-09 18:59:17 +02:00
parent 14f4a9f58d
commit 8f41e90ade
5 changed files with 122 additions and 16 deletions

View file

@ -214,7 +214,7 @@ namespace ArchiSteamFarm.OfficialPlugins.SteamTokenDumper.Localization {
}
/// <summary>
/// Looks up a localized string similar to Submitting a total of registered apps/subs/depots: {0}/{1}/{2}....
/// Looks up a localized string similar to Submitting a total of registered apps/packages/depots: {0}/{1}/{2}....
/// </summary>
internal static string SubmissionInProgress {
get {
@ -241,12 +241,66 @@ namespace ArchiSteamFarm.OfficialPlugins.SteamTokenDumper.Localization {
}
/// <summary>
/// Looks up a localized string similar to The data has been successfully submitted. The server has registered a total of new apps/subs/depots: {0}/{1}/{2}..
/// Looks up a localized string similar to The data has been successfully submitted. The server has registered a total of new apps/packages/depots: {0} ({1} verified)/{2} ({3} verified)/{4} ({5} verified)..
/// </summary>
internal static string SubmissionSuccessful {
get {
return ResourceManager.GetString("SubmissionSuccessful", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to New apps: {0}.
/// </summary>
internal static string SubmissionSuccessfulNewApps {
get {
return ResourceManager.GetString("SubmissionSuccessfulNewApps", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to New depots: {0}.
/// </summary>
internal static string SubmissionSuccessfulNewDepots {
get {
return ResourceManager.GetString("SubmissionSuccessfulNewDepots", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to New packages: {0}.
/// </summary>
internal static string SubmissionSuccessfulNewPackages {
get {
return ResourceManager.GetString("SubmissionSuccessfulNewPackages", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Verified apps: {0}.
/// </summary>
internal static string SubmissionSuccessfulVerifiedApps {
get {
return ResourceManager.GetString("SubmissionSuccessfulVerifiedApps", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Verified depots: {0}.
/// </summary>
internal static string SubmissionSuccessfulVerifiedDepots {
get {
return ResourceManager.GetString("SubmissionSuccessfulVerifiedDepots", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Verified packages: {0}.
/// </summary>
internal static string SubmissionSuccessfulVerifiedPackages {
get {
return ResourceManager.GetString("SubmissionSuccessfulVerifiedPackages", resourceCulture);
}
}
}
}

View file

@ -184,7 +184,7 @@
<comment>{0} will be replaced by the name of the config property (e.g. "SteamOwnerID") that the user is expected to set</comment>
</data>
<data name="SubmissionInProgress" xml:space="preserve">
<value>Submitting a total of registered apps/subs/depots: {0}/{1}/{2}...</value>
<value>Submitting a total of registered apps/packages/depots: {0}/{1}/{2}...</value>
<comment>{0} will be replaced by the number of app access tokens being submitted, {1} will be replaced by the number of package access tokens being submitted, {2} will be replaced by the number of depot keys being submitted</comment>
</data>
<data name="SubmissionFailedTooManyRequests" xml:space="preserve">
@ -192,8 +192,32 @@
<comment>{0} will be replaced by translated TimeSpan string (such as "53 minutes")</comment>
</data>
<data name="SubmissionSuccessful" xml:space="preserve">
<value>The data has been successfully submitted. The server has registered a total of new apps/subs/depots: {0}/{1}/{2}.</value>
<comment>{0} will be replaced by the number of new app access tokens that the server has registered, {1} will be replaced by the number of new package access tokens that the server has registered, {2} will be replaced by the number of new depot keys that the server has registered</comment>
<value>The data has been successfully submitted. The server has registered a total of new apps/packages/depots: {0} ({1} verified)/{2} ({3} verified)/{4} ({5} verified).</value>
<comment>{0} will be replaced by the number of new app access tokens that the server has registered, {1} will be replaced by the number of verified app access tokens that the server has registered, {2} will be replaced by the number of new package access tokens that the server has registered, {3} will be replaced by the number of verified package access tokens that the server has registered, {4} will be replaced by the number of new depot keys that the server has registered, {5} will be replaced by the number of verified depot keys that the server has registered</comment>
</data>
<data name="SubmissionSuccessfulNewApps" xml:space="preserve">
<value>New apps: {0}</value>
<comment>{0} will be replaced by list of the apps (IDs, numbers), separated by a comma</comment>
</data>
<data name="SubmissionSuccessfulVerifiedApps" xml:space="preserve">
<value>Verified apps: {0}</value>
<comment>{0} will be replaced by list of the apps (IDs, numbers), separated by a comma</comment>
</data>
<data name="SubmissionSuccessfulNewPackages" xml:space="preserve">
<value>New packages: {0}</value>
<comment>{0} will be replaced by list of the packages (IDs, numbers), separated by a comma</comment>
</data>
<data name="SubmissionSuccessfulVerifiedPackages" xml:space="preserve">
<value>Verified packages: {0}</value>
<comment>{0} will be replaced by list of the packages (IDs, numbers), separated by a comma</comment>
</data>
<data name="SubmissionSuccessfulNewDepots" xml:space="preserve">
<value>New depots: {0}</value>
<comment>{0} will be replaced by list of the depots (IDs, numbers), separated by a comma</comment>
</data>
<data name="SubmissionSuccessfulVerifiedDepots" xml:space="preserve">
<value>Verified depots: {0}</value>
<comment>{0} will be replaced by list of the depots (IDs, numbers), separated by a comma</comment>
</data>
<data name="PluginSecretListInitialized" xml:space="preserve">
<value>{0} initialized, the plugin will not resolve any of those: {1}.</value>

View file

@ -19,6 +19,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using Newtonsoft.Json;
@ -40,20 +41,23 @@ namespace ArchiSteamFarm.OfficialPlugins.SteamTokenDumper {
private ResponseData() { }
internal sealed class InternalData {
#pragma warning disable CS0649 // False positive, the field is used during json deserialization
[JsonProperty(PropertyName = "new_apps", Required = Required.Always)]
internal readonly uint NewAppsCount;
#pragma warning restore CS0649 // False positive, the field is used during json deserialization
internal readonly ImmutableHashSet<uint> NewApps = ImmutableHashSet<uint>.Empty;
#pragma warning disable CS0649 // False positive, the field is used during json deserialization
[JsonProperty(PropertyName = "new_depots", Required = Required.Always)]
internal readonly uint NewDepotsCount;
#pragma warning restore CS0649 // False positive, the field is used during json deserialization
internal readonly ImmutableHashSet<uint> NewDepots = ImmutableHashSet<uint>.Empty;
#pragma warning disable CS0649 // False positive, the field is used during json deserialization
[JsonProperty(PropertyName = "new_subs", Required = Required.Always)]
internal readonly uint NewSubsCount;
#pragma warning restore CS0649 // False positive, the field is used during json deserialization
internal readonly ImmutableHashSet<uint> NewPackages = ImmutableHashSet<uint>.Empty;
[JsonProperty(PropertyName = "verified_apps", Required = Required.Always)]
internal readonly ImmutableHashSet<uint> VerifiedApps = ImmutableHashSet<uint>.Empty;
[JsonProperty(PropertyName = "verified_depots", Required = Required.Always)]
internal readonly ImmutableHashSet<uint> VerifiedDepots = ImmutableHashSet<uint>.Empty;
[JsonProperty(PropertyName = "verified_subs", Required = Required.Always)]
internal readonly ImmutableHashSet<uint> VerifiedPackages = ImmutableHashSet<uint>.Empty;
[JsonConstructor]
private InternalData() { }

View file

@ -21,7 +21,7 @@
namespace ArchiSteamFarm.OfficialPlugins.SteamTokenDumper {
internal static class SharedInfo {
internal const byte ApiVersion = 1;
internal const byte ApiVersion = 2;
internal const byte AppInfosPerSingleRequest = byte.MaxValue;
internal const byte MaximumHoursBetweenRefresh = 8; // Per single bot account, makes sense to be 2 or 3 times less than MinimumHoursBetweenUploads
internal const byte MaximumMinutesBeforeFirstUpload = 60; // Must be greater or equal to MinimumMinutesBeforeFirstUpload

View file

@ -531,9 +531,33 @@ namespace ArchiSteamFarm.OfficialPlugins.SteamTokenDumper {
return;
}
ASF.ArchiLogger.LogGenericInfo(string.Format(CultureInfo.CurrentCulture, Strings.SubmissionSuccessful, response.Content.Data.NewAppsCount, response.Content.Data.NewSubsCount, response.Content.Data.NewDepotsCount));
ASF.ArchiLogger.LogGenericInfo(string.Format(CultureInfo.CurrentCulture, Strings.SubmissionSuccessful, response.Content.Data.NewApps.Count, response.Content.Data.VerifiedApps.Count, response.Content.Data.NewPackages.Count, response.Content.Data.VerifiedPackages.Count, response.Content.Data.NewDepots.Count, response.Content.Data.VerifiedDepots.Count));
GlobalCache.UpdateSubmittedData(appTokens, packageTokens, depotKeys);
if (!response.Content.Data.NewApps.IsEmpty) {
ASF.ArchiLogger.LogGenericInfo(string.Format(CultureInfo.CurrentCulture, Strings.SubmissionSuccessfulNewApps, string.Join(", ", response.Content.Data.NewApps)));
}
if (!response.Content.Data.VerifiedApps.IsEmpty) {
ASF.ArchiLogger.LogGenericInfo(string.Format(CultureInfo.CurrentCulture, Strings.SubmissionSuccessfulVerifiedApps, string.Join(", ", response.Content.Data.VerifiedApps)));
}
if (!response.Content.Data.NewPackages.IsEmpty) {
ASF.ArchiLogger.LogGenericInfo(string.Format(CultureInfo.CurrentCulture, Strings.SubmissionSuccessfulNewPackages, string.Join(", ", response.Content.Data.NewPackages)));
}
if (!response.Content.Data.VerifiedPackages.IsEmpty) {
ASF.ArchiLogger.LogGenericInfo(string.Format(CultureInfo.CurrentCulture, Strings.SubmissionSuccessfulVerifiedPackages, string.Join(", ", response.Content.Data.VerifiedPackages)));
}
if (!response.Content.Data.NewDepots.IsEmpty) {
ASF.ArchiLogger.LogGenericInfo(string.Format(CultureInfo.CurrentCulture, Strings.SubmissionSuccessfulNewDepots, string.Join(", ", response.Content.Data.NewDepots)));
}
if (!response.Content.Data.VerifiedDepots.IsEmpty) {
ASF.ArchiLogger.LogGenericInfo(string.Format(CultureInfo.CurrentCulture, Strings.SubmissionSuccessfulVerifiedDepots, string.Join(", ", response.Content.Data.VerifiedDepots)));
}
} finally {
SubmissionSemaphore.Release();
}