@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.
Files changed (3) hide show
  1. package/dist/index.js +17 -28
  2. package/index.ts +21 -29
  3. 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 other plugins
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
- // Check if it's a webhook request
27
- const path = req.url || "";
28
- if (!path.includes("/webhook")) {
29
- // Not a webhook request, let it pass through
30
- return false;
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
- try {
33
- // Get config from request
34
- const cfg = req.cfg;
35
- // Wait for cache manager to be ready
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 other plugins
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
- // Check if it's a webhook request
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
- // Wait for cache manager to be ready
41
- const ready = getCacheManagerReady();
42
- if (ready) {
43
- await ready;
44
- }
33
+ // Get config from request
34
+ const cfg = (req as any).cfg;
45
35
 
46
- const payload = (req as any).body;
47
- console.log("[iPad WeChat] Received webhook:", payload);
36
+ // Wait for cache manager to be ready
37
+ const ready = getCacheManagerReady();
38
+ if (ready) {
39
+ await ready;
40
+ }
48
41
 
49
- if (payload) {
50
- await handleInboundMessage(api, payload, cfg);
51
- }
42
+ const payload = (req as any).body;
43
+ console.log("[iPad WeChat] Received webhook:", payload);
52
44
 
53
- res.statusCode = 200;
54
- res.end("ok");
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.17",
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",