# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: Phira MP TS
spec:
    description: Phira multiplayer server implemented in Node.js (TypeScript), providing online multiplayer and spectator services for Phira game.
    coverImage: https://phira.moe/assets/icon-708be29a.png
    icon: https://phira.moe/assets/icon-708be29a.png
    variables:
        - key: PUBLIC_DOMAIN
          type: DOMAIN
          name: Domain
          description: What is the domain you want for your Phira MP server?
    tags:
        - Game
        - Multiplayer
        - Node.js
    readme: |-
        # Phira MP Typescript

        This project is a Node.js (TypeScript) port of the Phira multiplayer server from https://github.com/TeamFlos/phira-mp, maintaining the same protocol and core behavior (handshake, encoding/decoding, room state machine, spectator forwarding, authentication process, etc.).

        ## Features
        - Multiplayer online gaming
        - Spectator mode
        - Configurable via environment variables or YAML
        - Docker support
        - Low resource requirements (tested on 0.5 core, 128MB RAM)

        ## Configuration
        - HOST: TCP service listen address (default "::")
        - PORT: TCP service listen port (default 12346)
        - HTTP_SERVICE: Enable HTTP service (default true)
        - HTTP_PORT: HTTP service listen port (default 12347)
        - ROOM_MAX_USERS: Max users per room (default 8, max 64)
        - MONITORS: Spectator user ID list (default "2")

        ## Ports
        - TCP: 12346
        - HTTP: 12347 (if enabled)
    services:
        - name: Phira MP Server
          icon: https://raw.githubusercontent.com/Pimeng/phira-mp-ts/main/.github/resources/phira_.png
          template: PREBUILT
          spec:
            id: phira-mp-server
            source:
                image: ghcr.io/pimeng/phira-mp-ts:latest
            ports:
                - id: tcp
                  port: 12346
                  type: TCP
                - id: http
                  port: 12347
                  type: HTTP
            env:
                CONSOLE_LOG_LEVEL:
                    default: INFO
                HOST:
                    default: '::'
                HTTP_PORT:
                    default: "12347"
                HTTP_SERVICE:
                    default: "true"
                LOG_LEVEL:
                    default: INFO
                MONITORS:
                    default: "2"
                PORT:
                    default: "12346"
                ROOM_MAX_USERS:
                    default: "8"
          domainKey: PUBLIC_DOMAIN
localization:
    zh-CN:
        description: 基于 Node.js 的 Phira 多人联机服务，提供 Phira 游戏的在线多人游戏和观战功能。
        variables:
            - key: PUBLIC_DOMAIN
              type: DOMAIN
              name: 域名
              description: 你想将 Phira MP 服务绑定在哪个域名上？
        readme: |-
            # Phira MP Typescript

            本项目基于 https://github.com/TeamFlos/phira-mp 中的实现，将同一套多人联机/观战服务按原逻辑迁移到 Node.js（TypeScript）版本，目标是保持协议与核心行为一致（握手、编解码、房间状态机、观战转发、认证流程等）。

            ## 功能特性
            - 多人在线游戏
            - 观战模式
            - 通过环境变量或 YAML 配置
            - Docker 支持
            - 低资源需求（测试在 0.5 核 128MB RAM 下运行）

            ## 配置
            - HOST: TCP 服务监听地址（默认 "::"）
            - PORT: TCP 服务监听端口（默认 12346）
            - HTTP_SERVICE: 启用 HTTP 服务（默认 true）
            - HTTP_PORT: HTTP 服务监听端口（默认 12347）
            - ROOM_MAX_USERS: 单房间最大玩家数（默认 8，最大 64）
            - MONITORS: 观战用户 ID 列表（默认 "2"）

            ## 端口
            - TCP: 12346
            - HTTP: 12347（如果启用）
