feat: Discord Rich Presence integration for activity display#126
feat: Discord Rich Presence integration for activity display#126Meganugger wants to merge 4 commits intoOpenCloudGaming:devfrom
Conversation
…g details in the GFN client.
| // Logs export IPC handler | ||
| ipcMain.handle(IPC_CHANNELS.LOGS_EXPORT, async (_event, format: "text" | "json" = "text"): Promise<string> => { | ||
| return exportLogs(format); | ||
|
|
There was a problem hiding this comment.
[🔴 Critical]
The DISCORD_UPDATE_PRESENCE and DISCORD_CLEAR_PRESENCE IPC handlers are added inside the LOGS_EXPORT handler's async callback, after a return statement. They are unreachable dead code and will never be registered with ipcMain. Every call from the renderer (window.openNow.updateDiscordPresence(...)) will fail because no handler exists for those channels.
// opennow-stable/src/main/index.ts
ipcMain.handle(IPC_CHANNELS.LOGS_EXPORT, async (_event, format) => {
return exportLogs(format);
// Discord Rich Presence IPC handlers ← unreachable!
ipcMain.handle(IPC_CHANNELS.DISCORD_UPDATE_PRESENCE, ...);
ipcMain.handle(IPC_CHANNELS.DISCORD_CLEAR_PRESENCE, ...);
});Move both ipcMain.handle calls outside the LOGS_EXPORT handler, placing them at the same level as the other top-level IPC registrations in registerIpcHandlers().
| Create an application at discord.com/developers and paste its Client ID here. | ||
| </span> | ||
| </div> | ||
| </div> |
There was a problem hiding this comment.
[🟠 High]
The Discord <section> is inserted after the </div> that closes the scrollable content wrapper (line 1421 on the base), and an additional </div> is added after it. This results in: (1) the Discord section rendering outside the scrollable content area, and (2) an unmatched </div> that breaks the JSX tree, which will cause a React rendering error or broken layout.
// opennow-stable/src/renderer/src/components/SettingsPage.tsx
</section> {/* end of previous section */}
</div> {/* closes scrollable content area */}
<section>...</section> {/* Discord section — outside container! */}
</div> {/* extra unmatched closing div */}
<div className="settings-footer">Move the Discord <section> block above the </div> that closes the scrollable content container, and remove the extra </div>.
|
@Meganugger can you fix these issues? |
Summary
Integrates Discord Rich Presence to display user activity and streaming details (game name, resolution, FPS, region, elapsed time) in the GFN client, with fixes for reliable game title resolution and persistent app timer.
Added
DiscordPresenceServiceinsrc/main/discord/for managing Discord RPC lifecyclediscord:update-presence,discord:clear-presence) in preload and shared IPCdiscordPresenceEnabledanddiscordClientIdfields in settings and shared typesApp.tsxto push idle/queue/streaming presence updatesUpdated
package.json/package-lock.jsonwith@xhayper/discord-rpcdependencyDiscordPresencePayloadinterface ingfn.tsfor typed presence dataFixed
Validation Notes
Recommended smoke checks: