Blame


1 a80e4b65 2022-09-19 op {!
2 a80e4b65 2022-09-19 op /*
3 a80e4b65 2022-09-19 op * Copyright (c) 2022 Omar Polo <op@omarpolo.com>
4 a80e4b65 2022-09-19 op *
5 a80e4b65 2022-09-19 op * Permission to use, copy, modify, and distribute this software for any
6 a80e4b65 2022-09-19 op * purpose with or without fee is hereby granted, provided that the above
7 a80e4b65 2022-09-19 op * copyright notice and this permission notice appear in all copies.
8 a80e4b65 2022-09-19 op *
9 a80e4b65 2022-09-19 op * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 a80e4b65 2022-09-19 op * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 a80e4b65 2022-09-19 op * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 a80e4b65 2022-09-19 op * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 a80e4b65 2022-09-19 op * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 a80e4b65 2022-09-19 op * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 a80e4b65 2022-09-19 op * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 a80e4b65 2022-09-19 op */
17 a80e4b65 2022-09-19 op
18 a80e4b65 2022-09-19 op #include <sys/queue.h>
19 a80e4b65 2022-09-19 op #include <sys/tree.h>
20 a80e4b65 2022-09-19 op
21 a80e4b65 2022-09-19 op #include <netinet/in.h>
22 a80e4b65 2022-09-19 op #include <arpa/inet.h>
23 a80e4b65 2022-09-19 op
24 a80e4b65 2022-09-19 op #include <event.h>
25 a80e4b65 2022-09-19 op #include <limits.h>
26 a80e4b65 2022-09-19 op #include <stdint.h>
27 a80e4b65 2022-09-19 op
28 a80e4b65 2022-09-19 op #include "galileo.h"
29 a80e4b65 2022-09-19 op
30 a80e4b65 2022-09-19 op !}
31 a80e4b65 2022-09-19 op
32 a80e4b65 2022-09-19 op {{ define tp_head(struct template *tp, const char *lang,
33 a80e4b65 2022-09-19 op const char *stylesheet) }}
34 a80e4b65 2022-09-19 op <!doctype html>
35 a80e4b65 2022-09-19 op <html{{ if *lang != '\0' }}lang="{{ lang }}"{{ end }}>
36 a80e4b65 2022-09-19 op <head>
37 a80e4b65 2022-09-19 op <meta name="viewport" content="initial-scale=1" />
38 a80e4b65 2022-09-19 op {{ if *stylesheet != '\0' }}
39 a80e4b65 2022-09-19 op <link rel="stylesheet" href="{{ stylesheet|urlescape }}" />
40 a80e4b65 2022-09-19 op {{ end }}
41 a80e4b65 2022-09-19 op </head>
42 a80e4b65 2022-09-19 op <body>
43 a80e4b65 2022-09-19 op {{ end }}
44 a80e4b65 2022-09-19 op
45 a80e4b65 2022-09-19 op {{ define tp_foot(struct template *tp) }}
46 a80e4b65 2022-09-19 op {! struct client *clt = tp->tp_arg; !}
47 a80e4b65 2022-09-19 op {! struct proxy_config *pc = clt->clt_pc; !}
48 a80e4b65 2022-09-19 op {! const char *host = pc->proxy_name; !}
49 a80e4b65 2022-09-19 op {! const char *path = clt->clt_path_info; !}
50 a80e4b65 2022-09-19 op
51 a80e4b65 2022-09-19 op <footer>
52 a80e4b65 2022-09-19 op <hr />
53 a80e4b65 2022-09-19 op <dl>
54 a80e4b65 2022-09-19 op <dt>Original URL:</dt>
55 a80e4b65 2022-09-19 op <dd>
56 a80e4b65 2022-09-19 op <a href="gemini://{{ host | urlescape }}{{ path | urlescape }}">
57 a80e4b65 2022-09-19 op gemini://{{ host }}{{ path }}
58 a80e4b65 2022-09-19 op </a>
59 a80e4b65 2022-09-19 op </dd>
60 a80e4b65 2022-09-19 op </dl>
61 a80e4b65 2022-09-19 op </footer>
62 a80e4b65 2022-09-19 op </body>
63 a80e4b65 2022-09-19 op </html>
64 a80e4b65 2022-09-19 op {{ end }}
65 a80e4b65 2022-09-19 op
66 a80e4b65 2022-09-19 op {{ define tp_figure(struct template *tp, const char *url,
67 a80e4b65 2022-09-19 op const char *label) }}
68 a80e4b65 2022-09-19 op <figure>
69 a80e4b65 2022-09-19 op <a href="{{ url | urlescape }}">
70 a80e4b65 2022-09-19 op <img src="{{ url }}" />
71 a80e4b65 2022-09-19 op </a>
72 a80e4b65 2022-09-19 op <figcaption>
73 a80e4b65 2022-09-19 op {{ label }}
74 a80e4b65 2022-09-19 op </figcaption>
75 a80e4b65 2022-09-19 op </figure>
76 a80e4b65 2022-09-19 op {{ end }}