@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.
Files changed (3) hide show
  1. package/dist/index.js +20 -25
  2. package/index.ts +28 -30
  3. 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 /api/channels/ prefix like other plugins
21
+ // Using plugin auth - gateway allows requests through and lets plugin handle auth
21
22
  api.registerHttpRoute({
22
- path: "/api/channels/ipad-wechat/webhook",
23
- auth: "gateway",
23
+ path: "/api/channels/ipad-wechat",
24
+ auth: "plugin",
25
+ match: "prefix",
24
26
  handler: async (req, res) => {
25
- try {
26
- console.log("[iPad WeChat] Webhook handler called, url:", req.url);
27
- // Get config from request
28
- const cfg = req.cfg;
29
- // Wait for cache manager to be ready
30
- const ready = getCacheManagerReady();
31
- if (ready) {
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
- catch (error) {
44
- console.error("[iPad WeChat] Webhook error:", error);
45
- res.statusCode = 500;
46
- res.end("Internal error");
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 /api/channels/ prefix like other plugins
25
+ // Using plugin auth - gateway allows requests through and lets plugin handle auth
24
26
  api.registerHttpRoute({
25
- path: "/api/channels/ipad-wechat/webhook",
26
- auth: "gateway",
27
+ path: "/api/channels/ipad-wechat",
28
+ auth: "plugin",
29
+ match: "prefix",
27
30
  handler: async (req, res) => {
28
- try {
29
- console.log("[iPad WeChat] Webhook handler called, url:", (req as any).url);
30
-
31
- // Get config from request
32
- const cfg = (req as any).cfg;
33
-
34
- // Wait for cache manager to be ready
35
- const ready = getCacheManagerReady();
36
- if (ready) {
37
- await ready;
38
- }
39
-
40
- const payload = (req as any).body;
41
- console.log("[iPad WeChat] Received webhook:", payload);
42
-
43
- if (payload) {
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.18",
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",