galaxy-opc-plugin 0.2.4 → 0.2.6
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.
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/src/web/config-ui.ts +17 -4
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
package/src/web/config-ui.ts
CHANGED
|
@@ -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) {
|