diff --git a/README.md b/README.md new file mode 100644 index 0000000..85f6067 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# NotificationToQuicker +转发手机通知到Quicker diff --git a/main.js b/main.js new file mode 100644 index 0000000..5348874 --- /dev/null +++ b/main.js @@ -0,0 +1,175 @@ +"ui"; +//auto(); +config = storages.create("quicker-notification"); +var email = config.get("email", ""); +var actionId = config.get("actionId", ""); +var code = config.get("code", ""); +var filterWords = config.get("filterWords", ["^.{2,3}输入法$", "^后台采集服务", "Bytes/s", "KiB/s"]); +//runObserve(email, actionId, code) +initUI(); +//loop(); + +function runObserve(email, actionId, code){ + events.observeNotification(); + events.onNotification(function (notification) { + var packageName = notification.getPackageName(); + var title = notification.getTitle(); + var text = notification.getText(); + if(!inBlackList(text, filterWords)){ + var data = "手机通知:" + [packageName, title, text].join("---"); + // if (notification.getText().match(/验证码|([^\d]|^)\d{6}(?!\d)/)) { + // log("检测到验证码,准备发送") + var json = { + "toUser": email, + "code": code, + "data": data, + "operation": "action", + "action": actionId + } + var r = http.postJson("https://push.getquicker.net/push", json, {}, function (response) { + log(response.body.json()); + var returnJson = response.body.json(); + if(returnJson.successCount === 0){ + toast(returnJson.errorMessage); + } + }); + // } + console.log(data); + } + }); +} + +function initUI(){ + ui.layout( + + + + + + + + + + +