Compare commits

..

12 Commits

Author SHA1 Message Date
JustArchi
267f7b1e53 Closes #1862 2020-06-24 19:34:39 +02:00
JustArchi
c45364ef99 +x for hooks/build 2020-06-24 18:55:42 +02:00
dependabot-preview[bot]
a2542a8c12 Bump ASF-ui from b74e430 to 1ea7589
Bumps [ASF-ui](https://github.com/JustArchiNET/ASF-ui) from `b74e430` to `1ea7589`.
- [Release notes](https://github.com/JustArchiNET/ASF-ui/releases)
- [Commits](b74e43068e...1ea7589aef)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-06-24 01:29:00 +00:00
dependabot-preview[bot]
2e2fb1828d Bump ASF-WebConfigGenerator from 5efdaf9 to c62b75a
Bumps [ASF-WebConfigGenerator](https://github.com/JustArchiNET/ASF-WebConfigGenerator) from `5efdaf9` to `c62b75a`.
- [Release notes](https://github.com/JustArchiNET/ASF-WebConfigGenerator/releases)
- [Commits](5efdaf96ac...c62b75a7a8)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-06-24 01:22:25 +00:00
JustArchi
f007f30c0d Bump 2020-06-23 00:09:57 +02:00
JustArchi
74881094ab Never allow clearing of OwnedPackageIDs, especially on invalid Valve callbacks 2020-06-23 00:09:27 +02:00
JustArchi
ee98282475 Bump 2020-06-22 17:28:58 +02:00
JustArchi
e49ec14c41 Translations update 2020-06-22 16:49:23 +02:00
JustArchi
56f4604819 Misc 2020-06-22 16:43:02 +02:00
JustArchi
56eb5ba8a8 Misc 2020-06-22 16:41:54 +02:00
JustArchi
8206dff4c1 Slightly improve session refresh
Previous solution of assuming that session is valid for at least N amount of seconds is pretty optimistic, too optimistic for real usage, instead, we won't assume anything like that and force every request to go through session refresh, but at the same time limit session refresh checks to just one at a time - if additional requests asked for session refresh, they'll use already-calculated value.

This way sending 100 requests at once won't always trigger 100 session refreshes but most likely around 2-3, while still allowing ASF to check session refresh with every request, if deemed necessary (due to delay between session checks
2020-06-22 16:40:49 +02:00
JustArchi
f7426a4439 Bump 2020-06-21 11:26:21 +02:00
11 changed files with 41 additions and 28 deletions

2
ASF-ui

Submodule ASF-ui updated: 452d296a0f...1ea7589aef

View File

@@ -57,7 +57,6 @@ namespace ArchiSteamFarm {
private const string ISteamApps = "ISteamApps";
private const string ISteamUserAuth = "ISteamUserAuth";
private const string ITwoFactorService = "ITwoFactorService";
private const byte MinSessionValidityInSeconds = GlobalConfig.DefaultConnectionTimeout / 6;
private const string SteamCommunityHost = "steamcommunity.com";
private const string SteamHelpHost = "help.steampowered.com";
private const string SteamStoreHost = "store.steampowered.com";
@@ -2393,14 +2392,16 @@ namespace ArchiSteamFarm {
}
private async Task<bool?> IsSessionExpired() {
if (DateTime.UtcNow < LastSessionCheck.AddSeconds(MinSessionValidityInSeconds)) {
DateTime triggeredAt = DateTime.UtcNow;
if (triggeredAt <= LastSessionCheck) {
return LastSessionCheck != LastSessionRefresh;
}
await SessionSemaphore.WaitAsync().ConfigureAwait(false);
try {
if (DateTime.UtcNow < LastSessionCheck.AddSeconds(MinSessionValidityInSeconds)) {
if (triggeredAt <= LastSessionCheck) {
return LastSessionCheck != LastSessionRefresh;
}
@@ -2522,15 +2523,15 @@ namespace ArchiSteamFarm {
DateTime triggeredAt = DateTime.UtcNow;
if (triggeredAt < LastSessionRefresh.AddSeconds(MinSessionValidityInSeconds)) {
return true;
if (triggeredAt <= LastSessionCheck) {
return LastSessionCheck == LastSessionRefresh;
}
await SessionSemaphore.WaitAsync().ConfigureAwait(false);
try {
if (triggeredAt < LastSessionRefresh.AddSeconds(MinSessionValidityInSeconds)) {
return true;
if (triggeredAt <= LastSessionCheck) {
return LastSessionCheck == LastSessionRefresh;
}
if (!Bot.IsConnectedAndLoggedOn) {
@@ -2540,10 +2541,14 @@ namespace ArchiSteamFarm {
Bot.ArchiLogger.LogGenericInfo(Strings.RefreshingOurSession);
bool result = await Bot.RefreshSession().ConfigureAwait(false);
DateTime now = DateTime.UtcNow;
if (result) {
LastSessionCheck = LastSessionRefresh = DateTime.UtcNow;
LastSessionRefresh = now;
}
LastSessionCheck = now;
return result;
} finally {
SessionSemaphore.Release();

View File

@@ -23,6 +23,7 @@ using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Collections.Specialized;
using System.IO;
using System.Linq;
@@ -122,8 +123,6 @@ namespace ArchiSteamFarm {
internal readonly ArchiHandler ArchiHandler;
internal readonly BotDatabase BotDatabase;
internal readonly ConcurrentDictionary<uint, (EPaymentMethod PaymentMethod, DateTime TimeCreated)> OwnedPackageIDs = new ConcurrentDictionary<uint, (EPaymentMethod PaymentMethod, DateTime TimeCreated)>();
internal bool CanReceiveSteamCards => !IsAccountLimited && !IsAccountLocked;
internal bool IsAccountLimited => AccountFlags.HasFlag(EAccountFlags.LimitedUser) || AccountFlags.HasFlag(EAccountFlags.LimitedUserForce);
internal bool IsAccountLocked => AccountFlags.HasFlag(EAccountFlags.Lockdown);
@@ -195,6 +194,7 @@ namespace ArchiSteamFarm {
[PublicAPI]
public ECurrencyCode WalletCurrency { get; private set; }
internal ImmutableDictionary<uint, (EPaymentMethod PaymentMethod, DateTime TimeCreated)> OwnedPackageIDs { get; private set; } = ImmutableDictionary<uint, (EPaymentMethod PaymentMethod, DateTime TimeCreated)>.Empty;
internal bool PlayingBlocked { get; private set; }
internal bool PlayingWasBlocked { get; private set; }
@@ -2160,7 +2160,6 @@ namespace ArchiSteamFarm {
ArchiLogger.LogGenericInfo(Strings.BotDisconnected);
OwnedPackageIDs.Clear();
PastNotifications.Clear();
Actions.OnDisconnected();
@@ -2384,16 +2383,21 @@ namespace ArchiSteamFarm {
return;
}
bool initialLogin = OwnedPackageIDs.Count == 0;
if (callback.LicenseList.Count == 0) {
ArchiLogger.LogGenericError(string.Format(Strings.ErrorIsEmpty, nameof(callback.LicenseList)));
return;
}
Commands.OnNewLicenseList();
OwnedPackageIDs.Clear();
Dictionary<uint, (EPaymentMethod PaymentMethod, DateTime TimeCreated)> ownedPackageIDs = new Dictionary<uint, (EPaymentMethod PaymentMethod, DateTime TimeCreated)>();
Dictionary<uint, ulong> packageAccessTokens = new Dictionary<uint, ulong>();
Dictionary<uint, uint> packagesToRefresh = new Dictionary<uint, uint>();
foreach (SteamApps.LicenseListCallback.License license in callback.LicenseList.GroupBy(license => license.PackageID, (packageID, licenses) => licenses.OrderByDescending(license => license.TimeCreated).First())) {
OwnedPackageIDs[license.PackageID] = (license.PaymentMethod, license.TimeCreated);
ownedPackageIDs[license.PackageID] = (license.PaymentMethod, license.TimeCreated);
if (!ASF.GlobalDatabase.PackageAccessTokensReadOnly.TryGetValue(license.PackageID, out ulong packageAccessToken) || (packageAccessToken != license.AccessToken)) {
packageAccessTokens[license.PackageID] = license.AccessToken;
@@ -2405,6 +2409,8 @@ namespace ArchiSteamFarm {
}
}
OwnedPackageIDs = ownedPackageIDs.ToImmutableDictionary();
if (packageAccessTokens.Count > 0) {
ASF.GlobalDatabase.RefreshPackageAccessTokens(packageAccessTokens);
}
@@ -2415,11 +2421,6 @@ namespace ArchiSteamFarm {
ArchiLogger.LogGenericTrace(Strings.Done);
}
if (initialLogin && CardsFarmer.Paused) {
// Emit initial game playing status in this case
await ResetGamesPlayed().ConfigureAwait(false);
}
await CardsFarmer.OnNewGameAdded().ConfigureAwait(false);
}
@@ -2623,6 +2624,11 @@ namespace ArchiSteamFarm {
);
}
if (CardsFarmer.Paused) {
// Emit initial game playing status in this case
Utilities.InBackground(ResetGamesPlayed);
}
SteamPICSChanges.OnBotLoggedOn();
await PluginsCore.OnBotLoggedOn(this).ConfigureAwait(false);

View File

@@ -36,12 +36,12 @@ using SteamKit2;
namespace ArchiSteamFarm {
[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
public sealed class GlobalConfig {
internal const byte DefaultConnectionTimeout = 90;
internal const byte DefaultLoginLimiterDelay = 10;
private const bool DefaultAutoRestart = true;
private const string DefaultCommandPrefix = "!";
private const byte DefaultConfirmationsLimiterDelay = 10;
private const byte DefaultConnectionTimeout = 90;
private const string DefaultCurrentCulture = null;
private const bool DefaultDebug = false;
private const byte DefaultFarmingDelay = 15;

View File

@@ -136,8 +136,8 @@ namespace ArchiSteamFarm {
return globalDatabase;
}
internal HashSet<uint> GetPackageIDs(uint appID, ICollection<uint> packageIDs) {
if ((appID == 0) || (packageIDs == null) || (packageIDs.Count == 0)) {
internal HashSet<uint> GetPackageIDs(uint appID, IEnumerable<uint> packageIDs) {
if ((appID == 0) || (packageIDs == null)) {
ASF.ArchiLogger.LogNullError(nameof(appID) + " || " + nameof(packageIDs));
return null;

View File

@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>4.2.3.0</Version>
<Version>4.2.3.3</Version>
</PropertyGroup>
<PropertyGroup>

View File

@@ -1,3 +1,5 @@
ARG DOTNET_ARCH=
FROM node:lts AS build-node
WORKDIR /app
COPY ASF-ui .
@@ -31,7 +33,6 @@ RUN dotnet --info && \
if [ -d "ArchiSteamFarm/overlay/generic" ]; then cp "ArchiSteamFarm/overlay/generic/"* "out/result"; fi && \
if [ -f "out/${STEAM_TOKEN_DUMPER_NAME}/${NET_CORE_VERSION}/${STEAM_TOKEN_DUMPER_NAME}.dll" ]; then mkdir -p "out/result/plugins/${STEAM_TOKEN_DUMPER_NAME}"; cp "out/${STEAM_TOKEN_DUMPER_NAME}/${NET_CORE_VERSION}/${STEAM_TOKEN_DUMPER_NAME}.dll" "out/result/plugins/${STEAM_TOKEN_DUMPER_NAME}"; fi
ARG DOTNET_ARCH=
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim${DOTNET_ARCH} AS runtime
ENV ASPNETCORE_URLS=
ENV DOTNET_CLI_TELEMETRY_OPTOUT 1

View File

@@ -1,3 +1,5 @@
ARG DOTNET_ARCH=
FROM node:lts AS build-node
WORKDIR /app
COPY ASF-ui .
@@ -31,7 +33,6 @@ RUN dotnet --info && \
if [ -d "ArchiSteamFarm/overlay/linux-${ASF_ARCH}" ]; then cp "ArchiSteamFarm/overlay/linux-${ASF_ARCH}/"* "out/result"; fi && \
if [ -f "out/${STEAM_TOKEN_DUMPER_NAME}/${NET_CORE_VERSION}/${STEAM_TOKEN_DUMPER_NAME}.dll" ]; then mkdir -p "out/result/plugins/${STEAM_TOKEN_DUMPER_NAME}"; cp "out/${STEAM_TOKEN_DUMPER_NAME}/${NET_CORE_VERSION}/${STEAM_TOKEN_DUMPER_NAME}.dll" "out/result/plugins/${STEAM_TOKEN_DUMPER_NAME}"; fi
ARG DOTNET_ARCH=
FROM mcr.microsoft.com/dotnet/core/runtime-deps:3.1-buster-slim${DOTNET_ARCH} AS runtime
ENV ASPNETCORE_URLS=
ENV DOTNET_CLI_TELEMETRY_OPTOUT 1

0
hooks/build Normal file → Executable file
View File

2
wiki

Submodule wiki updated: b8a5e05ea3...31e95fe1d8