@gloablehive/ipad-wechat-plugin 1.0.17 → 1.0.19
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 +17 -28
- package/index.ts +21 -29
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16,43 +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 /api/channels/ prefix like
|
|
21
|
+
// Using /api/channels/ prefix like nostr plugin
|
|
21
22
|
api.registerHttpRoute({
|
|
22
23
|
path: "/api/channels/ipad-wechat",
|
|
23
24
|
auth: "gateway",
|
|
24
25
|
match: "prefix",
|
|
25
26
|
handler: async (req, res) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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;
|
|
31
34
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const ready = getCacheManagerReady();
|
|
37
|
-
if (ready) {
|
|
38
|
-
await ready;
|
|
39
|
-
}
|
|
40
|
-
const payload = req.body;
|
|
41
|
-
console.log("[iPad WeChat] Received webhook:", payload);
|
|
42
|
-
if (payload) {
|
|
43
|
-
await handleInboundMessage(api, payload, cfg);
|
|
44
|
-
}
|
|
45
|
-
res.statusCode = 200;
|
|
46
|
-
res.end("ok");
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
console.error("[iPad WeChat] Webhook error:", error);
|
|
51
|
-
res.statusCode = 500;
|
|
52
|
-
res.end("Internal error");
|
|
53
|
-
return true;
|
|
35
|
+
const payload = req.body;
|
|
36
|
+
console.log("[iPad WeChat] Received webhook:", payload);
|
|
37
|
+
if (payload) {
|
|
38
|
+
await handleInboundMessage(api, payload, cfg);
|
|
54
39
|
}
|
|
40
|
+
res.statusCode = 200;
|
|
41
|
+
res.end("ok");
|
|
42
|
+
return true;
|
|
55
43
|
},
|
|
56
44
|
});
|
|
45
|
+
console.log("[iPad WeChat] Webhook route registered");
|
|
57
46
|
},
|
|
58
47
|
});
|
package/index.ts
CHANGED
|
@@ -19,47 +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 /api/channels/ prefix like
|
|
25
|
+
// Using /api/channels/ prefix like nostr plugin
|
|
24
26
|
api.registerHttpRoute({
|
|
25
27
|
path: "/api/channels/ipad-wechat",
|
|
26
28
|
auth: "gateway",
|
|
27
29
|
match: "prefix",
|
|
28
30
|
handler: async (req, res) => {
|
|
29
|
-
|
|
30
|
-
const path = (req as any).url || "";
|
|
31
|
-
if (!path.includes("/webhook")) {
|
|
32
|
-
// Not a webhook request, let it pass through
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
try {
|
|
37
|
-
// Get config from request
|
|
38
|
-
const cfg = (req as any).cfg;
|
|
31
|
+
console.log("[iPad WeChat] Handler called, url:", (req as any).url);
|
|
39
32
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (ready) {
|
|
43
|
-
await ready;
|
|
44
|
-
}
|
|
33
|
+
// Get config from request
|
|
34
|
+
const cfg = (req as any).cfg;
|
|
45
35
|
|
|
46
|
-
|
|
47
|
-
|
|
36
|
+
// Wait for cache manager to be ready
|
|
37
|
+
const ready = getCacheManagerReady();
|
|
38
|
+
if (ready) {
|
|
39
|
+
await ready;
|
|
40
|
+
}
|
|
48
41
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
42
|
+
const payload = (req as any).body;
|
|
43
|
+
console.log("[iPad WeChat] Received webhook:", payload);
|
|
52
44
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return true;
|
|
56
|
-
} catch (error) {
|
|
57
|
-
console.error("[iPad WeChat] Webhook error:", error);
|
|
58
|
-
res.statusCode = 500;
|
|
59
|
-
res.end("Internal error");
|
|
60
|
-
return true;
|
|
45
|
+
if (payload) {
|
|
46
|
+
await handleInboundMessage(api, payload, cfg);
|
|
61
47
|
}
|
|
48
|
+
|
|
49
|
+
res.statusCode = 200;
|
|
50
|
+
res.end("ok");
|
|
51
|
+
return true;
|
|
62
52
|
},
|
|
63
53
|
});
|
|
54
|
+
|
|
55
|
+
console.log("[iPad WeChat] Webhook route registered");
|
|
64
56
|
},
|
|
65
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.19",
|
|
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",
|