feat(plugins): add joplin-api and send-sms under repo-root plugins/

Load user plugins from /plugins instead of data/plugins so site-specific scripts stay in git and workflows can reference plugin/joplin-api and plugin/send-sms.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-20 06:34:33 +07:00
co-authored by Cursor
parent 611511ae60
commit bd0c11c20c
13 changed files with 553 additions and 5 deletions
+3 -2
View File
@@ -5,9 +5,10 @@ export const SERVER_ROOT = path.dirname(fileURLToPath(import.meta.url));
export const SCRIPTS_DIR = path.join(SERVER_ROOT, "scripts");
export const WORKFLOWS_DIR = path.join(SERVER_ROOT, "workflows");
export const DATA_DIR = path.join(SERVER_ROOT, "data");
/** Installed user plugins (outside the pnpm workspace). */
/** User plugins (repo-root /plugins, outside the pnpm workspace). */
export const PLUGINS_DIR =
process.env.JFLOW_PLUGINS_DIR ?? path.join(DATA_DIR, "plugins");
process.env.JFLOW_PLUGINS_DIR ??
path.resolve(SERVER_ROOT, "../../plugins");
/** Example plugin sources shipped with the repo. */
export const EXAMPLE_PLUGINS_DIR = path.resolve(
SERVER_ROOT,
@@ -0,0 +1,29 @@
name: Joplin nightly daily log
description: |
POST joplin-auto /api/logs/run at 04:00 (sync + yearly/monthly/today), then ntfy.
Secret joplin_setup_token (SETUP_API_TOKEN). Variable ntfy_channel.
scripts:
- script: plugin/joplin-api
config:
url: http://10.8.0.6:3040/api/logs/run
method: POST
token: $SECRET_joplin_setup_token
timeoutMs: 600000
- set:
expression: |
{
"title": data.ok ? "Bullet journal" : "Bullet journal failed",
"message": data.ok
? "The bullet journal for " & data.httpResponse.date & " has been created."
: data.message
}
- script: ntfy.js
config:
url: $VAR_ntfy_channel
triggers:
- type: cron
schedule: "0 4 * * *"
- type: HTTP
method: POST
path: /dev-joplin-daily
enabled: false
@@ -0,0 +1,17 @@
name: Joplin get note
description: |
GET a Joplin note by id from joplin-api. Input (data): id (32-char hex).
Secret joplin_api_token (JOPLIN_API_TOKEN / API_KEYS). Returns the full note.
scripts:
- script: plugin/joplin-api
config:
url: http://10.8.0.6:3030/notes
method: GET
token: $SECRET_joplin_api_token
timeoutMs: 60000
triggers:
- type: workflow
- type: HTTP
method: POST
path: /dev-joplin-get-note
enabled: false
@@ -0,0 +1,27 @@
name: Joplin nightly sync
description: |
POST joplin-auto /api/sync at 03:00, then ntfy success or failure.
Secret joplin_setup_token (SETUP_API_TOKEN). Variable ntfy_channel.
scripts:
- script: plugin/joplin-api
config:
url: http://10.8.0.6:3040/api/sync
method: POST
token: $SECRET_joplin_setup_token
timeoutMs: 600000
- set:
expression: |
{
"title": data.ok ? "Joplin sync ok" : "Joplin sync failed",
"message": data.message
}
- script: ntfy.js
config:
url: $VAR_ntfy_channel
triggers:
- type: cron
schedule: "0 3 * * *"
- type: HTTP
method: POST
path: /dev-joplin-sync
enabled: false
@@ -0,0 +1,16 @@
name: dev-zte-sms
description: |
Send an SMS via a ZTE modem web UI.
Input (data): to, message
Password is the named secret zte_modem_password ($SECRET_).
scripts:
- script: plugin/send-sms
config:
url: http://192.168.5.1/reqproc/proc_post
password: $SECRET_sms_secret
triggers:
- type: workflow
- type: HTTP
method: POST
path: /dev-zte-sms
auth: basic-auth