Skip to content

Add original Minecraft plugin bridge and structured config forms - #4

Open
EndlessPixel wants to merge 2 commits into
EasybotCE:mainfrom
EndlessPixel:feat/minecraft-bridge
Open

EndlessPixel wants to merge 2 commits into
EasybotCE:mainfrom
EndlessPixel:feat/minecraft-bridge

Conversation

@EndlessPixel

Copy link
Copy Markdown

What

  • Serve the original EasyBot plugin protocol on /bridge (JSON over WebSocket, integer op, snake_case fields): Hello → Identify → IdentifySuccess, then Packet/CallBack with exec_op.
  • Per-server token authentication against servers.detail.token; tokens are generated with the record and can be rotated via POST /api/servers/{id}/token.
  • Observed connection status exposed at GET /api/bridge/status (never derived from the enabled flag).
  • Bidirectional forwarding: plugin SYNC_MESSAGE → OneBot 11 group, group message → plugin SEND_TO_CHAT, with a 5s echo window so a two-way rule cannot loop.
  • ConfigForm.vue: adapter, server and sync-rule settings are edited through real form controls instead of a raw JSON textarea. Adapters and servers are dropdowns in the sync-rule form.

Fixes

  • WebSocket upgrades always failed because statusRecorder hid http.Hijacker; it now forwards Hijack/Flush/Unwrap.
  • SQLITE_BUSY appeared when the async log writer raced API writes. The SQLite pool is pinned to one connection so the WAL and busy_timeout pragmas apply to every statement.

Verification

  • go vet ./... and go test ./... pass. Bridge tests cover handshake, invalid-token rejection, chat forwarding, echo suppression and the PLAYER_JOIN callback.
  • npm run build passes (vue-tsc included).
  • Manual end-to-end with a simulated plugin and a mock OneBot server: SYNC_MESSAGE produced send_group_msg with [演示服 Bridge] Steve: ..., and POST /api/bridge/{id}/send reached the plugin as SEND_TO_CHAT.

Not included

  • No shipped EasyBot plugin binary has been tested against this endpoint yet; the wire format was derived from EasyBot.Bridge.decompiled.cs in the EasyBot-Recovered repository.
  • Binding, command and PlaceholderAPI packets are acknowledged but not implemented. Other config kinds (groups, players, commands, AI, templates, plugins) still use JSON because their detail shape is not defined by any runtime yet.

Serve the original EasyBot plugin protocol (JSON over WebSocket, Hello/Identify/HeartBeat/Packet/CallBack) on /bridge with per-server token authentication, observed connection status, and SYNC_MESSAGE / SEND_TO_CHAT forwarding between Minecraft servers and OneBot 11 groups. Server tokens are generated with the record and can be rotated via POST /api/servers/{id}/token.

Edit adapter, server and sync-rule settings through real form controls instead of raw JSON. Fix the WebSocket upgrade failing because the response recorder hid http.Hijacker, and pin the SQLite pool to one connection so the WAL pragmas apply to every write and SQLITE_BUSY no longer appears under concurrent API and log writes.

A few utility classes now use Tailwind v4 spacing shorthand instead of arbitrary values; the rendered sizes are identical.
@Ftimever
Ftimever self-requested a review November 8, 2026 05:05
@Ftimever

Ftimever commented Nov 8, 2026

Copy link
Copy Markdown
Member

我们或许不必参考原有op码实现

@EndlessPixel

EndlessPixel commented Nov 8, 2026 via email

Copy link
Copy Markdown
Author

@Minecraft0122

Copy link
Copy Markdown
Contributor

等待你解决冲突,加油!

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.

3 participants