@gloablehive/ipad-wechat-plugin 1.0.18 → 1.0.20
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/dist/index.js +20 -25
- package/index.ts +28 -30
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16,37 +16,32 @@ export default defineChannelPluginEntry({
|
|
|
16
16
|
description: "Connect OpenClaw to iPad WeChat protocol for sending and receiving WeChat messages",
|
|
17
17
|
plugin: ipadWeChatPlugin,
|
|
18
18
|
registerFull(api) {
|
|
19
|
+
console.log("[iPad WeChat] registerFull called, registering webhook route");
|
|
19
20
|
// Register webhook endpoint for receiving messages
|
|
20
|
-
// Using
|
|
21
|
+
// Using plugin auth - gateway allows requests through and lets plugin handle auth
|
|
21
22
|
api.registerHttpRoute({
|
|
22
|
-
path: "/api/channels/ipad-wechat
|
|
23
|
-
auth: "
|
|
23
|
+
path: "/api/channels/ipad-wechat",
|
|
24
|
+
auth: "plugin",
|
|
25
|
+
match: "prefix",
|
|
24
26
|
handler: async (req, res) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
await ready;
|
|
33
|
-
}
|
|
34
|
-
const payload = req.body;
|
|
35
|
-
console.log("[iPad WeChat] Received webhook:", payload);
|
|
36
|
-
if (payload) {
|
|
37
|
-
await handleInboundMessage(api, payload, cfg);
|
|
38
|
-
}
|
|
39
|
-
res.statusCode = 200;
|
|
40
|
-
res.end("ok");
|
|
41
|
-
return true;
|
|
27
|
+
console.log("[iPad WeChat] Handler called, url:", req.url);
|
|
28
|
+
// Get config from request
|
|
29
|
+
const cfg = req.cfg;
|
|
30
|
+
// Wait for cache manager to be ready
|
|
31
|
+
const ready = getCacheManagerReady();
|
|
32
|
+
if (ready) {
|
|
33
|
+
await ready;
|
|
42
34
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return true;
|
|
35
|
+
const payload = req.body;
|
|
36
|
+
console.log("[iPad WeChat] Received webhook:", payload);
|
|
37
|
+
if (payload) {
|
|
38
|
+
await handleInboundMessage(api, payload, cfg);
|
|
48
39
|
}
|
|
40
|
+
res.statusCode = 200;
|
|
41
|
+
res.end("ok");
|
|
42
|
+
return true;
|
|
49
43
|
},
|
|
50
44
|
});
|
|
45
|
+
console.log("[iPad WeChat] Webhook route registered");
|
|
51
46
|
},
|
|
52
47
|
});
|
package/index.ts
CHANGED
|
@@ -19,41 +19,39 @@ export default defineChannelPluginEntry({
|
|
|
19
19
|
plugin: ipadWeChatPlugin,
|
|
20
20
|
|
|
21
21
|
registerFull(api) {
|
|
22
|
+
console.log("[iPad WeChat] registerFull called, registering webhook route");
|
|
23
|
+
|
|
22
24
|
// Register webhook endpoint for receiving messages
|
|
23
|
-
// Using
|
|
25
|
+
// Using plugin auth - gateway allows requests through and lets plugin handle auth
|
|
24
26
|
api.registerHttpRoute({
|
|
25
|
-
path: "/api/channels/ipad-wechat
|
|
26
|
-
auth: "
|
|
27
|
+
path: "/api/channels/ipad-wechat",
|
|
28
|
+
auth: "plugin",
|
|
29
|
+
match: "prefix",
|
|
27
30
|
handler: async (req, res) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
await handleInboundMessage(api, payload, cfg);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
res.statusCode = 200;
|
|
48
|
-
res.end("ok");
|
|
49
|
-
return true;
|
|
50
|
-
} catch (error) {
|
|
51
|
-
console.error("[iPad WeChat] Webhook error:", error);
|
|
52
|
-
res.statusCode = 500;
|
|
53
|
-
res.end("Internal error");
|
|
54
|
-
return true;
|
|
31
|
+
console.log("[iPad WeChat] Handler called, url:", (req as any).url);
|
|
32
|
+
|
|
33
|
+
// Get config from request
|
|
34
|
+
const cfg = (req as any).cfg;
|
|
35
|
+
|
|
36
|
+
// Wait for cache manager to be ready
|
|
37
|
+
const ready = getCacheManagerReady();
|
|
38
|
+
if (ready) {
|
|
39
|
+
await ready;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const payload = (req as any).body;
|
|
43
|
+
console.log("[iPad WeChat] Received webhook:", payload);
|
|
44
|
+
|
|
45
|
+
if (payload) {
|
|
46
|
+
await handleInboundMessage(api, payload, cfg);
|
|
55
47
|
}
|
|
48
|
+
|
|
49
|
+
res.statusCode = 200;
|
|
50
|
+
res.end("ok");
|
|
51
|
+
return true;
|
|
56
52
|
},
|
|
57
53
|
});
|
|
54
|
+
|
|
55
|
+
console.log("[iPad WeChat] Webhook route registered");
|
|
58
56
|
},
|
|
59
57
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gloablehive/ipad-wechat-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.20",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenClaw channel plugin for iPad WeChat protocol - enables sending/receiving WeChat messages through iPad protocol",
|
|
6
6
|
"main": "index.ts",
|