Skip to content

Conversation

colbster937
Copy link

@colbster937 colbster937 commented Oct 10, 2025

Adds WebMC to the multiplayer server list, allows connecting to local servers for development, fixes icons on websocket servers, and allows servers to see if the client is mcraft or something else.

Summary by CodeRabbit

  • New Features

    • Added “WebMC” to the promoted servers list.
    • Promoted servers now show a friendly name alongside the IP.
    • Server status cards can display server icons when available.
    • Added “wss://play.webmc.fun” to example server suggestions.
  • Chores

    • Improved WebSocket connection URL construction and query-parameter handling for better compatibility.

Copy link

coderabbitai bot commented Oct 10, 2025

Walkthrough

Adds a promoted server entry to config, extends promoteServers and StoreServerItem with an optional name, adds a server example in the connect UI, changes WebSocket URL construction to infer ws/wss from host prefix and append a client_mcraft query param, and surfaces favicon in WebSocket ping results.

Changes

Cohort / File(s) Summary
Config: promoted servers
config.json
Inserted a new promoted server object with ip: "wss://play.webmc.fun" and name: "WebMC" into promoteServers.
Types and public declarations
src/appConfig.ts, src/react/appStorageProvider.ts
promoteServers entries now include an optional name field; StoreServerItem gains an optional name property.
WebSocket connection construction
src/mineflayer/websocket-core.ts
Protocol selection simplified: use 'ws' only if host starts with ws://, otherwise 'wss'; WebSocket URL now parses host URL, preserves/merges search params and appends a client_mcraft query param before opening the socket.
React: server list and status
src/react/ServersListProvider.tsx
Promoted server objects populated with name; WebSocket ping/status now includes an icon field sourced from pingResult.fullInfo.favicon alongside existing text fields.
React: add/connect UI examples
src/react/AddServerOrConnect.tsx
Added wss://play.webmc.fun to serverExamples used for the Server IP placeholder.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant UI as AddServerOrConnect
  participant List as ServersListProvider
  participant WS as websocket-core
  participant Server

  User->>UI: Enter/select server
  UI->>List: Request server list / connect
  List->>List: Build promoted servers (include name)
  Note right of List #cfe8ff: When pinging WS servers, include favicon as icon
  List->>WS: Connect(host)
  rect rgba(230,245,255,0.6)
    WS->>WS: Determine protocol: 'ws' if host startsWith "ws://", else 'wss'
    WS->>WS: Parse host URL, merge/search params, append client_mcraft
    WS->>Server: Open WebSocket to constructed URL
  end
  Server-->>WS: Handshake / status
  WS-->>List: Ping/connection result (text, icon)
  List-->>UI: Update UI with name, status, icon
  UI-->>User: Show connection/status
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

A hop and a tap to a brand-new host,
WebMC joins the lineup—cheers from the post.
Names now sparkle, favicons shine,
Query tails whisper: client_mcraft in line.
I nibble the socket and bound in delight. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title Check ❓ Inconclusive The title uses an acronym and loosely references the changeset without clearly conveying what was updated; while it does mention adding WebMC and some WS changes, the phrasing is too generic for someone scanning the history to immediately understand the primary updates. Consider rewording the title to explicitly highlight adding the WebMC server entry and the specific WebSocket improvements such as URL construction updates and icon support.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a88c8b5 and 0f66018.

📒 Files selected for processing (5)
  • config.json (1 hunks)
  • src/appConfig.ts (1 hunks)
  • src/mineflayer/websocket-core.ts (1 hunks)
  • src/react/AddServerOrConnect.tsx (1 hunks)
  • src/react/ServersListProvider.tsx (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/vars-usage.mdc)

src/**/*.ts: You may use the global variable bot directly in any file under the src/ directory (e.g., src/mineflayer/playerState.ts).
In src/ code, you may use the global variable appViewer from src/appViewer.ts directly. Do not import appViewer or use window.appViewer; use the global appViewer variable as-is.

Files:

  • src/appConfig.ts
  • src/mineflayer/websocket-core.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-and-deploy

@zardoy
Copy link
Owner

zardoy commented Oct 10, 2025

/deploy

Copy link

Deployed to Vercel Preview: https://prismarine-59owwgk22-zaro.vercel.app
Playground
Storybook

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2cae476 and 888cfd5.

📒 Files selected for processing (1)
  • src/mineflayer/websocket-core.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/vars-usage.mdc)

src/**/*.ts: You may use the global variable bot directly in any file under the src/ directory (e.g., src/mineflayer/playerState.ts).
In src/ code, you may use the global variable appViewer from src/appViewer.ts directly. Do not import appViewer or use window.appViewer; use the global appViewer variable as-is.

Files:

  • src/mineflayer/websocket-core.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-and-deploy

@zardoy
Copy link
Owner

zardoy commented Oct 10, 2025

Can you help fixing minting errors? After that I m merging

@colbster937
Copy link
Author

done

@zardoy
Copy link
Owner

zardoy commented Oct 10, 2025

very well done PR 👏 thanks!

@zardoy zardoy changed the title Multiplayer Improvements Add WebMC & WS changes Oct 10, 2025
@zardoy zardoy merged commit 634df8d into zardoy:next Oct 10, 2025
3 checks passed
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