极简对战后端。
Minimal battle backend.
- 双方初始手牌相同。 / Both sides start with the same hand.
- 牌型规则为石头剪刀布。 / The card rule is rock-paper-scissors.
- 平局时双方收回原牌。 / On a tie, both take their cards back.
- 非平局时,败方弃牌入池,胜方随机补一张。 / On a non-tie, the loser sends the card to the pool and the winner draws one.
- 手牌归零即失败。 / A player loses when their hand reaches zero.
- 前 3 回合内,连输 2 回合会触发补牌规则。 / In the first 3 rounds, losing 2 in a row triggers recovery.
- 平局次数达到手牌数时可换牌。 / A player can exchange when tie count reaches hand size.
- 人机对战:玩家出牌,机器人自动响应。 / Bot match: the player moves, the bot responds.
- 房间对战:双方都出牌后结算。 / Room match: resolution starts after both players move.
- 支持同房间连续再战。 / Supports rematch in the same room.
- 注册与登录 / Register and login
- Token 鉴权 / Token auth
- SQLite 持久化 / SQLite persistence
- WebSocket 实时同步 / WebSocket real-time sync
- 多种 Bot 策略 / Multiple bot strategies
- 管理后台与 CLI / Admin panel and CLI
bun install
bun devbun run index.js startstart启动服务 / start servicesconfig配置服务 / edit configpasswd重置管理员密码 / reset admin passwordinstall安装系统服务 / install serviceremove移除系统服务 / remove servicestatus查看状态 / show status
-
SERVER_HOSTNAME -
SERVER_PORT -
SERVER_NAME -
SERVER_DESCRIPTION -
ADMIN_PORT -
ALLOWED_ORIGINS -
AUTH_TOKEN_TTL_HOURS -
TURNSTILE_SECRET_KEY -
TURNSTILE_SECRET_KEY只保存在后端,用于调用 Cloudflaresiteverify。 /TURNSTILE_SECRET_KEYstays on the backend and is used for Cloudflaresiteverify.
data/store.sqlite
- 默认地址:
http://localhost:47807/ Default URL:http://localhost:47807 - 支持用户、日志、配置管理。 / Manages users, logs, and config.