PhantomGamers / SteamFriendsPatcher

EnableNewSteamFriendsSkin, now with a GUI and auto scanning!
MIT License
199 stars 8 forks source link

Not patching from cloudflare #11

Closed LaserFlash closed 3 years ago

LaserFlash commented 4 years ago

Problem

Can successfully patch file from steamcommunity-a.akamaid.net Never succeeds with community.cloudflare.steamstatic.com files [Warning] Cache file does not exist, is outdated, or is different from expected.

Log

[10/09/2020 8:03:16 PM] [Warning] Cache file does not exist, is outdated, or is different from expected.
[10/09/2020 8:03:16 PM] [Info] Patching Library [BETA]...
[10/09/2020 8:03:16 PM] [Info] Library already patched.
[10/09/2020 8:03:16 PM] [Debug] Crash scanner started.
[10/09/2020 8:03:16 PM] [Debug] Library scanner started.
[10/09/2020 8:03:16 PM] [Info] Checking for latest friends.css...
[10/09/2020 8:03:16 PM] [Info] friends.css is already up to date.
[10/09/2020 8:03:16 PM] [Info] Cache Watcher Started.
[10/09/2020 8:03:22 PM] [Info] Checking for latest friends.css...
[10/09/2020 8:03:23 PM] [Info] friends.css is already up to date.
[10/09/2020 8:03:54 PM] [Info] Cache Watcher Stopped.
[10/09/2020 8:03:54 PM] [Info] Force scan started.
[10/09/2020 8:03:54 PM] [Info] Checking for latest friends.css...
[10/09/2020 8:03:54 PM] [Info] friends.css is already up to date.
[10/09/2020 8:03:54 PM] [Info] Finding list of possible cache files...
[10/09/2020 8:03:54 PM] [Info] Found 28 possible cache files.
[10/09/2020 8:03:54 PM] [Info] Checking cache files for match...
[10/09/2020 8:03:54 PM] [Warning] Cache file does not exist, is outdated, or is different from expected.
[10/09/2020 8:03:54 PM] [Info] Patching Library [BETA]...
[10/09/2020 8:03:54 PM] [Info] Library already patched.
[10/09/2020 8:03:54 PM] [Debug] Crash scanner started.
[10/09/2020 8:03:54 PM] [Debug] Library scanner started.
[10/09/2020 8:03:54 PM] [Info] Checking for latest friends.css...
[10/09/2020 8:03:54 PM] [Info] friends.css is already up to date.
[10/09/2020 8:03:54 PM] [Info] Cache Watcher Started.
[10/09/2020 8:03:57 PM] [Debug] New file found: f_00002b
[10/09/2020 8:03:58 PM] [Info] Successfully found matching friends.css at C:\Users\brynt\AppData\Local\Steam\htmlcache\Cache\f_00002b.
[10/09/2020 8:03:58 PM] [Info] Overwriting with patched version...
[10/09/2020 8:03:58 PM] [Info] Done! Put your custom css in c:\program files (x86)\steam\clientui\friends.custom.css
[10/09/2020 8:03:58 PM] [Info] Close and reopen your Steam friends window to see changes.
[10/09/2020 8:03:58 PM] [Info] Checking for latest friends.css...
[10/09/2020 8:03:58 PM] [Info] friends.css is already up to date.
[10/09/2020 8:03:58 PM] [Debug] New file found: f_00002d
[10/09/2020 8:03:58 PM] [Debug] New file found: f_00002f
[10/09/2020 8:03:58 PM] [Debug] New file found: f_00002e
[10/09/2020 8:03:59 PM] [Debug] f_00002d did not match.
[10/09/2020 8:03:59 PM] [Debug] f_00002f did not match.
[10/09/2020 8:03:59 PM] [Debug] f_00002e did not match.
[10/09/2020 8:04:06 PM] [Info] Checking for latest friends.css...
[10/09/2020 8:04:06 PM] [Info] friends.css is already up to date.

Log Context

LaserFlash commented 4 years ago

Also from some experimentation with a VPN. It seems steam decides between steamcommunity-a.akamaid.net & community.cloudflare.steamstatic.com based on ping

PhantomGamers commented 4 years ago

