| 1 | {{ define "page" -}} |
| 2 | <div class="shithub-settings-page"> |
| 3 | {{ template "repo-settings-nav" . }} |
| 4 | <div class="shithub-settings-content"> |
| 5 | <h1>Webhooks</h1> |
| 6 | {{ with .Notice }}<p class="shithub-flash shithub-flash-notice" role="status">{{ . }}</p>{{ end }} |
| 7 | |
| 8 | <section class="shithub-settings-section"> |
| 9 | <p class="shithub-hint"> |
| 10 | Webhooks fire HTTP POSTs to subscriber URLs when events occur in this repo. |
| 11 | Each delivery carries an <code>X-Shithub-Signature-256</code> header for |
| 12 | receiver-side verification. |
| 13 | </p> |
| 14 | <p> |
| 15 | <a href="/{{ .Owner }}/{{ .Repo.Name }}/settings/webhooks/new" class="shithub-button shithub-button-primary">Add webhook</a> |
| 16 | </p> |
| 17 | |
| 18 | {{ if .Webhooks }} |
| 19 | <table class="shithub-branches-table"> |
| 20 | <thead> |
| 21 | <tr><th>URL</th><th>Events</th><th>State</th><th>Last activity</th></tr> |
| 22 | </thead> |
| 23 | <tbody> |
| 24 | {{ range .Webhooks }} |
| 25 | <tr> |
| 26 | <td><a href="/{{ $.Owner }}/{{ $.Repo.Name }}/settings/webhooks/{{ .ID }}"><code>{{ .Url }}</code></a></td> |
| 27 | <td>{{ if .Events }}{{ range $i, $e := .Events }}{{ if $i }}, {{ end }}<code>{{ $e }}</code>{{ end }}{{ else }}<span class="shithub-fg-muted">all</span>{{ end }}</td> |
| 28 | <td> |
| 29 | {{ if .DisabledAt.Valid }}<span class="shithub-fg-muted">auto-disabled</span> |
| 30 | {{ else if .Active }}<span>active</span> |
| 31 | {{ else }}<span class="shithub-fg-muted">inactive</span>{{ end }} |
| 32 | {{ if gt .ConsecutiveFailures 0 }}<span class="shithub-fg-muted"> · {{ .ConsecutiveFailures }} consecutive failures</span>{{ end }} |
| 33 | </td> |
| 34 | <td> |
| 35 | {{ if .LastSuccessAt.Valid }}✓ {{ relativeTime .LastSuccessAt.Time }} |
| 36 | {{ else if .LastFailureAt.Valid }}✗ {{ relativeTime .LastFailureAt.Time }} |
| 37 | {{ else }}<span class="shithub-fg-muted">no deliveries yet</span>{{ end }} |
| 38 | </td> |
| 39 | </tr> |
| 40 | {{ end }} |
| 41 | </tbody> |
| 42 | </table> |
| 43 | {{ else }} |
| 44 | <p class="shithub-empty-note">No webhooks configured.</p> |
| 45 | {{ end }} |
| 46 | </section> |
| 47 | </div> |
| 48 | </div> |
| 49 | {{- end }} |