galaxy-opc-plugin 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
  "id": "galaxy-opc-plugin",
3
3
  "name": "OPC Platform",
4
4
  "description": "星环OPC中心 — 一人公司孵化与赋能平台",
5
- "version": "0.2.4",
5
+ "version": "0.2.5",
6
6
  "skills": ["./skills"],
7
7
  "configSchema": {
8
8
  "type": "object",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "galaxy-opc-plugin",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "星环 Galaxy OPC — 一人公司孵化与赋能平台 OpenClaw 插件",
5
5
  "keywords": [
6
6
  "openclaw",
@@ -3127,15 +3127,28 @@ export function registerConfigUi(api: OpenClawPluginApi, db: OpcDatabase, gatewa
3127
3127
  // 注册 Dashboard API 路由
3128
3128
  registerDashboardApiRoutes(api, db);
3129
3129
 
3130
- api.registerHttpHandler(async (req, res) => {
3130
+ api.registerHttpHandler(async (req, res) => {
3131
3131
  const rawUrl = req.url ?? "";
3132
3132
  const urlObj = new URL(rawUrl, "http://localhost");
3133
3133
  const pathname = urlObj.pathname;
3134
3134
  const method = req.method?.toUpperCase() ?? "GET";
3135
3135
 
3136
- if (!pathname.startsWith("/opc/admin")) {
3137
- return false;
3138
- }
3136
+ if (!pathname.startsWith("/opc/admin")) {
3137
+ return false;
3138
+ }
3139
+
3140
+ // Normalize accidental SPA deep-links (e.g. /opc/admin/chat) back to OPC admin root.
3141
+ // Without this, users may land on OpenClaw's default chat UI and think OPC admin failed to load.
3142
+ if (
3143
+ !pathname.startsWith("/opc/admin/api/")
3144
+ && pathname !== "/opc/admin"
3145
+ && pathname !== "/opc/admin/"
3146
+ ) {
3147
+ const tokenParam = gatewayToken ? `?token=${encodeURIComponent(gatewayToken)}` : "";
3148
+ res.writeHead(302, { Location: `/opc/admin${tokenParam}` });
3149
+ res.end();
3150
+ return true;
3151
+ }
3139
3152
 
3140
3153
  // API 端点需要认证
3141
3154
  if (pathname.startsWith("/opc/admin/api/") && gatewayToken) {