DiscordMessenger / dm

Discord Messenger is a free Discord-compatible messaging client targeting both new and old Windows.
MIT License
907 stars 18 forks source link

Add support for X-Super-Properties #17

Closed nakoyasha closed 5 months ago

nakoyasha commented 6 months ago

X-Super-Properties is a base64-encoded JSON header that identifies the client by letting the server know it's build number, release channel, etc It might be a good idea to support it as Discord might otherwise flag accounts for sending user-api requests without it (as some features rely on it being there) Example:

{
  "os": "Windows",
  "browser": "Chrome",
  "device": "",
  "system_locale": "en-US",
  "browser_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
  "browser_version": "124.0.0.0",
  "os_version": "10",
  "referrer": "",
  "referring_domain": "",
  "referrer_current": "",
  "referring_domain_current": "",
  "release_channel": "canary",
  "client_build_number": 291821,
  "client_event_source": null,
  "design_id": 0
}

More info about the header is documented here!

iProgramMC commented 6 months ago

What features rely on it being there?

Anyway, I've made the change in a PR: #25. What do you think? I'm just hoping it doesn't have the opposite effect of triggering antispam because we're trying to imitate a web client.

nakoyasha commented 6 months ago

What features rely on it being there?

Okay, I shouldn't have mentioned it since it's mostly just experimental features that rely on it (e.g, some experiments (aka, discord's implementation of a/b testing) will only be sent to the client if it's build_number is higher/is 269579)

I'm just hoping it doesn't have the opposite effect of triggering antispam because we're trying to imitate a web client.

It shouldn't! although it might be a good idea to update it every so often - Discord might find it suspicious that there's a big number of users with a really old build_number for example - but I don't think there's been any documented cases of that happening yet

Anyway, I've made the change in a PR: https://github.com/DiscordMessenger/dm/pull/25. What do you think?

For now, I think it's good! The only issue I have is the one I've mentioned above (client config with an outdated build_number), although I think it would be pretty hard to automate, so it's out of scope for the PR imo