OPERATOR GUIDE

監看接入與移植

這個頁面主要供站點維護者查看負載,也可以公開讓使用者參考。它不是遊戲狀態公告,也不提供任何帳號或服務控制權限。

維護者日常使用

別人也想接入?

可以參考並部署到自己的 Cloudflare Pages。每個部署使用自己的唯讀 Token、Account ID 與正式環境 scriptName,不使用本站憑證,也不需要連到本站 API。

  1. Relay 倉庫取得 src/_monitor.jssrc/monitor/。Lite 的對應檔案在 public/
  2. 在輸出目錄放置 _monitor.jsmonitor/,讓现有 Worker 引入下方路由。不要覆蓋原本的 Worker。
  3. /api/monitor 加入 _routes.json 的 include;保留其他既有路由。
  4. 在自己的 Cloudflare Production 設定 MONITOR_ENABLED=true,並以 Secret 保存 MONITOR_ACCOUNT_IDMONITOR_API_TOKENMONITOR_SCRIPT_NAME。Token 僅需 Account Analytics Read,限定自己的帳號。
  5. MONITOR_DATASET 預設為 pagesFunctionsInvocationsAdaptiveGroups;若管理台查詢使用 workersInvocationsAdaptive,才改用該值。
  6. 重新部署,開啟 /monitor/,與 Cloudflare 同時段統計核對。調整頁尾連結、專案標籤與授權標示,避免使用者誤認為是原作者的部署。
import {monitor} from './_monitor.js';
// 放在既有 fetch handler、靜態檔案 fallback 之前:
if (url.pathname === '/api/monitor') {
  return monitor(request, env, '你的專案名称');
}

找不到 scriptName 或要檢查資料集時,參考倉庫的 docs/monitor.md。目前是 Cloudflare API 專用範例,不是可直接套用於所有雲端平台的監控服務。

公開範圍

所有訪客看到同一份彙總資料,不區分管理者登入。Secret、內部識別碼、日誌、訪客與聊天內容都不公開。若以後需要帳單或帳號層級資料,應另外建立有登入保護的管理頁,不加入這個公開 API。公開用量仍會透露站點流量規模。

本範例供學習與研究,不保證穩定性或持續服務;免費額度用盡可能中斷,部署者自行管理額度與費用。來源授權以倉庫 LICENSE 為準。

Integration / reuse guide

This is an operator-focused dashboard that can also be viewed publicly. It shows aggregate platform usage, not game availability, billing or service controls. All visitors see the same data; there is no privileged admin mode.

  1. Copy src/_monitor.js and src/monitor/ from Relay (under public/ in Lite) into your deployment output.
  2. Import the handler into your existing Worker, add the route shown above before the asset fallback, and include /api/monitor in _routes.json. Keep existing routes.
  3. Use your own read-only Account Analytics token and account/script identifiers in Production secrets. Enable MONITOR_ENABLED. Never reuse another deployment's credentials.
  4. Select the dataset used by your Cloudflare metrics query, deploy and compare results with the dashboard.
  5. Replace project labels/footer links and preserve applicable license notices. Setup details are in docs/monitor.md in the repository.

CPU percentiles are per-execution values; metrics can be delayed or sampled. Account-wide billing and private diagnostics belong in a separate authenticated management page. Public aggregates still reveal traffic patterns. This Cloudflare-specific example is for learning, carries no availability guarantee, and each operator manages their own quotas and charges.