3 a80e4b65 2022-09-19 op * Copyright (c) 2022 Omar Polo <op@omarpolo.com>
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.
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.
18 a80e4b65 2022-09-19 op #include <sys/queue.h>
19 a80e4b65 2022-09-19 op #include <sys/tree.h>
21 a80e4b65 2022-09-19 op #include <netinet/in.h>
22 a80e4b65 2022-09-19 op #include <arpa/inet.h>
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>
28 a80e4b65 2022-09-19 op #include "galileo.h"
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 }}>
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 }}" />
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; !}
54 a80e4b65 2022-09-19 op <dt>Original URL:</dt>
56 a80e4b65 2022-09-19 op <a href="gemini://{{ host | urlescape }}{{ path | urlescape }}">
57 a80e4b65 2022-09-19 op gemini://{{ host }}{{ path }}
66 a80e4b65 2022-09-19 op {{ define tp_figure(struct template *tp, const char *url,
67 a80e4b65 2022-09-19 op const char *label) }}
69 a80e4b65 2022-09-19 op <a href="{{ url | urlescape }}">
70 a80e4b65 2022-09-19 op <img src="{{ url }}" />