Commit Graph

71 Commits

Author SHA1 Message Date
JustArchi
e6579e4355 Enhance STD plugin errors
- 403: Stop submission for now
- 409: Purge cache and continue
2022-10-10 22:38:35 +02:00
JustArchi
d67366cd12 Implement cache validity for PackagesData
For unknown to me reason, this breaks for many people with Steam reporting invalid data and ASF caching it until new change number, which may never arrive. Add our own 7-days validity on top, to ensure that user never needs to delete ASF.db manually.
2022-08-11 22:38:19 +02:00
Łukasz Domeradzki
715ed034df Unify WebBrowser API in regards to nullable bodies (#2593)
* Unify logic for nullable bodies

* Update ArchiWebHandler.cs

* Misc
2022-06-01 21:13:40 +02:00
JustArchi
6178b12bb1 Fix invalid STD retry on 429 without json body
It's getting more and more complicated... We have places where we accept errors but still want relevant JSON body (most of the Steam error-places), and now we also have a place where we expected error to not carry one. Moreover, we still want to account for invalid JSON body on 2xx and retry on them.

So let's make the code even more complicated than it already is by adding yet another endpoint that does exactly the same what the other endpoint does BUT allows us us to optionally accept null/invalid body on success/errors/both, lol. I hate myself.

Maybe we can obsolete the first endpoint eventually and stick with just the second?
2022-05-28 20:41:52 +02:00
JustArchi
c9b1e46013 Avoid crash when executing STD command with disabled STD plugin 2022-05-26 11:47:11 +02:00
JustArchi
9162752b99 Misc 2022-05-19 21:38:40 +02:00
JustArchi
4436e8dc43 Add STD command trigger for STD plugin 2022-05-19 21:34:57 +02:00
Archi
c1d9d04071 Rider cleanup & improvements 2022-02-18 15:40:33 +01:00
Archi
1809028c77 Rider cleanup 2022-01-06 20:22:38 +01:00
Archi
81a92d6781 Misc 2021-12-20 18:27:54 +01:00
Archi
225003c5d1 Try to fix netf, once again into the breach 2021-12-12 01:44:17 +01:00
Archi
4f598d5c8f Latest Rider cleanups 2021-12-12 01:12:54 +01:00
Archi
0eab358af9 Plugins breaking: Convert all synchronous interface methods to Task
Okay, I wish we had uncovered it earlier as part of V5.2 but it has bitten us in the back just now, so I'm addressing it as part of monthly cycle instead.

Previously used void methods did not allow async operations in plugins in a "nice way". If plugin didn't require synchronization with the ASF and just minded its own business, it wasn't half bad as it could use async void signature. However, if plugin by any chance had to do something BEFORE ASF continued with the rest of the logic, it had to explicitly leave non-async void signature and call its async-capable stuff in synchronous manner (usually with Wait() or .Result), which is vastly suboptimal.

This was visible even in our STD plugin, which previously had (and still has) GlobalCache initialization in OnASFInit(). If that cache initialization took a bit longer time, STD would hit InvalidOperationException() in OnLicenseList() callback as global cache didn't load yet while we were already long past OnASFInit().

Therefore, I've decided to make a breaking change for a very good reason - all previous methods were converted to tasks, which allows from plugin to do one of three things:

- If plugin is async and requires synchronization (like STD), it can declare itself as async await, and do its awaits as-needed, and ASF will wait for those.
- If plugin is truly synchronous (and not just a synchronous signature with awful Wait() or .Result, see above), it can simply return Task.CompletedTask and has exactly the same logic.
- Finally, if plugin calls some async stuff but doesn't need ASF synchronization, it can "offload" itself from it by calling e.g. ASF's Utilities.InBackground() with whole logic, while returning Task.CompletedTask from the main method. This will allow it to effectively do what async void previously did, by just hooking into the process without intention of slowing it down.

All in all I'm confident this approach, while a bit counter-intuitive at first, will result in better compatibility between ASF and the plugins, as if I wanted to fix my STD issue right now without that breaking change, I'd have to actually call .Result on my async global cache loader function, which is utterly stupid if we can fix ASF to do the right thing instead.

This "approach" can be commonly found in some other libs with similar to ASF's event-hook behaviour, e.g. Discord.Net.

You'll sadly need to do some method signature changes in all of your plugins, as the core OnLoaded() was also changed. See the ones I did in SteamTokenDumperPlugin.cs if you need a practical example, and see ExamplePlugin.cs if you need further explanation.
2021-12-08 16:52:27 +01:00
Archi
62effc4af1 STD: Postpone registering updated app change numbers
This is important as we don't want to miss a depot, by moving it below we ensure that all depot tasks succeeded before we mark appIDs as "finished with"
2021-11-15 19:53:46 +01:00
Archi
260875da7e Use shared Random across ASF
This also removes PublicAPI of ASF's "shared random"
2021-11-11 19:34:21 +01:00
Archi
d46e532458 Code cleanup 2021-11-10 21:47:42 +01:00
Archi
1e6ab11d9f Use file-scoped namespaces 2021-11-10 21:23:24 +01:00
Sebastian Göls
fb4eb0b03a Use Madness via global usings (#2447)
* Use Madness via global usings

* Apply feedback

* Disable false positive null warning
2021-11-09 16:33:09 +01:00
Archi
eb876aa4d1 Warn about incomplete translation also in our plugin 2021-10-24 18:40:26 +02:00
Łukasz Domeradzki
965d3050a5 Address new Rider inspections (EAP) (#2418) 2021-10-01 01:21:09 +02:00
Archi
7e9e90764b Use static lambdas wherever possible
Thanks Rider
2021-09-27 21:33:52 +02:00
Archi
f2d3a2a894 Use string interpolation wherever possible
Majority of cases still need to go through string.Format() due to localization requirements
2021-09-27 19:59:00 +02:00
Archi
3dec189e14 Misc 2021-08-20 14:31:12 +02:00
Łukasz Domeradzki
9f281c6055 Embrace madness (#2394)
* Embrace madness

* Remove unused code

* Misc

* Address Abry's note

* Update for Madness 0.3.0
2021-08-07 14:03:46 +02:00
renovate[bot]
97a5a94220 Update dependency SteamKit2 to v2.4.0-Alpha.3 (#2392)
* Update dependency SteamKit2 to v2.4.0-Alpha.3

* Address SK2 breaking changes

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Archi <JustArchi@JustArchi.net>
2021-07-30 15:33:29 +02:00
Archi
d479eb9f97 Address Rider EAP inspections/cleanup 2021-07-12 21:45:17 +02:00
Archi
535e6fb334 STD: Explicitly refuse to initialize upon any config parsing issue 2021-06-03 12:58:15 +02:00
Archi
31a06a8af3 STD: Fix wrong logic interpreting custom config 2021-06-03 11:51:11 +02:00
JustArchi
8f41e90ade STD: Api V2 2021-05-09 18:59:17 +02:00
JustArchi
1f12c73b2e Do not throw InvalidOperationException on null Config
Lack of config will happen e.g. with invalid submission token, the plugin should not crash in this case, even if it's unusable.
2021-05-09 13:56:59 +02:00
JustArchi
d21d2473fe RuntimeCompatibility -> Compatibility 2021-05-08 01:43:08 +02:00
JustArchi
e60b54e402 Refactor EVERYTHING
Directories structure + namespaces relevant to them
2021-05-08 01:37:22 +02:00
JustArchi
cbabde1b38 Reorganize Web directory 2021-05-08 01:03:08 +02:00
JustArchi
e7537ca996 Resolve CA2002 2021-05-07 19:04:38 +02:00
JustArchi
809a4bbfbf Resolve CA2000 2021-05-07 18:55:50 +02:00
JustArchi
9a8a61e111 Resolve CA1054 2021-05-06 22:50:59 +02:00
JustArchi
aed11c59ee Cleanup round 2021-05-06 20:44:17 +02:00
JustArchi
b6772b9b1e Resolve CA1034 2021-05-06 20:16:06 +02:00
JustArchi
db632145fb STD: Skip AutoGrant also when doing full resolve 2021-05-03 13:42:37 +02:00
JustArchi
eb39a081d7 STD: Implement SkipAutoGrantPackages 2021-05-03 13:20:34 +02:00
JustArchi
823f077cf2 STD: Correct extra config path 2021-05-03 12:21:00 +02:00
JustArchi
9afbcee163 STD: Add feature to skip appIDs, packageIDs and depotIDs 2021-05-03 01:08:12 +02:00
JustArchi
9ed27b5f66 Finish STD localization 2021-04-25 23:44:47 +02:00
JustArchi
857e9a140f Initialize localization strings for STD plugin 2021-04-25 19:55:30 +02:00
JustArchi
b98974a482 STD: Misc 2021-02-22 18:25:29 +01:00
JustArchi
e836cb66e4 STD: Make data field in response optional
Data field is not included in case of non-200 status codes.
2021-02-22 17:56:03 +01:00
JustArchi
4700ed2706 Further code cleanup 2021-01-04 17:42:31 +01:00
JustArchi
45a5fec95a Happy 2021
And let's hope it'll be better than 2020
2021-01-03 22:24:22 +01:00
JustArchi
e2c7671f00 STD: Perform Save() of GlobalCache in background
We don't need to slow down the process with I/O there, at all. ASF already handles its own database like that.
2021-01-03 22:02:24 +01:00
JustArchi
273a6b0fbe Invalidate cache upon pics changes
PICS restart indicates that we don't know what changes exactly we've missed. If package doesn't emit any change number (and it doesn't have to), we might miss the update that happened in the meantime without being aware of that happening.
2021-01-03 21:37:16 +01:00