-
Notifications
You must be signed in to change notification settings - Fork 35
/
debug.html.tmpl
233 lines (233 loc) · 12 KB
/
debug.html.tmpl
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
<!DOCTYPE html>
<!-- Request ID: <%= ctx.req.requestId %> -->
<html>
<head>
<title>Debug</title>
%= await ctx.faviconTag()
%= await ctx.scriptTag('mojo/bootstrap/bootstrap.bundle.min.js')
%= await ctx.scriptTag('mojo/highlight.js/highlight.pack.js')
%= await ctx.styleTag('mojo/bootstrap/bootstrap.min.css')
%= await ctx.styleTag('mojo/highlight.js/highlight-mojo-dark.css')
%= await ctx.styleTag('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css')
%= await ctx.styleTag('mojo/mojo.css')
<script>
hljs.initHighlightingOnLoad();
window.onload = function() {
const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
const tooltipList = tooltipTriggerList.map(tooltipTriggerEl => {
return new bootstrap.Tooltip(tooltipTriggerEl);
});
};
</script>
</head>
<body class="d-flex flex-column h-100">
<header>
<nav class="navbar navbar-expand-lg navbar-dark mojobar">
<div class="container-fluid">
<a href="https://mojojs.org" id="mojobar-brand" class="navbar-brand">
<picture>
<img src="<%= ctx.urlForFile('mojo/logo-white.png') %>"
srcset="<%= ctx.urlForFile('mojo/logo-white-2x.png') %> 2x">
</picture>
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarContent"
aria-controls="navbarContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="docDropdown" role="button"
data-bs-toggle="dropdown" aria-expanded="false">
Documentation
</a>
<div class="dropdown-menu" aria-labelledby="docDropdown">
<a class="dropdown-item" href="https://mojojs.org/docs/">Overview</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="https://mojojs.org/docs/Introduction.md">Introduction</a>
<a class="dropdown-item" href="https://mojojs.org/docs/Growing.md">Growing</a>
<a class="dropdown-item" href="https://mojojs.org/docs/Routing.md">Routing</a>
<a class="dropdown-item" href="https://mojojs.org/docs/Rendering.md">Rendering</a>
<a class="dropdown-item" href="https://mojojs.org/docs/User-Agent.md">User-Agent</a>
<a class="dropdown-item" href="https://mojojs.org/docs/Cookbook.md">Cookbook</a>
<a class="dropdown-item" href="https://mojojs.org/docs/Contributing.md">Contributing</a>
<a class="dropdown-item" href="https://mojojs.org/docs/FAQ.md">FAQ</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="https://mojojs.org/docs/Cheatsheet.md">Cheatsheet</a>
<a class="dropdown-item" href="https://mojojs.org/api" target="_blank">API</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="communityDropdown" role="button"
data-bs-toggle="dropdown" aria-expanded="false">
Community
</a>
<div class="dropdown-menu" aria-labelledby="communityDropdown">
<a class="dropdown-item" href="https://matrix.to/#/#mojo:matrix.org">Matrix</a>
<a class="dropdown-item" href="https://web.libera.chat/#mojo">IRC</a>
<a class="dropdown-item" href="https://github.com/mojolicious/mojo.js/discussions">Forum</a>
<a class="dropdown-item" href="https://fosstodon.org/@mojolicious">Mastodon</a>
<a class="dropdown-item" href="https://www.linkedin.com/groups/8963713/">LinkedIn</a>
<a class="dropdown-item" href="https://github.com/mojolicious/mojo.js/wiki">Wiki</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="https://github.com/mojolicious/mojo.js/">Contribute on GitHub</a>
</li>
</ul>
<form action="https://www.google.com/cse" target="_blank" class="form-inline my-2 my-lg-0">
<input type="hidden" name="cx" value="047dacf0d8b084ef8">
<input type="hidden" name="ie" value="URF-8">
<input type="search" name="q" placeholder="Search...">
</form>
</div>
</div>
</nav>
</header>
<div class="container flex-grow-1">
<div class="row flex-wrap">
<main class="col-sm-12 col-md-8 col-lg-10 py-md-3 pl-md-5">
<div class="row mojo-divider">
% if (exception !== null) {
<div class="alert alert-danger mojo-wide" role="alert">
<h2>Server Error</h2>
This application is in <b>development</b> mode and will show internal information to help you with
debugging.
</div>
<div id="showcase" class="mojo-box mojo-code mojo-no-bottom-border mojo-no-top-border mojo-border-radius-top">
<pre id="error" class="mojo-error"><%= exception %></pre>
% const context = await view.exceptionContext(exception);
% if (context !== null) {
<div>
<table class="mojo-wide">
% for (const line of context.source) {
% const extra = context.line === line.num ? ' mojo-important' : '';
<tr>
<td class="text-right<%= extra %>"><%= line.num %></td>
<td class="mojo-context mojo-wide<%= extra %>"><pre><code><%= line.code %></code></pre></td>
</tr>
% }
</table>
</div>
% }
</div>
<div id="trace" class="mojo-box mojo-no-padding more mojo-no-top-border mojo-border-radius-bottom">
<div id="frames" class="more">
<table class="mojo-striped-grey mojo-wide">
% const stack = exception.stack ?? '';
% const lines = stack.split('\n').filter(line => line.match(/^\s*at\ /));
% const trace = lines.map(val => val.replace(/^\s+/, ''));
% for (const frame of trace) {
<tr><td class="mojo-value"><pre><%= frame %></pre></td></tr>
% }
</table>
</div>
</div>
% } else {
<div class="alert alert-warning mojo-wide" role="alert">
<h2>Page Not Found</h2>
This application is in <b>development</b> mode and will show internal information to help you with
debugging.
</div>
<div id="routes" class="mojo-box mojo-no-padding mojo-border-radius-both">
<div class="mojo-padded-content">
<p>
None of these routes could generate a response for your <code><%= ctx.req.method %></code> request
for <code><%= ctx.req.path %></code>, maybe you need to add a new one?
</p>
</div>
<{walkBlock(route, depth)}>
% const pattern = route.pattern;
% let unparsed = pattern.unparsed || '/';
% if (depth > 0) unparsed = `+${unparsed}`;
% pattern.match('/', {isEndpoint: route.isEndpoint});
% const regex = pattern.regex.toString();
<tr data-bs-toggle="tooltip" data-bs-placement="left" data-bs-html="true"
title="<b>Regex:</b> <code><%= regex %></code>">
<td class="mojo-value">
<pre><%= ' '.repeat(depth * 2) %><%= unparsed %></pre>
</td>
<td class="mojo-value">
<pre><%= route.methods.join(', ').toUpperCase() || '*' %></pre>
</td>
<td class="mojo-value">
% if (route.customName !== undefined) {
<span class="badge bg-success"><%= route.customName %></span>
% } else if (route.defaultName !== undefined) {
<span class="badge bg-secondary"><%= route.defaultName %></span>
% }
</td>
</tr>
% depth++;
%== (await Promise.all(route.children.map(child => walkBlock(child, depth)))).join('')
% depth--;
<{/walkBlock}>
<table class="mojo-striped-light mojo-wide">
<thead>
<tr>
<th>Pattern</th>
<th>Methods</th>
<th>Name</th>
</tr>
</thead>
%== (await Promise.all(ctx.app.router.children.map(child => walkBlock(child, 0)))).join('')
</table>
</div>
% }
</div>
<div class="row mojo-divider">
<div id="request" class="mojo-box mojo-no-padding mojo-border-radius-both">
% const keyValue = function (key, value) {
<tr>
<td class="mojo-key text-right"><%= key %>:</td>
<td class="mojo-value"><pre><%= value %></pre></td>
</tr>
% };
<table class="mojo-striped mojo-fixed-table mojo-wide">
% keyValue('Request ID', ctx.req.requestId);
% keyValue('Method', ctx.req.method);
% keyValue('Path', ctx.req.path);
% keyValue('Base URL', ctx.req.baseURL);
% keyValue('Parameters', ctx.inspect((await ctx.params()).toObject()));
% keyValue('Stash', ctx.inspect(ctx.stash));
% const headers = ctx.req.headers.toArray();
% for (let i = 0; i < headers.length; i += 2) {
% keyValue(headers[i], headers[i + 1]);
% }
</table>
</div>
</div>
<div class="row">
% if (ctx.app.log.history.length > 0) {
% const log = ctx.app.log.history.map(view.stringFormatter).join('');
<pre class="mojo-terminal"><code class="nohighlight"><%= log %></code></pre>
% } else {
<div class="alert alert-warning mojo-wide" role="alert">
The application log appears to be empty, perhaps the log level <b><%= ctx.app.log.level %></b> is too
high? Try lowering it to <b>trace</b> for framework specific information.
</div>
% }
</div>
</main>
</div>
</div>
<footer>
<div class="container-fluid p-3 mojo-footer">
<div class="row">
<div class="col-sm align-self-center text-center mojo-free">
<b>Free</b> and <b>Open Source</b>.
</div>
<div class="col-sm align-self-center text-center mojo-copy">
<i class="far fa-copyright"></i> 2021-2023 Sebastian Riedel and the
<a href="https://github.com/mojolicious/mojo.js/AUTHORS">mojo.js contributors</a>.
</div>
<div class="col-sm align-self-center text-center mojo-social">
<a alt="GitHub" href="https://github.com/mojolicious/mojo.js"><i class="fab fa-github-alt"></i></a>
<a alt="Mastodon" href="https://fosstodon.org/@mojolicious"><i class="fab fa-mastodon"></i></a>
<a alt="LinkedIn" href="https://www.linkedin.com/groups/8963713/"><i class="fab fa-linkedin"></i></a>
</div>
</div>
</div>
</footer>
</body>
</html>