Commit graph

103 commits

Author SHA1 Message Date
Łukasz Domeradzki
afa602f940
Resolve remainings of CA1863 2024-08-05 02:45:53 +02:00
Łukasz Domeradzki
773698a0d4
Closes #3264
THANKS @ezhevita
2024-08-05 02:37:50 +02:00
Łukasz Domeradzki
42dec2de39
Misc
Thanks @xPaw
2024-04-09 16:33:54 +02:00
Archi
48a14136a9
Update all file headers, again 2024-03-17 02:35:40 +01:00
Archi
f98a159799
File header update 2024-03-17 00:06:13 +01:00
Archi
d3aa881f55
Fix STD serialization after STJ changes 2024-02-23 02:42:18 +01:00
Łukasz Domeradzki
6b0bf0f9c1
Closes #3061 (#3145)
* Good start

* Misc

* Make ApiAuthenticationMiddleware use new json

* Remove first newtonsoft dependency

* Pull latest ASFB json enhancements

* Start reimplementing newtonsoft!

* One thing at a time

* Keep doing all kind of breaking changes which need to be tested later

* Add back ShouldSerialize() support

* Misc

* Eradicate remaining parts of newtonsoft

* WIP

* Workaround STJ stupidity in regards to derived types

STJ can't serialize derived type properties by default, so we'll use another approach in our serializable file function

* Make CI happy

* Bunch of further fixes

* Fix AddFreeLicense() after rewrite

* Add full support for JsonDisallowNullAttribute

* Optimize our json utilities even further

* Misc

* Add support for fields in disallow null

* Misc optimization

* Fix deserialization of GlobalCache in STD

* Fix non-public [JsonExtensionData]

* Fix IM missing method exception, correct db storage helpers

* Fix saving into generic databases

Thanks STJ

* Make Save() function abstract to force inheritors to implement it properly

* Correct ShouldSerializeAdditionalProperties to be a method

* Misc cleanup

* Code review

* Allow JSON comments in configs, among other

* Allow trailing commas in configs

Users very often add them accidentally, no reason to throw on them

* Fix confirmation ID

Probably needs further fixes, will need to check later

* Correct confirmations deserialization

* Use JsonNumberHandling

* Misc

* Misc

* [JsonDisallowNull] corrections

* Forbid [JsonDisallowNull] on non-nullable structs

* Not really but okay

* Add and use ToJson() helpers

* Misc

* Misc
2024-02-21 03:09:36 +01:00
Archi
d08740b6d7
Schedule refresh of licenses for STD plugin with delay
This addresses two things:
- It allows for better load-balancing, as STD refresh can be postponed for a short while after bot logs in - it has more important matters to handle right away, and STD is optional/supportive plugin.
- It helps @xPaw sleep better at night working around fools with their ASFs crashing thirty times per second due to third-party plugins.
2024-02-02 13:17:55 +01:00
Archi
fc760e1a84
Misc 2024-01-30 14:30:52 +01:00
Archi
608bece8dc
Misc 2024-01-29 18:49:29 +01:00
Sebastian Göls
dbf7148fbe
Happy new year! (#3121)
Co-authored-by: Sebastian Göls <sebastian.goels@salvagninigroup.com>
2024-01-08 11:33:28 +01:00
Archi
12c4b7e924
Apply frozen collections optimizations 2024-01-03 13:46:54 +01:00
Archi
7f1ecdd585
Misc 2024-01-01 23:22:19 +01:00
Archi
01b2e205be
Make std command return before refresh finishes 2024-01-01 23:16:52 +01:00
Archi
40ab1d848c
.NET 8 code enhancements 2023-12-11 23:55:13 +01:00
Archi
b16a459ab8
Misc 2023-12-05 01:53:14 +01:00
Archi
da2fd37aa1
Make STD work also in on-demand mode 2023-12-05 01:43:55 +01:00
Archi
8d1d508fe5
Use ASF's global database for STD package access tokens 2023-12-05 00:05:16 +01:00
Archi
3f04144e41
Use cancellation in more places 2023-11-14 21:20:51 +01:00
Archi
f2ff2f4929
Closes #3060 2023-11-14 20:01:29 +01:00
Łukasz Domeradzki
b34f18497d
.NET 8 (#3005)
* Initial .NET 8

* Make it compile in release mode ignoring warnings for now

* First round of improvements

* Second round of improvements

* Third round of improvements

* Use new throws

* Fix .NET Framework, YAY, thanks madness!

Madness devs are awesome

* Misc

* Misc

* AF_NETLINK might be required for some http calls

No clue why

* Fix service files

Doesn't do what it should

* Update CardsFarmer.cs

* New improvements

* Address feedback

* Misc

* Misc

* Misc refactor

* Misc
2023-11-14 19:12:33 +01:00
Archi
bceef4f74e
Fix Abry potato server 2023-07-13 22:47:42 +02:00
Archi
d7e8710333
Do not announce/match with limited accounts, lockdowns and trade bans, improve ArchiCacheable
We can totally make use of success previously more often
2023-02-11 15:58:15 +01:00
Archi
8008a04354
Code cleanups and improvements
- Make use of new UnixFileMode, always one native method we need to maintain less
- Add madness support for it, because new feature of course
- Add optional netstandard target and required compatibility for it, so I can test netf-oriented changes easier
2023-02-09 02:25:11 +01:00
Archi
8bb48d829e
STD: Add support for KnownDepotIDs 2023-01-23 12:08:30 +01:00
Archi
4c166102c5
Misc 2023-01-23 11:30:01 +01:00
Archi
a91a4aada6
Fetch main depot key only if we managed to fetch some other ones 2023-01-23 11:25:20 +01:00
Archi
a01ea00873
STD: Add 500ms delay between depot key requests 2023-01-21 21:16:01 +01:00
Archi
b9c75e73f0
Do a recovery of single depot tasks 2023-01-19 15:17:47 +01:00
Archi
cca21900a6
Allow STD requests to fail, and continue with other ones 2023-01-19 15:06:06 +01:00
Archi
4e382732d9
Misc refactor 2022-12-15 19:16:28 +01:00
Łukasz Domeradzki
98ef37e722
Extract PublicListing and MatchActively to a plugin, resurrect MatchActively (#2759)
* Start work on extracting remote communication

* ok

* Dockerfile fixes

* More fixes

* Prepare /Api/Announce and /Api/HeartBeat

* Decrease publish race conditions

* OK

* Misc

* Misc

* Misc

* Move Steam group part back to ASF core

* Finally implement match actively v2 core

* Update RemoteCommunication.cs

* Use single round exclusively, report inventories more often

* Use randomization when asking others for assetIDs

* Add support for license and crowdin

* Kill dead code

* Fix return type of inventories

* Fix responses for good

* Unify old backend with new

* Report whole inventory, always

Helps with optimization on the backend side in terms of inventory fetching

* Update RemoteCommunication.cs

* Determine index of each asset and tell server about it

* Update AnnouncementRequest.cs

* Fix ASF screwing up with the order

* Fix warnings

* Misc rename

* Final logging touches
2022-12-15 18:46:37 +01:00
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