It pulls the url of the friends.css from https://steam-chat.com/chat/clientui/?l=&cc=&build, which should switch between akamai and cloudflare at the same rate as the steam client, so you have to force check until the patcher gets the same version of the css as the client (it will print an etag: {etag} line every time it finds a new one with debug messages enabled)

I plan on having an option to keep multiple versions of friends.css loaded in the patcher, and then to check for a few times automatically to hopefully get the other version, but it's very inconsistent... it would make sense if it's ping based but even then it's not consistent at all hrm

LaserFlash commented 4 years ago

Hmm, Looking at https://steam-chat.com/chat/clientui/?l=&cc=&build, Suggests they should both always match up (being cloudflare 95% of the time)

So not really sure whats causing my problem.

But the 5% of the time I get steamcommunity-a.akamaid.net it works flawlessly (that just doesn't happen much)

PhantomGamers commented 4 years ago

Can you check the Steam client in dev mode to see what version of the css the client is using? Can you confirm a scenario where the patcher and client have the same friends.css etag and the patcher fails to find it?

If you could upload the cache files in such a scenario I'd love to look at them to see why it's not matching. You can either upload them here or DM them to me on Discord if privacy is a concern

LaserFlash commented 4 years ago

1st attempt:

Client CSS: https://community.cloudflare.steamstatic.com/public/css/webui/friends.css?v=nGQ_ynZSpgD6&l=english&_cdn=cloudflare Patcher etag: nGQ_ynZSpgD6

2nd Attempt - this one showed skin

Client CSS: https://steamcommunity-a.akamaihd.net/public/css/webui/friends.css?v=72tWMuZJMdSY&l=english Patcher etag: 72tWMuZJMdSY

3rd Attempt

Client CSS: https://community.cloudflare.steamstatic.com/public/css/webui/friends.css?v=nGQ_ynZSpgD6&l=english&_cdn=cloudflare Patcher etag: nGQ_ynZSpgD6

4th Attempt

Client CSS: https://community.cloudflare.steamstatic.com/public/css/webui/friends.css?v=72tWMuZJMdSY&l=english&_cdn=cloudflare Patcher etag: 72tWMuZJMdSY

5th Attempt

Client CSS: https://community.cloudflare.steamstatic.com/public/css/webui/friends.css?v=72tWMuZJMdSY&l=english&_cdn=cloudflare Patcher etag: 72tWMuZJMdSY


The patcher never failed to find it, but the only one that ever seems to take hold is the steamcommunity-a.akamaihd.net

Cache Files: https://file.io/mDYPqTLFeXPV Its a bit big

PhantomGamers commented 4 years ago

The file.io link you posted was a 404 page.

I posted a new version of the patcher if you want to see if it's any better, might make the cloudflare patching stick.

LaserFlash commented 4 years ago

The link probably expired. A new one: https://gofile.io/d/Ge68of (for the same cache files)

Neither of the newer versions helped. I suppose the only other thing worth pointing out is I do get

[Warning] Cache file does not exist, is outdated, or is different from expected.

on every check until the first connection to steamcommunity-a.akamaid.net

PhantomGamers commented 4 years ago

Oddly ChromeCacheView can't seem to parse that index file so something might be corrupt there but if your Steam client is using the akamaid.net version it would be normal for the patcher to fail to find the file until the patcher also obtains the akamaid.net version. I have an idea to potentially make this more reliable for the next version.

PhantomGamers commented 3 years ago

I pushed a newer version that should hopefully solve this.

LaserFlash commented 3 years ago

Much better success rate now, largely helped by the scanner opening and closing the client between 2 and 18 times until nGQ_ynZSpgD is requested again

Have a slight quirk that cloudflare varies between two files

That both have the same etag. One gets patched the other doesn't

Current cache files: https://gofile.io/d/QDdDRP

But good work on the changes so far

PhantomGamers commented 3 years ago
  • v=72tWMuZJMdSY (not patched - patcher thinks it succeeds though)

To clarify here the only measure the patcher has of success is whether it successfully replaced the file with its patched equivalent. It doesn't know what Steam is actually doing. I wonder if the issue isn't the autoscanner patching too soon which causes Steam to regrab the file but I don't understand why this would only affect the cloudflare version and why it doesn't seem to do this for me hrm

LaserFlash commented 3 years ago

I'm currently stepping through things slower just to see where it goes wrong.

  1. Open Friends List creates v=w1ulojDvlf_b etag="kA0ETHnbtu01" cacheName=f_00001a
  2. Close Friends List
  3. Patcher Force Check
    [16/09/2020 7:04:35 PM] [Info] Force scan started.
    [16/09/2020 7:04:35 PM] [Info] Checking for latest friends.css...
    [16/09/2020 7:04:35 PM] [Info] Downloaded friends.css with etag: "w1ulojDvlf_b"
    [16/09/2020 7:04:36 PM] [Info] Downloaded friends.css with etag: "kA0ETHnbtu01"
    [16/09/2020 7:04:36 PM] [Info] Successfully downloaded friends.css files.
    [16/09/2020 7:04:36 PM] [Info] Finding list of possible cache files...
    [16/09/2020 7:04:36 PM] [Info] Found 22 possible cache files.
    [16/09/2020 7:04:36 PM] [Info] Checking cache files for match...
    [16/09/2020 7:04:36 PM] [Info] Successfully found matching friends.css for "w1ulojDvlf_b" at C:\Users\brynt\AppData\Local\Steam\htmlcache\Cache\f_00001a.
    [16/09/2020 7:04:36 PM] [Info] Overwriting with patched version...
    [16/09/2020 7:04:36 PM] [Info] Done! Put 
  4. Check file in ChromeCacheView (f_00001a) Its still there and contents as the new imports in it
  5. Reopen Friends List removes v=w1ulojDvlf_b etag="kA0ETHnbtu01" cacheName=f_00001a creates v=w1ulojDvlf_b etag="kA0ETHnbtu01" cacheName=f_00001b
  6. Patcher Force Check
    [16/09/2020 7:10:02 PM] [Info] Force scan started.
    [16/09/2020 7:10:02 PM] [Info] Checking for latest friends.css...
    [16/09/2020 7:10:02 PM] [Info] Downloaded friends.css with etag: "w1ulojDvlf_b"
    [16/09/2020 7:10:03 PM] [Info] Downloaded friends.css with etag: "kA0ETHnbtu01"
    [16/09/2020 7:10:03 PM] [Info] Successfully downloaded friends.css files.
    [16/09/2020 7:10:03 PM] [Info] Finding list of possible cache files...
    [16/09/2020 7:10:03 PM] [Info] Found 22 possible cache files.
    [16/09/2020 7:10:03 PM] [Info] Checking cache files for match...
    [16/09/2020 7:10:03 PM] [Info] Successfully found matching friends.css for "w1ulojDvlf_b" at C:\Users\brynt\AppData\Local\Steam\htmlcache\Cache\f_00001b.
    [16/09/2020 7:10:03 PM] [Info] Overwriting with patched version...
    [16/09/2020 7:10:03 PM] [Info] Done!
  7. Check file in ChromeCacheView (f_00001b) Its still there and contents as the new imports in it
  8. Reopen Friends List removes v=w1ulojDvlf_b etag="kA0ETHnbtu01" cacheName=f_00001b creates v=w1ulojDvlf_b etag="kA0ETHnbtu01" cacheName=f_00001c

And that repeats until v=kA0ETHnbtu01 etag="kA0ETHnbtu01" cacheName=f_00003e is retrieved and patched.

One thing I did notice in ChromeCacheView while doing this

So I would say there is something weird about v=w1ulojDvlf_b etag="kA0ETHnbtu01" that chrome does not like

LaserFlash commented 3 years ago

Did a little more testing without the patcher running.

v=w1ulojDvlf_b etag="kA0ETHnbtu01" is always replaced regardless of if the patcher does anything or has been launched.

Now think this is probably steam/chrome being bad and serving a file it can't cache properly. wonder if its related to the mismatched v and etag

PhantomGamers commented 3 years ago

wonder if its related to the mismatched v and etag

This would make a lot of sense to me, although if this is just a Steam bug then I'm not sure if there's much I can do to fix it hrm

If I could parse the index file perhaps I could only consider files as valid to patch if the version and etags match and then just reopen the friends window until it finds something that does, but I haven't had luck figuring out how to do this outside of ChromeCacheView

LaserFlash commented 3 years ago

Would seem Steam have now fixed the problem of their broken caching. So this issue is now fixed