**ACLs (Access Control Lists):** - Ajout du type AclConfig dans sources/event.v (allowed_ips CIDR + allowed_tokens) - Chaque source webhook (Gitea, Uptime Kuma, Cron, Generic) supporte les ACLs - Validation IP via X-Forwarded-For / X-Real-IP avant HMAC - Validation Bearer token via Authorization header - Tests: 7 tests ACL (IP exact, CIDR, parse IPv4, ACL vide, IP+token combiné) **Plugin system:** - sources/plugin.v: runner exécutable externe, stdout JSON → Event - Exit 0 = publish, exit ≠ 0 = skip. Timeout configurable - Plugin loop dans server.v (goroutine, toutes les 60s) - Example: scripts/example-plugin-disk.sh (vérifie espace disque) **Docs:** - README.md: ajout source Plugin + section Features complète - ARCHITECTURE.md: flux Plugin, flux ACL, endpoints /metrics /api/silence - ROADMAP.md: Phase 5 → 8/8 complet, ajout v0.6.0 - ntfy-bridge.example.yaml: sections ACLs et Plugins commentées - Version bump: 0.5.0 → 0.6.0
This commit is contained in:
@@ -35,6 +35,13 @@ pub:
|
||||
clear bool // whether to dismiss notification after action
|
||||
}
|
||||
|
||||
// v0.6 — ACL per webhook path
|
||||
pub struct AclConfig {
|
||||
pub mut:
|
||||
allowed_ips []string @[json: 'allowed_ips'] // CIDR ranges or single IPs
|
||||
allowed_tokens []string @[json: 'allowed_tokens'] // bearer tokens
|
||||
}
|
||||
|
||||
pub struct GiteaSource {
|
||||
pub mut:
|
||||
name string @[json: 'name']
|
||||
@@ -44,6 +51,7 @@ pub mut:
|
||||
priority_map map[string]int @[json: 'priority_map']
|
||||
tags []string @[json: 'tags']
|
||||
repo string @[json: 'repo']
|
||||
acl AclConfig @[json: 'acl']
|
||||
}
|
||||
|
||||
pub struct UptimeKumaState {
|
||||
@@ -61,6 +69,7 @@ pub mut:
|
||||
priority_map map[string]int @[json: 'priority_map']
|
||||
tags []string @[json: 'tags']
|
||||
state_map map[string]UptimeKumaState @[json: 'state_map']
|
||||
acl AclConfig @[json: 'acl']
|
||||
}
|
||||
|
||||
pub struct DockerSource {
|
||||
@@ -99,6 +108,7 @@ pub mut:
|
||||
template string @[json: 'template']
|
||||
priority_map map[string]int @[json: 'priority_map']
|
||||
tags []string @[json: 'tags']
|
||||
acl AclConfig @[json: 'acl']
|
||||
}
|
||||
|
||||
pub struct GenericSource {
|
||||
@@ -109,6 +119,17 @@ pub mut:
|
||||
template string @[json: 'template']
|
||||
priority_map map[string]int @[json: 'priority_map']
|
||||
tags []string @[json: 'tags']
|
||||
acl AclConfig @[json: 'acl']
|
||||
}
|
||||
|
||||
// v0.6 — Plugin source: external executable that receives JSON on stdin, outputs JSON on stdout
|
||||
pub struct PluginSource {
|
||||
pub mut:
|
||||
name string @[json: 'name']
|
||||
topic string @[json: 'topic']
|
||||
command string @[json: 'command'] // path to executable
|
||||
timeout int @[json: 'timeout'] // seconds (default: 10)
|
||||
acl AclConfig @[json: 'acl']
|
||||
}
|
||||
|
||||
// render_source_template applies variable substitution to a template string.
|
||||
|
||||
Reference in New Issue
Block a user