sethyuan / logseq-plugin-reminder

System notification for Scheduled and Deadline.
MIT License
27 stars 1 forks source link

Feature Request: Allow triggering an external event, e.g. MQTT, OSC, Telegram Message, Shell Script #7

Closed acsr closed 1 year ago

acsr commented 1 year ago

I am aware that such a feature can result in security issues or flaws and needs to be double checked. If there is a OS Level permission barrier this should be respected. This would also add some more accessibilty to Logseq. Asking to give additional Permissions for assistive devices should be acceptable.

I am personally on macOS Mojave up and iOS.

sethyuan commented 1 year ago

Do you mean calling external applications on an alert popup? I don't think it's doable in a plugin, due to the sandbox nature of the plugins. A Logseq plugin cannot make system calls.

acsr commented 1 year ago

Actually a webhook or an OSC or MQTT call can do the trick. Needs a listening message broker, e.g. MQTT Server that calls something after the event. I use a OSC bridge and OSCTouch on the iPhone to trigger a shellscript on a remote receiver machine.

sethyuan commented 1 year ago

I'm not familiar with these 2 protocols, but if they can accept HTTP based services calls ( HTTP requests), then it should be doable, in theory.

acsr commented 1 year ago

Hi, to get an idea what I have in mind take a look at https://osculator.net/ and https://hexler.net/touchosc I am a Hardware Controller freak and like to control everything from everything but not just stupid homeautomation, but more relevant productivity tasks. Having bridges from some productivity tool (here Logseq) to and from other tools is very helpful. You can imagine how the logseq:: urls helped to have inter graph linking etc.

The same is when clicking opening an url like zotero://open-pdf/groups/3305/items/JPS5VDDV?page=1 in logseq Or starting a MileMaker Pro Script on a server If I can provide such a web hook to reminder, it can unleash a lot of possibilities directly from Logseqs Scheduled attribute

sethyuan commented 1 year ago

I can see the value in it, but I lack the knowledge necessary to work with these protocols, I don't know how to interact when them, and I don't think that I can spare time learning them neither.

However, I can try to implement webhooks for the notifications, maybe using a block property to tell the notification what HTTP request to make. E.g,

Do something
SCHEDULED: <2023-06-15 Thu 9:50>
webhook:: http://localhost:9000/sample-hook?q=something

When this notification happens, http://localhost:9000/sample-hook?q=something gets called automatically.

acsr commented 1 year ago

You are absolutely right. But to get the value I added some use cases. If possible a method post request would be nicer to avoid exposure of the payload in logs etc. But forgery of such requests opens a shitload of support questions. Therefore a shell system call is simpler and you can use curl etc. as well. But that is pandoras box.

Please take this as a long term goal. Until then just keep it in mind until you (or I) stumble over a solution how tackle that in logseq.

acsr commented 1 year ago

I did a short research and did not find anything existing related to webhooks and Logseq (except the git commit hooks) . Maybe I need to look for Electron and/or ask in the Discord.

sethyuan commented 1 year ago

The Hook feature is implemented, details here: https://github.com/sethyuan/logseq-plugin-reminder/blob/master/README.en.md

It requires to write code (or copy paste hook code that others provide).

acsr commented 1 year ago

Great, not tested yet. curious. THX