V10.509 接入 Webcrumbs 同源資產代理與 writer preflight gate
All checks were successful
CD Pipeline / deploy (push) Successful in 1m8s
All checks were successful
CD Pipeline / deploy (push) Successful in 1m8s
This commit is contained in:
@@ -16,22 +16,24 @@
|
||||
```env
|
||||
WEBCRUMBS_ENABLED=true
|
||||
WEBCRUMBS_BASE_URL=https://webcrumbs.wooo.work
|
||||
WEBCRUMBS_RUNTIME_VERSION=@v0.1.5
|
||||
WEBCRUMBS_RUNTIME_PATH=/runtime/@v0.1.5
|
||||
WEBCRUMBS_RUNTIME_VERSION=shared-ui-poc-0.1.0
|
||||
WEBCRUMBS_RUNTIME_PATH=/webcrumbs-assets/loader/webcrumbs-compatible-loader.js
|
||||
WEBCRUMBS_RUNTIME_URL=
|
||||
WEBCRUMBS_PLUGIN_BASE_URL=https://webcrumbs.wooo.work/plugins/momo-pro
|
||||
WEBCRUMBS_PLUGIN_BASE_URL=/webcrumbs-assets/plugins
|
||||
WEBCRUMBS_ASSET_UPSTREAM_URL=http://192.168.0.188:18088
|
||||
```
|
||||
|
||||
若實際部署成 CDN 相容路徑,例如 `https://webcrumbs.wooo.work/@v0.1.5`,請改用:
|
||||
目前正式頁面預設走 momo-pro 同源 asset proxy:
|
||||
|
||||
- `/webcrumbs-assets/loader/...`
|
||||
- `/webcrumbs-assets/plugins/...`
|
||||
- `/webcrumbs-assets/demo/...`
|
||||
|
||||
這樣即使 `webcrumbs.wooo.work` 的公網 TLS 或 Basic Auth 尚未完全收斂,momo-pro 頁面仍可用 `mo.wooo.work` 同源載入 loader 與 plugin。若日後要改回獨立 Webcrumbs CDN,直接設定:
|
||||
|
||||
```env
|
||||
WEBCRUMBS_RUNTIME_PATH=/@v0.1.5
|
||||
```
|
||||
|
||||
若部署路徑完全不同,直接設定:
|
||||
|
||||
```env
|
||||
WEBCRUMBS_RUNTIME_URL=https://webcrumbs.wooo.work/custom/runtime.js
|
||||
WEBCRUMBS_RUNTIME_URL=https://webcrumbs.wooo.work/shared-ui/loader/webcrumbs-compatible-loader.js
|
||||
WEBCRUMBS_PLUGIN_BASE_URL=https://webcrumbs.wooo.work/shared-ui/plugins
|
||||
```
|
||||
|
||||
## 頁面嵌入方式
|
||||
@@ -39,7 +41,7 @@ WEBCRUMBS_RUNTIME_URL=https://webcrumbs.wooo.work/custom/runtime.js
|
||||
全站 runtime 由 `templates/ewoooc_base.html` 載入。頁面只需要放 plugin tag:
|
||||
|
||||
```html
|
||||
<webcrumbs-plugin uri="https://webcrumbs.wooo.work/plugins/momo-pro/price-card/v2026.05.31/"></webcrumbs-plugin>
|
||||
<stock-platform-plugin uri="/webcrumbs-assets/plugins/finance.market-ticker-strip/0.1.0"></stock-platform-plugin>
|
||||
```
|
||||
|
||||
Plugin 目錄至少應提供:
|
||||
@@ -52,6 +54,7 @@ style.css
|
||||
## 治理規則
|
||||
|
||||
- Plugin URI 必須使用自架 domain。
|
||||
- 在 momo-pro 正式頁面,優先使用同源 `/webcrumbs-assets/` URI。
|
||||
- Plugin 目錄必須版本化,不使用浮動 `latest`。
|
||||
- Plugin 不得包含 secret、token、內部 API key。
|
||||
- Plugin 若需要正式資料,必須讀 momo-pro 既有 API,不得自行打 DB。
|
||||
@@ -60,5 +63,6 @@ style.css
|
||||
## 驗收
|
||||
|
||||
- `/webcrumbs` 顯示 runtime URL、版本與 plugin base。
|
||||
- `/webcrumbs-assets/loader/webcrumbs-compatible-loader.js` 回 200 且 content type 是 JavaScript。
|
||||
- `ewoooc_base.html` 在 `WEBCRUMBS_ENABLED=true` 且 runtime URL 有效時輸出 `<script data-webcrumbs-runtime=...>`。
|
||||
- 任一試點頁嵌入 plugin 後,瀏覽器 console 不應有 `MISSING_URI`、`STYLE_LOAD_ERROR`、`SCRIPT_LOAD_ERROR`。
|
||||
|
||||
Reference in New Issue
Block a user