王一之 发表于 2025-12-8 09:28:24

july25 发表于 2025-12-7 16:28
https://scriptcat.org/zh-CN/script-show-page/1101哥哥,这个接入的PushCat不止微信可用,还有什么,感 ...

在接收设备,你可以看到

王一之 发表于 2025-12-8 09:29:47

liuyz 发表于 2025-12-7 14:22
哥哥,直接使用https://scriptcat.org/zh-CN/script-show-page/946的示例脚本,仅更换key,后台脚本打 ...

是要用这个脚本,脚本猫的后台脚本:

```js
// ==UserScript==
// @name         PushCat浏览器端
// @namespace    https://bbs.tampermonkey.net.cn/
// @version      0.1.0
// @descriptionPushCat浏览器端,可作为接收设备通知,也可以作为发送端推送消息至其它设备
// @author       王一之
// @background
// @connect      sct.icodef.com
// @grant GM_notification
// @grant GM_xmlhttpRequest
// @require https://scriptcat.org/lib/946/%5E1.0.1/PushCat.js
// ==/UserScript==

const device = new PushCatDevice({
    name: "浏览器",
    accessKey: "jz5ud0hda4ahy9qp",
});

device.onError(data => {
    GM_notification({
      title: "设备注册失败",
      text: data.msg,
    })
});

device.onMessage(messages => {
    messages.forEach(msg => {
      GM_notification({
            title: msg.title,
            text: msg.content
      })
    });
});

// const push = new PushCat({
//   accessKey: "jz5ud0hda4ahy9qp",
// });

// push.send("title", "content");
```

july25 发表于 2025-12-9 16:07:14

王一之 发表于 2025-12-8 09:28
在接收设备,你可以看到

看到了,谢谢哥哥{:4_108:}
页: 1 [2]
查看完整版本: PushCat调用库