-
Notifications
You must be signed in to change notification settings - Fork 5
/
edit.html.twig.go
267 lines (248 loc) · 8.33 KB
/
edit.html.twig.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
// Code generated by stickgen.
// DO NOT EDIT!
package webhook
import (
"fmt"
"io"
"github.com/tyler-sommer/stick"
)
func blockWebhookEditHtmlTwigAdditionalJavascripts(env *stick.Env, output io.Writer, ctx map[string]stick.Value) {
// line 47, offset 34 in webhook/edit.html.twig
fmt.Fprint(output, `
<script type="text/javascript">
$(function() {
const $keyInput = $(document.getElementById('webhook_key'));
const $keyContainer = $(document.getElementById('webhook_key_container'));
const $copyKey = $(document.getElementById('webhook_key_copy'));
const originalCopyKeyContents = $copyKey.html();
$keyContainer.on('click', function(e) {
e.preventDefault();
$keyInput.select();
document.execCommand('copy');
$copyKey.html('Copied');
$keyContainer.once('mouseover', function() {
$copyKey.html(originalCopyKeyContents)
})
});
});
</script>
`)
}
func blockWebhookEditHtmlTwigContent(env *stick.Env, output io.Writer, ctx map[string]stick.Value) {
// line 3, offset 19 in webhook/edit.html.twig
fmt.Fprint(output, `
<div class="row">
<div class="col-sm-6">
<h4>Modify Webhook</h4>
</div>
<div class="col-sm-6">
<a class="btn btn-default btn-sm pull-right" href="https://squircy.com/webhooks.html" target="_blank">Documentation <i class="fa fa-external-link"></i></a>
</div>
</div>
<form method="post" action="/webhook/`)
// line 12, offset 37 in webhook/edit.html.twig
{
val, err := stick.GetAttr(ctx["webhook"], "ID")
if err == nil {
fmt.Fprint(output, val)
}
}
// line 12, offset 53 in webhook/edit.html.twig
fmt.Fprint(output, `/update">
<div class="row">
<div class="col-md-7">
<div class="row">
<div class="col-md-5 form-group">
<label for="hook-title">Title</label>
<input class="form-control" id="hook-title" name="title" required placeholder="A Descriptive Title" value="`)
// line 18, offset 111 in webhook/edit.html.twig
{
val, err := stick.GetAttr(ctx["webhook"], "Title")
if err == nil {
fmt.Fprint(output, val)
}
}
// line 18, offset 130 in webhook/edit.html.twig
fmt.Fprint(output, `">
</div>
<div class="col-md-4 form-group">
<label for="signature">Signature Header</label>
<input class="form-control" id="signature" name="signature" required placeholder="Header name containing payload signature" value="`)
// line 22, offset 135 in webhook/edit.html.twig
{
val, err := stick.GetAttr(ctx["webhook"], "SignatureHeader")
if err == nil {
fmt.Fprint(output, val)
}
}
// line 22, offset 164 in webhook/edit.html.twig
fmt.Fprint(output, `">
</div>
</div>
<div class="row" id="webhook_key_container">
<div class="col-md-8 form-group">
<label class="control-label" for="webhook_key">Key</label>
<div class="input-group">
<input class="form-control" id="webhook_key" name="key" readonly aria-readonly="true" placeholder="Header name containing payload signature" value="`)
// line 29, offset 153 in webhook/edit.html.twig
{
val, err := stick.GetAttr(ctx["webhook"], "Key")
if err == nil {
fmt.Fprint(output, val)
}
}
// line 29, offset 170 in webhook/edit.html.twig
fmt.Fprint(output, `">
<a class="input-group-addon" href="javascript:;" id="webhook_key_copy"><i class="fa fa-copy"></i> Copy</a>
</div>
</div>
</div>
<div class="row">
<div class="col-md-5">
<button class="form-control btn btn-primary">Save Changes</button>
</div>
</div>
</div>
<div class="col-md-5">
`)
// line 1, offset 0 in webhook/_more_info.html.twig
fmt.Fprint(output, `<div class="panel panel-primary">
<div class="panel-heading"><i class="fa fa-question-circle"></i> More Info</div>
<div class="panel-body">
<p>Each incoming webhook request must contain a valid signature in the signature header defined here.</p>
<p>A key will be automatically generated when the webhook is created, and the key is used to derive a signature unique to the payload body.</p>
<p>A <a href="https://squircy.com/webhooks.html" target="_blank">reference Webhook sender implementation</a> is available on the squIRCy website.</p>
</div>
</div>`)
// line 41, offset 46 in webhook/edit.html.twig
fmt.Fprint(output, `
</div>
</div>
</form>
`)
}
func TemplateWebhookEditHtmlTwig(env *stick.Env, output io.Writer, ctx map[string]stick.Value) {
// line 1, offset 0 in layout.html.twig
fmt.Fprint(output, `<!DOCTYPE html>
<html>
<head>
<title>squIRCy</title>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js"></script>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootswatch/3.4.0/cyborg/bootstrap.min.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="/css/style.css">
</head>
<body>
<div id="main-container" class="container">
<div class="row">
<div class="col-md-12">
`)
// line 17, offset 6 in layout.html.twig
blockWebhookEditHtmlTwigContent(env, output, ctx)
// line 18, offset 17 in layout.html.twig
fmt.Fprint(output, `
</div>
</div>
</div>
<nav id="main-nav" class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="https://squircy.com" target="_blank">squIRCy</a>
</div>
<ul class="nav navbar-nav">
<li><a href="/">Dashboard</a></li>
<li><a href="/script">Scripts</a></li>
<li><a href="/webhook">Webhooks</a></li>
<li><a href="/manage">Settings</a></li>
<li class="divider"> </li>
<li><a href="/repl">REPL</a></li>
</ul>
<ul class="nav navbar-nav pull-right">
<li><a id="reinit" title="Re-initialize scripts" href="/script/reinit"><i class="fa fa-refresh"></i></a></li>
<li><a class="post-action" id="connect-button" style="display: none" href="/connect"><i class="fa fa-power-off"></i> Connect</a></li>
<li><a class="post-action" id="disconnect-button" style="display: none" href="/disconnect"><i class="fa fa-power-off"></i> Disconnect</a></li>
<li><a class="post-action" id="connecting-button" style="display: none" href="/disconnect"><i class="fa fa-power-off"></i> Connecting...</a></li>
</ul>
</div>
</nav>
`)
// line 1, offset 0 in _page_javascripts.html.twig
fmt.Fprint(output, `<script type="text/javascript">
$(function() {
var es = window.squIRCyEvents = new EventSource('/event');
var $connectBtn = $('#connect-button');
var $disconnectBtn = $('#disconnect-button');
var $connectingBtn = $('#connecting-button');
es.addEventListener("irc.CONNECTING", function() {
$connectingBtn.show();
$disconnectBtn.add($connectBtn).hide();
});
es.addEventListener("irc.CONNECT", function() {
$disconnectBtn.show();
$connectBtn.add($connectingBtn).hide();
});
es.addEventListener("irc.DISCONNECT", function() {
$connectBtn.show();
$disconnectBtn.add($connectingBtn).hide();
});
var $postLinks = $('.post-action');
$postLinks.on('click', function(e) {
e.preventDefault();
var url = $(this).attr('href');
$.ajax({
url: url,
type: 'post'
});
});
var $reinit = $('#reinit').tooltip({
placement: 'bottom',
container: 'body'
});
$reinit.on('click', function(e) {
e.preventDefault();
if (confirm('Are you sure you want to reinitialize all scripts?')) {
var url = $(this).attr('href');
$.ajax({
url: url,
type: 'post'
})
}
});
$.ajax({
url: '/status',
type: 'get',
dataType: 'json',
success: function(response) {
if (response.Status == 2) {
$disconnectBtn.show();
$connectBtn.add($connectingBtn).hide();
} else if (response.Status == 1) {
$connectingBtn.show();
$disconnectBtn.add($connectBtn).hide();
} else {
$connectBtn.show();
$disconnectBtn.add($connectingBtn).hide();
}
}
});
});
</script>`)
// line 45, offset 47 in layout.html.twig
fmt.Fprint(output, `
`)
// line 46, offset 7 in layout.html.twig
blockWebhookEditHtmlTwigAdditionalJavascripts(env, output, ctx)
// line 47, offset 18 in layout.html.twig
fmt.Fprint(output, `
</body>
</html>
`)
// line 1, offset 32 in webhook/edit.html.twig
fmt.Fprint(output, `
`)
// line 45, offset 14 in webhook/edit.html.twig
fmt.Fprint(output, `
`)
}