Blame


1 86395f5c 2021-03-02 op /*
2 86395f5c 2021-03-02 op * Copyright (c) 2021 Omar Polo <op@omarpolo.com>
3 86395f5c 2021-03-02 op *
4 86395f5c 2021-03-02 op * Permission to use, copy, modify, and distribute this software for any
5 86395f5c 2021-03-02 op * purpose with or without fee is hereby granted, provided that the above
6 86395f5c 2021-03-02 op * copyright notice and this permission notice appear in all copies.
7 86395f5c 2021-03-02 op *
8 86395f5c 2021-03-02 op * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 86395f5c 2021-03-02 op * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 86395f5c 2021-03-02 op * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 86395f5c 2021-03-02 op * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 86395f5c 2021-03-02 op * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 86395f5c 2021-03-02 op * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 86395f5c 2021-03-02 op * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 86395f5c 2021-03-02 op */
16 86395f5c 2021-03-02 op
17 5a824be4 2021-07-13 op #include "config.h"
18 5a824be4 2021-07-13 op #include "pages.h"
19 86395f5c 2021-03-02 op
20 86395f5c 2021-03-02 op #define ASCII_ART \
21 86395f5c 2021-03-02 op "```An Ascii art of the word \"Telescope\"\n" \
22 86395f5c 2021-03-02 op " _______ __\n" \
23 86395f5c 2021-03-02 op "|_ _|.-----.| |.-----.-----.----.-----.-----.-----.\n" \
24 86395f5c 2021-03-02 op " | | | -__|| || -__|__ --| __| _ | _ | -__|\n" \
25 86395f5c 2021-03-02 op " |___| |_____||__||_____|_____|____|_____| __|_____|\n" \
26 86395f5c 2021-03-02 op " |__|\n" \
27 86395f5c 2021-03-02 op "```\n"
28 86395f5c 2021-03-02 op
29 81ea92ab 2021-03-08 op #define CIRCUMLUNAR_SPACE "gemini://gemini.circumlunar.space"
30 81ea92ab 2021-03-08 op
31 1b412079 2021-06-19 op const char *about_about =
32 1b412079 2021-06-19 op "# About pages\n"
33 1b412079 2021-06-19 op "\n"
34 3cd700b6 2021-07-02 op "Telescope has a number of \"special\" built-in pages:\n"
35 1b412079 2021-06-19 op "\n"
36 bd10f9dc 2021-07-14 op "=> about:about\n"
37 bd10f9dc 2021-07-14 op "=> about:blank\n"
38 bd10f9dc 2021-07-14 op "=> about:bookmarks\n"
39 bd10f9dc 2021-07-14 op "=> about:help\n"
40 bd10f9dc 2021-07-14 op "=> about:new\n"
41 1b412079 2021-06-19 op "\n"
42 1b412079 2021-06-19 op ;
43 1b412079 2021-06-19 op
44 1b412079 2021-06-19 op const char *about_blank = "\n";
45 1b412079 2021-06-19 op
46 1b412079 2021-06-19 op const char *about_help =
47 1b412079 2021-06-19 op "# Help\n"
48 1b412079 2021-06-19 op "\n"
49 355bef22 2021-06-25 op "> Tip: use the arrow keys, page up/down, hjkl or C-{b,f,n,p} to move"
50 355bef22 2021-06-25 op " the cursor and read the page.\n"
51 6304b525 2021-06-24 op "\n"
52 bd10f9dc 2021-07-14 op "> Tip: to enter an URL and start browsing, type `>'.\n"
53 355bef22 2021-06-25 op "\n"
54 1b412079 2021-06-19 op "## What is Gemini?\n"
55 1b412079 2021-06-19 op "\n"
56 1b412079 2021-06-19 op "Gemini is a new internet protocol which:\n"
57 1b412079 2021-06-19 op "\n"
58 1b412079 2021-06-19 op "* is heavier than gopher\n"
59 1b412079 2021-06-19 op "* is lighter than the web\n"
60 1b412079 2021-06-19 op "* will not replace either\n"
61 1b412079 2021-06-19 op "* strives for maximum power to weight ratio\n"
62 1b412079 2021-06-19 op "* takes user privacy very seriously\n"
63 1b412079 2021-06-19 op "\n"
64 67679476 2021-06-20 op "=> gemini://gemini.circumlunar.space Project Gemini Homepage\n"
65 1b412079 2021-06-19 op "\n"
66 05c5cf0c 2021-07-13 op "> Tip: use `B' and `F' (or `H' and `L') to navigate"
67 24d724fb 2021-06-24 op " forward and backward in the history.\n"
68 a38a5d13 2021-06-24 op "\n"
69 67679476 2021-06-20 op "> Tip: move the cursor over a link and press M-RET (alt-enter) to"
70 67679476 2021-06-20 op " open it in another tab. Then use `C-x t n' and `C-x t p'"
71 67679476 2021-06-20 op " (or `g t' and `g T') to switch between tabs.\n"
72 67679476 2021-06-20 op "\n"
73 67679476 2021-06-20 op "\n"
74 1b412079 2021-06-19 op "## What is Telescope?\n"
75 1b412079 2021-06-19 op "\n"
76 67679476 2021-06-20 op "Telescope is a Gemini browser written for fun, as hobbystic project"
77 67679476 2021-06-20 op " in my free time. As such, it lacks a ton of features you'll find in"
78 6304b525 2021-06-24 op " more mature Gemini browsers, but it also has some unique ones.\n"
79 1b412079 2021-06-19 op "\n"
80 67679476 2021-06-20 op "The UI is strongly inspired from Emacs and W3M, so you'll find some"
81 67679476 2021-06-20 op " familiar concepts, such as the minibuffer or the tabline, but care"
82 67679476 2021-06-20 op " has been taken to make it as familiar as possible for vi and CUA"
83 67679476 2021-06-20 op " users too.\n"
84 1b412079 2021-06-19 op "\n"
85 67679476 2021-06-20 op "=> gemini://telescope.omarpolo.com Telescope Project Homepage\n"
86 67679476 2021-06-20 op "\n"
87 6304b525 2021-06-24 op "Telescope is documented very carefully, so please check out the"
88 6304b525 2021-06-24 op " manpage to know more:\n"
89 67679476 2021-06-20 op "\n"
90 1b412079 2021-06-19 op "> man telescope\n"
91 1b412079 2021-06-19 op "\n"
92 355bef22 2021-06-25 op "=> gemini://gemini.omarpolo.com/cgi/man/telescope"
93 355bef22 2021-06-25 op " Telescope man page in the gemini space.\n"
94 1b412079 2021-06-19 op "\n"
95 355bef22 2021-06-25 op "\n"
96 1b412079 2021-06-19 op "### Appearance\n"
97 1b412079 2021-06-19 op "\n"
98 dd2c34ba 2021-06-19 op "Telescope is fully customizable. The default configuration file is\n"
99 1b412079 2021-06-19 op "\n"
100 dd2c34ba 2021-06-19 op "> ~/.telescope/config\n"
101 5c57b212 2021-06-19 op "\n"
102 dd2c34ba 2021-06-19 op "If your terminal emulator doesn't have problems with UTF-8 glyphs,"
103 dd2c34ba 2021-06-19 op " try to load Telescope with the following configuration:\n"
104 dd2c34ba 2021-06-19 op "\n"
105 dd2c34ba 2021-06-19 op "``` Example of configuration file with some pretty defaults\n"
106 1b412079 2021-06-19 op "# pretty prefixes\n"
107 1b412079 2021-06-19 op "style line.item {\n"
108 6322dee3 2021-06-21 op " prefix \" • \" \" \"\n"
109 1b412079 2021-06-19 op "}\n"
110 1b412079 2021-06-19 op "\n"
111 1b412079 2021-06-19 op "style line.link {\n"
112 6322dee3 2021-06-21 op " prefix \"→ \" \" \"\n"
113 1b412079 2021-06-19 op "}\n"
114 1b412079 2021-06-19 op "\n"
115 1b412079 2021-06-19 op "style line.quote {\n"
116 2dd1e060 2021-06-19 op " prefix \" ┃ \"\n"
117 1b412079 2021-06-19 op "}\n"
118 1b412079 2021-06-19 op "```\n"
119 1b412079 2021-06-19 op ;
120 1b412079 2021-06-19 op
121 86395f5c 2021-03-02 op const char *about_new =
122 86395f5c 2021-03-02 op ASCII_ART
123 86395f5c 2021-03-02 op "\n"
124 81ea92ab 2021-03-08 op "=> " CIRCUMLUNAR_SPACE "/docs Gemini documentation\n"
125 81ea92ab 2021-03-08 op "=> " CIRCUMLUNAR_SPACE "/software Gemini software\n"
126 72d094ff 2021-07-02 op "=> gemini://geminispace.info/ Gemini Search Engine (geminispace.info)\n"
127 81ea92ab 2021-03-08 op "\n"
128 86395f5c 2021-03-02 op "Version: " VERSION "\n"
129 86395f5c 2021-03-02 op "Bug reports to: " PACKAGE_BUGREPORT "\n"
130 5c57b212 2021-06-19 op "\n"
131 5c57b212 2021-06-19 op "=> " PACKAGE_URL " Telescope project page\n"
132 72d094ff 2021-07-02 op "=> about:help Help\n"
133 72d094ff 2021-07-02 op "=> about:about Internal Pages\n"
134 86395f5c 2021-03-02 op ;
135 0972d8b2 2021-03-02 op
136 5cd2ebb1 2021-03-11 op /* XXX: keep in sync with telescope.c:/^normalize_code/ */
137 0972d8b2 2021-03-02 op const char *err_pages[70] = {
138 0972d8b2 2021-03-02 op [CANNOT_FETCH] = "# Couldn't load the page\n",
139 0972d8b2 2021-03-02 op [TOO_MUCH_REDIRECTS] = "# Too much redirects\n",
140 5cd2ebb1 2021-03-11 op [MALFORMED_RESPONSE] = "# Got a malformed response\n",
141 c07ac996 2021-03-12 op [UNKNOWN_TYPE_OR_CSET] = "# Unsupported type or charset\n",
142 0972d8b2 2021-03-02 op
143 5cd2ebb1 2021-03-11 op [10] = "# Input required\n",
144 5cd2ebb1 2021-03-11 op [11] = "# Input required\n",
145 0972d8b2 2021-03-02 op [40] = "# Temporary failure\n",
146 0972d8b2 2021-03-02 op [41] = "# Server unavailable\n",
147 0972d8b2 2021-03-02 op [42] = "# CGI error\n",
148 0972d8b2 2021-03-02 op [43] = "# Proxy error\n",
149 0972d8b2 2021-03-02 op [44] = "# Slow down\n",
150 0972d8b2 2021-03-02 op [50] = "# Permanent failure\n",
151 0972d8b2 2021-03-02 op [51] = "# Not found\n",
152 0972d8b2 2021-03-02 op [52] = "# Gone\n",
153 0972d8b2 2021-03-02 op [53] = "# Proxy request refused\n",
154 0972d8b2 2021-03-02 op [59] = "# Bad request\n",
155 0972d8b2 2021-03-02 op [60] = "# Client certificate required\n",
156 0972d8b2 2021-03-02 op [61] = "# Certificate not authorised\n",
157 0972d8b2 2021-03-02 op [62] = "# Certificate not valid\n"
158 0972d8b2 2021-03-02 op };