Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Discord] Properly support all URL variations #35

Open
beefchimi opened this issue Jan 20, 2022 · 0 comments
Open

[Discord] Properly support all URL variations #35

beefchimi opened this issue Jan 20, 2022 · 0 comments
Labels
✨ Feature New addition to the codebase (feature, utility, component, etc.) 🧐 Question Further information is requested

Comments

@beefchimi
Copy link
Owner

beefchimi commented Jan 20, 2022

Discord has multiple different URL variations for different purposes:

  1. User profiles (discordapp.com/users/*)
  2. Server/channel urls (discord.com/channels/{serverid}/{channelid})
  3. Official vanity urls (discord.gg/*)

Some examples of valid URLs:

  • https://discord.com/users/username
  • https://discordapp.com/users/0123456789
  • https://discord.com/channels/@me
  • https://discord.com/channels/892738558316662855
  • https://discordapp.com/channels/serverid/channelid/messageid
  • https://discord.gg/vanity-url

At the moment, Socialite works by simply parsing the domain to determine network type, and then parsing the path to determine handle. When parsing for handle, we do not use any other part of the full url to qualify the result.

Additionally, since Discord has different purposes for each of its URL structures... a single preferredUrl simply isn't compatible. Example: Parsing a channels URL and attempting to use the preferredUrl will lead no where useful.

There are two URL parts that may help us increase our confidence in the parsed handle + determine the ideal preferredUrl:

  1. Domain: discord vs discordapp
  2. Top-level domain: .gg vs anything else

It is also worth investigating the @ prefix to better understand its significance in Discord URLs. This may lead to yet another condition - or alternatively - provide an additional mechanism for gaining confidence over the result.

Since this PR, we introduce some snowflake code to handle the discord condition. We really need to pursue a higher-level solution to help solve for these cases.

@beefchimi beefchimi added ✨ Feature New addition to the codebase (feature, utility, component, etc.) 🧐 Question Further information is requested labels Jan 20, 2022
@beefchimi beefchimi changed the title [Discord] Is the capturing correct? [Discord] Properly support all URL variations Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Feature New addition to the codebase (feature, utility, component, etc.) 🧐 Question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant