Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ jobs:
set -euo pipefail
python3 scripts/sync_strategy_switch_page_asset.py
git diff --exit-code -- web/strategy-switch-console/page_asset.js
sed -n '/<script>/,/<\/script>/p' docs/index.html | sed '1d;$d' | node --check --input-type=commonjs
sed -n '/<script>/,/<\/script>/p' web/strategy-switch-console/index.html | sed '1d;$d' | node --check --input-type=commonjs
node --check --input-type=module < web/strategy-switch-console/page_asset.js
node --check --input-type=module < web/strategy-switch-console/worker.js
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ Notes:

## Useful docs

- [Strategy switch GitHub Pages console](docs/index.html)
- [GitHub Pages strategy switch design](docs/github_pages_strategy_switch.md)
- [Authenticated strategy switch console Worker](web/strategy-switch-console/README.md)
- [Strategy switch console Worker](web/strategy-switch-console/README.md)
- [Strategy switch admin backend](docs/strategy_switch_admin_backend.md)
- [Manual strategy switch permission-control plan](docs/manual_strategy_switch_permission_control.zh-CN.md)

Expand Down
4 changes: 1 addition & 3 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ confirm_apply=APPLY_AND_SYNC

## 延伸文档

- [策略切换控制台 GitHub Pages 首页](docs/index.html)
- [GitHub Pages 策略切换网页设计](docs/github_pages_strategy_switch.zh-CN.md)
- [登录版策略切换控制台 Worker](web/strategy-switch-console/README.zh-CN.md)
- [策略切换控制台 Worker](web/strategy-switch-console/README.zh-CN.md)
- [策略切换登录权限后台方案](docs/strategy_switch_admin_backend.zh-CN.md)
- [手动策略切换权限控制方案](docs/manual_strategy_switch_permission_control.zh-CN.md)

Expand Down
110 changes: 0 additions & 110 deletions docs/github_pages_strategy_switch.md

This file was deleted.

110 changes: 0 additions & 110 deletions docs/github_pages_strategy_switch.zh-CN.md

This file was deleted.

12 changes: 0 additions & 12 deletions docs/manual_strategy_switch_web.html

This file was deleted.

4 changes: 2 additions & 2 deletions scripts/sync_strategy_switch_page_asset.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
"""Embed docs/index.html as a Cloudflare Worker module asset."""
"""Embed the strategy switch Worker HTML as a module asset."""

from __future__ import annotations

Expand All @@ -8,7 +8,7 @@


ROOT = Path(__file__).resolve().parents[1]
SOURCE = ROOT / "docs" / "index.html"
SOURCE = ROOT / "web" / "strategy-switch-console" / "index.html"
TARGET = ROOT / "web" / "strategy-switch-console" / "page_asset.js"


Expand Down
9 changes: 5 additions & 4 deletions web/strategy-switch-console/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ Without the KV binding, `/admin` is read-only and the Worker falls back to `ALLO

## Page Asset

`worker.js` serves the same UI as `docs/index.html` through `page_asset.js`.
`worker.js` serves `web/strategy-switch-console/index.html` through `page_asset.js`.

After editing `docs/index.html`, regenerate the asset:
After editing `web/strategy-switch-console/index.html`, regenerate the asset:

```bash
python3 scripts/sync_strategy_switch_page_asset.py
Expand All @@ -76,7 +76,7 @@ Deploy `worker.js` and `page_asset.js` together.

## Account Dropdowns

The public page only ships sample targets. After sign-in, switching stays disabled until the Worker loads private account options; the Worker also rejects dispatches without matching private account config. Copy the example and fill in your real target/account routes:
The Worker page ships sample targets as a fallback. After sign-in, switching stays disabled until the Worker loads configured account options; the Worker also rejects dispatches without matching account config. Copy the example and fill in your real target/account routes:

```bash
cp web/strategy-switch-console/account-options.example.json /tmp/strategy-switch-accounts.json
Expand All @@ -101,7 +101,8 @@ Each account item supports:
"account_selector": "U15998061",
"deployment_selector": "live-u1599-tqqq",
"account_scope": "live-u1599-tqqq",
"service_name": "interactive-brokers-live-u1599-tqqq-service"
"service_name": "interactive-brokers-live-u1599-tqqq-service",
"default_strategy_profile": "tqqq_growth_income"
}
```

Expand Down
8 changes: 5 additions & 3 deletions web/strategy-switch-console/README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,13 @@ audit_log
## 文件结构

```text
index.html
worker.js
page_asset.js
wrangler.toml.example
```

`worker.js` 会复用 `docs/index.html` 的同一套页面。改完页面后运行:
`worker.js` 会通过 `page_asset.js` 发布 `web/strategy-switch-console/index.html`。改完页面后运行:

```bash
python3 scripts/sync_strategy_switch_page_asset.py
Expand All @@ -82,7 +83,7 @@ python3 scripts/sync_strategy_switch_page_asset.py

## 账号下拉配置

公开页面只带示例 target,登录后如果没有加载私有账号配置,“一键切换”仍会保持禁用,Worker 后端也会拒绝 dispatch,避免账号不匹配。复制示例文件后填入你的真实 target/account route:
Worker 页面内置示例 target 作为兜底。登录后如果没有加载账号配置,“一键切换”仍会保持禁用,Worker 后端也会拒绝 dispatch,避免账号不匹配。复制示例文件后填入你的真实 target/account route:

```bash
cp web/strategy-switch-console/account-options.example.json /tmp/strategy-switch-accounts.json
Expand All @@ -107,7 +108,8 @@ wrangler secret put STRATEGY_SWITCH_ACCOUNT_OPTIONS_JSON < /tmp/strategy-switch-
"account_selector": "U15998061",
"deployment_selector": "live-u1599-tqqq",
"account_scope": "live-u1599-tqqq",
"service_name": "interactive-brokers-live-u1599-tqqq-service"
"service_name": "interactive-brokers-live-u1599-tqqq-service",
"default_strategy_profile": "tqqq_growth_income"
}
```

Expand Down
Loading