1{{ define "title" }}{{.Repo}} — webhooks{{ end }}
2{{ define "navextra" }}<a href="/{{.Repo}}">{{.Repo}}</a> <a href="/{{.Repo}}/log">log</a> <a href="/{{.Repo}}/tree">tree</a> <a href="/{{.Repo}}/issues">issues</a> <a href="/{{.Repo}}/stacks">stacks</a> <a href="/{{.Repo}}/wiki">wiki</a> <a href="/{{.Repo}}/settings">settings</a>{{ end }}
3{{ define "srv_repo_webhooks.html" }}{{ template "head" . }}
4<div class="container">
5 <h2 style="margin-bottom: 16px">{{.Repo}} / webhooks</h2>
6 {{ if .Error }}
7 <p class="error">{{.Error}}</p>
8 {{ end }} {{ if .Webhooks }}
9 <table style="margin-bottom: 24px">
10 <thead>
11 <tr>
12 <th>URL</th>
13 <th>Events</th>
14 <th>Active</th>
15 <th>Deliveries</th>
16 <th></th>
17 </tr>
18 </thead>
19 <tbody>
20 {{ range .Webhooks }}
21 <tr>
22 <td style="font-family: monospace;
23 font-size: 12px;
24 max-width: 300px;
25 overflow: hidden;
26 text-overflow: ellipsis">{{.URL}}</td>
27 <td style="font-size: 12px; color: #666">{{.Events}}</td>
28 <td>
29 {{ if .Active }}
30 <span class="badge badge-public">active</span>
31 {{ else }}
32 <span class="badge badge-private">inactive</span>
33 {{ end }}
34 </td>
35 <td>
36 <a href="/{{$.Repo}}/settings/webhooks/{{.ID}}/deliveries"
37 style="font-size: 12px">history</a>
38 </td>
39 <td>
40 <button onclick="deleteHook({{.ID}})"
41 style="background: #c0392b;
42 font-size: 12px;
43 padding: 2px 8px">Delete</button>
44 </td>
45 </tr>
46 {{ end }}
47 </tbody>
48 </table>
49{{ else }}
50 <p style="color: #888; margin-bottom: 24px">No webhooks configured.</p>
51 {{ end }}
52 <details>
53 <summary style="cursor: pointer; font-size: 13px; color: #555">Add webhook</summary>
54 <form method="post"
55 action="/{{.Repo}}/settings/webhooks"
56 style="margin-top: 12px">
57 <div class="field">
58 <label>Payload URL</label>
59 <input type="text"
60 name="url"
61 required
62 style="width: 400px"
63 placeholder="https://example.com/hooks/arche" />
64 </div>
65 <div class="field">
66 <label>Secret (optional, used for HMAC-SHA256 signature)</label>
67 <input type="password" name="secret" style="width: 280px" />
68 </div>
69 <div class="field">
70 <label>Events</label>
71 <input type="text" name="events" value="push" style="width: 200px" />
72 </div>
73 <button type="submit">Add webhook</button>
74 </form>
75 </details>
76</div>
77<script>
78function deleteHook(id) {
79 if (!confirm("Delete this webhook?")) return;
80 fetch("/{{.Repo}}/settings/webhooks/" + id, { method: "DELETE" }).then(
81 function(r) {
82 if (r.ok) {
83 location.reload();
84 } else {
85 r.text().then(alert);
86 }
87 },
88 );
89}
90</script>
91{{ template "foot" . }}
92{{ end }}