Skip to content

feat(discord): Join button for the server's Discord invite (C2, client part) - #707

Open
sven-n wants to merge 4 commits into
claude/discord-presence-mumain-597-l2q09dfrom
claude/discord-presence-mumain-597-l2q09d-c2-invite
Open

sven-n wants to merge 4 commits into
claude/discord-presence-mumain-597-l2q09dfrom
claude/discord-presence-mumain-597-l2q09d-c2-invite

Conversation

@sven-n

@sven-n sven-n commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Summary

Stacked on #705 (Discord Rich Presence). The base is that PR's branch, so this diff only shows the new commit. Once #705 is merged, GitHub retargets this PR to main.

The part of C2 that needs no server support: a Join button for the server's Discord invite.

  • config.ini [Discord] InviteUrl holds the invite link to the server's Discord. Shipping it is up to the operator; it is empty by default.
  • The options window's Discord row (from feat(discord): Discord Rich Presence (C1) #705) gets a Join button on the label's line. It opens the invite in the Discord app or the browser through SDL_OpenURL, which works on every platform, unlike the Windows-only ShellExecute helper.
  • Only Discord invite links are accepted: https://discord.gg/<code> or https://discord.com/invite/<code> (also www.discord.com and discordapp.com). The code may only contain letters, digits and dashes, and nothing may follow it. The link will come from the server once the integration info packet exists, so nothing else may ever reach the system's URL handler. With no link or an invalid one, the button is not shown.
  • The check runs when the options window opens, not every frame.
  • Without ENABLE_DISCORD, Invite.h compiles to no-ops, like RichPresence.h.
  • docs/discord.md: a new "Joining the server's Discord" section and the InviteUrl key in the operator setup.

What's left of #698 (needs OpenMU M2/M3): the F5 integration info request and response, bumping OpenMuPacketsVersion, and filling the invite URL and application id from the server, with config.ini as the fallback. The Join button and Invite::Open are what that packet handler will use.

Verification

  • Linux linux-x64 Debug build: full ctest run, 440/440 passed, including 3 new tests: accepted invite forms; refused look-alikes (wrong scheme, wrong host, extra path, query strings, file://, over-long codes); Open refusing a non-invite link.
  • The options window compiles with MU_ENABLE_DISCORD undefined.
  • clang-format 21.1.8 range check and cppcheck (CI flags) are clean on the changed lines.
  • Not tested in a running client: what the button looks like and whether it opens the browser.

Related issues

Part of #698 (C2). Does not close it: the server-provided integration info is still to come.

Checklist

🤖 Generated with Claude Code

https://claude.ai/code/session_012feEciycvL8PGjsezyRFqj


Generated by Claude Code

The options window's Discord row gets a Join button that opens the
server's Discord invite (config.ini [Discord] InviteUrl) through
SDL_OpenURL, in the Discord app or the browser.

Only Discord invite links (https://discord.gg/<code>,
https://discord.com/invite/<code>) are accepted: the link will come from
the server once the integration info packet exists (#698), and nothing
else may reach the system's URL handler. With no or an invalid link the
button is not shown.

The client-side part of #698 that needs no server support.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012feEciycvL8PGjsezyRFqj

@sven-n sven-n left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Part of a review pass over the whole Discord integration.

Small, focused PR and the one security-relevant decision in it — never handing an unvalidated URL to the system handler — is made correctly and for the stated reason. One comment inline about which legitimate invites the validation turns away.


Generated by Claude Code

Comment thread src/source/Integration/Discord/Invite.cpp
…discord-presence-mumain-597-l2q09d-c2-invite
- Invite links may carry a query or fragment, like the "?event=..." of a
  shared event or the "?utm_source=..." of a link copied from the web
  client. The code is checked up to the first '?' or '#'; what follows has
  to be URL-safe characters only, and is opened unchanged.
- Invite::Accept logs a non-empty link which isn't an invite (once), so a
  typo in config.ini doesn't just look like no invite at all.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012feEciycvL8PGjsezyRFqj
…discord-presence-mumain-597-l2q09d-c2-invite

The Join button moves to the RmlUi options window with the Discord
setting: shown in the Discord row while config.ini holds a valid invite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01USFZ9xErMB1EwkpfdUHzoZ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants