Initial pipelines server, CLI, TUI, and Go installation

This commit is contained in:
2026-10-08 22:22:17 +01:00
commit 0f30a001c2
143 changed files with 17557 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
package server
import (
"net/url"
"os"
"pipelines/internal/protocol"
"regexp"
"strings"
)
var notificationTopic = regexp.MustCompile(`^[-_A-Za-z0-9]{1,64}$`)
func publicNtfyBase(text string) string {
u, err := url.Parse(text)
if err != nil || u.Hostname() == "" || (u.Scheme != "http" && u.Scheme != "https") || u.User != nil || u.RawQuery != "" || u.Fragment != "" || (u.Path != "" && u.Path != "/") {
return ""
}
return strings.TrimRight(u.String(), "/")
}
func notificationEndpoints() []protocol.NotificationEndpoint {
u, err := url.Parse(os.Getenv("PIPELINES_NTFY_URL"))
if err != nil || u.Hostname() == "" || (u.Scheme != "http" && u.Scheme != "https") || u.User != nil || u.RawQuery != "" || u.Fragment != "" || u.RawPath != "" {
return nil
}
topic := strings.TrimPrefix(u.Path, "/")
if !notificationTopic.MatchString(topic) {
return nil
}
return []protocol.NotificationEndpoint{{Destination: "system", ServerURL: publicNtfyBase(os.Getenv("PIPELINES_NTFY_PUBLIC_URL")), Topic: topic}}
}