Skip to content

Merge upstream v0.3.5: types, protocol, session handling#9

Closed
zaloguj12 wants to merge 1 commit intodevfrom
capy/sync-upstream-035
Closed

Merge upstream v0.3.5: types, protocol, session handling#9
zaloguj12 wants to merge 1 commit intodevfrom
capy/sync-upstream-035

Conversation

@zaloguj12
Copy link
Copy Markdown
Owner

@zaloguj12 zaloguj12 commented Apr 13, 2026

Description

This PR syncs the Android fork with upstream OpenNOW v0.3.5, bringing in new shared types, GFN protocol improvements, ad handling, screenshot/recording APIs, and session management enhancements. All changes maintain Android compatibility via appropriate shims for Node.js-only modules.

Shared Types & IPC

  • Added GameLanguage, KeyboardLayout, AspectRatio, RuntimePlatform types to src/shared/gfn.ts
  • Added ad session types: SessionAdAction, SessionAdInfo, SessionAdState, SessionAdReportRequest
  • Added media types: ScreenshotSaveRequest, RecordingEntry, PrintedWasteZone, ThankYouDataResult
  • Added 20+ new IPC channels for screenshots, recordings, cache management, and ad reporting
  • Created src/shared/sessionError.ts with SessionErrorInfo interface and serialization functions
  • Extended Settings interface with new fields while preserving touchGamepadLayout

Main Process GFN Logic

  • src/main/gfn/types.ts: Added ad-related session fields, negotiatedStreamProfile, sessionRequestData
  • src/main/gfn/errorCodes.ts: Updated error messages, moved SessionErrorInfo to shared
  • src/main/gfn/auth.ts: Added gravatarUrl() with process guard for Android compatibility
  • src/main/gfn/signaling.ts: Added connectionGeneration counter, improved URL parsing, keyframe request support
  • src/main/gfn/cloudmatch.ts: Ported all upstream changes including ad handling, DNS resolution, ICE server normalization; made toSessionInfo() async
  • src/main/gfn/games.ts: Added feature labels and genres extraction (caching stubbed for Android)
  • src/main/settings.ts: Added all new settings with migration/normalization logic

Preload & Renderer Integration

  • src/preload/index.ts: Added 25+ new API methods with invokeSessionChannel wrapper for session error unwrapping
  • src/renderer/src/platform/dnsShim.ts (new): Browser shim for node:dns to enable cloudmatch.ts in WebView
  • src/renderer/src/App.tsx: Fixed StreamSettings object to include all required new fields
  • src/renderer/src/platform/api.ts: Maintained Android path with stub implementations for Electron-only features

Build Configuration

  • electron.vite.config.ts: Added node:dns alias pointing to browser shim
  • tsconfig.json & tsconfig.node.json: Added @main/* path aliases and node types
  • src/shared/deviceHeaders.ts: Added process declare for browser context safety

Open in Capy SCO-1 · Auto

@zaloguj12 zaloguj12 added the capy Generated by capy.ai label Apr 13, 2026 — with Capy AI
Copy link
Copy Markdown

@capy-ai capy-ai Bot left a comment

Choose a reason for hiding this comment

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

Added 1 comment

resolveLaunchAppId(input: ResolveLaunchIdRequest): Promise<string | null>;
createSession(input: SessionCreateRequest): Promise<SessionInfo>;
pollSession(input: SessionPollRequest): Promise<SessionInfo>;
reportSessionAd(input: SessionAdReportRequest): Promise<SessionInfo>;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[🟡 Medium]

OpenNowApi declares reportSessionAd as returning a SessionInfo, but the new main/preload implementations return no payload (Promise<void>/null). This creates a false contract at the shared boundary and can produce runtime undefined/null access bugs when callers use the declared return value. Align the interface with actual behavior (or return a real SessionInfo consistently) so type-checking reflects runtime behavior.

// opennow-stable/src/shared/gfn.ts
createSession(input: SessionCreateRequest): Promise<SessionInfo>;
pollSession(input: SessionPollRequest): Promise<SessionInfo>;
reportSessionAd(input: SessionAdReportRequest): Promise<SessionInfo>;
stopSession(input: SessionStopRequest): Promise<void>;

@zaloguj12 zaloguj12 closed this Apr 25, 2026
@zaloguj12 zaloguj12 deleted the capy/sync-upstream-035 branch April 25, 2026 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

capy Generated by capy.ai

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant