Commit Graph
21 Commits
Author SHA1 Message Date
Akizon 10d9463c06 移除/优化部分测试,允许空的ping任务 2026-11-06 15:38:06 +08:00
Akizon77 9e5f9a3a71 让插件支持监听ws 2026-10-24 16:41:01 +08:00
Akizon d50cc0a9fd JS运行时换成moejs 2026-10-22 13:20:51 +08:00
Akizon b38b0b2347 让opus5.5 简化、优化1下代码 2026-10-19 11:19:34 +08:00
Akizon d15f0512c7 重写1下通知 2026-09-20 14:01:47 +08:00
MousseC 44ed3035f1 chore(plugin): shorten isUpgradeRequest doc comment 2026-09-08 20:34:23 +08:00
MousseC 7ec36157d5 test(plugin): cover upgrade detection and injection behind bare Connection header 2026-09-08 18:41:58 +08:00
MousseC 360fd5f50b fix(plugin): detect protocol upgrades only when both headers are present
isUpgradeRequest previously flagged any request carrying a bare
`Connection: upgrade` header -- or a bare `Upgrade: websocket` header --
as a protocol upgrade, bypassing plugin HTML injection and
request/response hooks. Some reverse-proxy templates (e.g. sites created
by 1Panel) set `proxy_set_header Connection upgrade;` unconditionally, so
every proxied page request skipped the plugin middleware silently while
plugins still reported as loaded.

Per RFC 9110 section 7.8 a valid upgrade request carries both headers:
Connection lists the upgrade token and Upgrade names the target protocol.
Require the Upgrade header to be present and the Connection list to
contain the upgrade token, and accept any upgrade protocol rather than
only websocket.
2026-09-08 18:41:55 +08:00
Akizon77 2ff7c11db0 refactor: remove v1 protocol and stabilize file transfer 2026-08-29 19:03:53 +08:00
Akizon77 4caa067556 feat(plugin): reload plugin after config update 2026-08-13 14:28:32 +08:00
Akizon77 63a7ffddcf fix(plugin): normalize RPC results before resolving promises
RPC results were passed directly to goja's resolve, which could fail for
non-JSON-compatible Go types. Add normalizeRPCValue to round-trip the
result through JSON, ensuring it becomes plain data structures. Handle
serialization errors properly by rejecting the promise.
2026-08-13 13:05:12 +08:00
Akizon77 c294c17642 feat: add managed configuration selectors 2026-08-12 16:46:05 +08:00
Akizon77 e5d67686db feat(plugin): add WebSocket hook support to server.hook
Implement wsConnect, wsMessage, wsSend, and wsClose hook kinds so plugins
can intercept WebSocket connections and frames. Refactor the hook matcher
to match paths independently of HTTP requests and add runHookTurnTimeout
so WebSocket hook turns that exceed the runtime timeout can fall back to
passing the message through without blocking the caller.
2026-08-05 15:44:08 +08:00
Akizon77 5488189e5f feat(plugin): add server.cron scheduled task support 2026-08-02 13:27:34 +08:00
Akizon77 d9713aa696 fix: hook 过滤 + 按插件 body 上限 2026-08-02 13:14:15 +08:00
Akizon77 eab03a1da5 feat(plugin): add server.static for serving plugin static folders 2026-08-02 13:04:16 +08:00
Akizon77 1f139ba3bf feat: add HTML injection permission and support for plugins 2026-08-02 12:09:16 +08:00
Akizon77 01c4816d1c feat(plugin): add persistent storage dir for plugins
Add StorageDir (data/plugin-data/<short>) exposed to plugin runtimes as
__storageDir__, giving plugins a location for long-term data that
survives plugin updates. The existing DataDir/<short> remains the
install/code directory and is replaced on update, while storage is
preserved and only removed when the plugin is deleted.

Update filesystem path handling to support plugin storage roots, reset
StorageDir in tests, and drop the unused golang.org/x/image dependency.
2026-08-02 00:43:59 +08:00
Akizon77 c27c21d5c9 fix(plugin): limit response hook buffering and safely reinstall 2026-08-01 22:40:53 +08:00
Akizon77 68bf4ed148 feat(plugin): enforce server module permission gates
Update plugin permissions to separate admin-approved capabilities from
runtime settings. Add AllowSystemRPC, AllowRoutes, and AllowHooks to
control server.call, server.route, and server.hook respectively.
Registering RPC methods, reading own config, and accessing plugin-local
files remain always allowed, so plugins without dangerous permissions
can be enabled without approval.

Add tests covering server module enforcement and default-granted
capabilities.
2026-08-01 17:47:47 +08:00
Akizon77 8985adcf67 feat: add plugin system and refactor jsruntime deadline handling 2026-08-01 15:24:50 +08:00