fix(notify): open configured web run pages from ntfy

This commit is contained in:
2026-10-21 13:05:10 +01:00
parent 870c70aefa
commit 9ee2e003bf
12 changed files with 201 additions and 14 deletions
+25
View File
@@ -0,0 +1,25 @@
package server
import "testing"
func TestRunNotificationWebClick(t *testing.T) {
for _, tc := range []struct{ base, want string }{
{"https://pipelines.example.com", "https://pipelines.example.com/runs/20"},
{"http://10.0.0.75:8095/", "http://10.0.0.75:8095/runs/20"},
{"", "pipelines://run/20"}, // Existing Android-only installations.
{"javascript:alert(1)", ""},
{"https://user:password@example.com", ""},
{"https://example.com?token=secret", ""},
{"https://example.com/#fragment", ""},
{"https://example.com/subpath", ""}, // Web app uses origin-root routes.
{"/runs", ""},
{"https://example.com\r\nClick:bad", ""},
} {
t.Run(tc.base, func(t *testing.T) {
t.Setenv("PIPELINES_WEB_PUBLIC_URL", tc.base)
if got := runAttentionClick(20); got != tc.want {
t.Fatalf("click = %q, want %q", got, tc.want)
}
})
}
}