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 c25ddde1 2021-06-19 op #include "telescope.h"
18 86395f5c 2021-03-02 op
19 86395f5c 2021-03-02 op #define ASCII_ART \
20 86395f5c 2021-03-02 op "```An Ascii art of the word \"Telescope\"\n" \
21 86395f5c 2021-03-02 op " _______ __\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
28 81ea92ab 2021-03-08 op #define CIRCUMLUNAR_SPACE "gemini://gemini.circumlunar.space"
29 81ea92ab 2021-03-08 op
30 1b412079 2021-06-19 op const char *about_about =
31 1b412079 2021-06-19 op "# About pages\n"
32 1b412079 2021-06-19 op "\n"
33 3cd700b6 2021-07-02 op "Telescope has a number of \"special\" built-in pages:\n"
34 1b412079 2021-06-19 op "\n"
35 1b412079 2021-06-19 op "=> about:about about:about : this page\n"
36 1b412079 2021-06-19 op "=> about:blank about:blank : a blank page\n"
37 1b412079 2021-06-19 op "=> about:bookmarks about:bookmarks : the bookmarks page\n"
38 1b412079 2021-06-19 op "=> about:help about:help : help page\n"
39 1b412079 2021-06-19 op "=> about:new about:new : the default new tab page\n"
40 1b412079 2021-06-19 op "\n"
41 1b412079 2021-06-19 op ;
42 1b412079 2021-06-19 op
43 1b412079 2021-06-19 op const char *about_blank = "\n";
44 1b412079 2021-06-19 op
45 1b412079 2021-06-19 op const char *about_help =
46 1b412079 2021-06-19 op "# Help\n"
47 1b412079 2021-06-19 op "\n"
48 355bef22 2021-06-25 op "> Tip: use the arrow keys, page up/down, hjkl or C-{b,f,n,p} to move"
49 355bef22 2021-06-25 op " the cursor and read the page.\n"
50 6304b525 2021-06-24 op "\n"
51 355bef22 2021-06-25 op "> Tip: to enter an URL and start browsing, type `>' or `C-x C-f'.\n"
52 355bef22 2021-06-25 op "\n"
53 1b412079 2021-06-19 op "## What is Gemini?\n"
54 1b412079 2021-06-19 op "\n"
55 1b412079 2021-06-19 op "Gemini is a new internet protocol which:\n"
56 1b412079 2021-06-19 op "\n"
57 1b412079 2021-06-19 op "* is heavier than gopher\n"
58 1b412079 2021-06-19 op "* is lighter than the web\n"
59 1b412079 2021-06-19 op "* will not replace either\n"
60 1b412079 2021-06-19 op "* strives for maximum power to weight ratio\n"
61 1b412079 2021-06-19 op "* takes user privacy very seriously\n"
62 1b412079 2021-06-19 op "\n"
63 67679476 2021-06-20 op "=> gemini://gemini.circumlunar.space Project Gemini Homepage\n"
64 1b412079 2021-06-19 op "\n"
65 24d724fb 2021-06-24 op "> Tip: use `C-M-b' and `C-M-f' (or `H' and `L') to navigate "
66 24d724fb 2021-06-24 op " forward and backward in the history.\n"
67 a38a5d13 2021-06-24 op "\n"
68 67679476 2021-06-20 op "> Tip: move the cursor over a link and press M-RET (alt-enter) to"
69 67679476 2021-06-20 op " open it in another tab. Then use `C-x t n' and `C-x t p'"
70 67679476 2021-06-20 op " (or `g t' and `g T') to switch between tabs.\n"
71 67679476 2021-06-20 op "\n"
72 67679476 2021-06-20 op "\n"
73 1b412079 2021-06-19 op "## What is Telescope?\n"
74 1b412079 2021-06-19 op "\n"
75 67679476 2021-06-20 op "Telescope is a Gemini browser written for fun, as hobbystic project"
76 67679476 2021-06-20 op " in my free time. As such, it lacks a ton of features you'll find in"
77 6304b525 2021-06-24 op " more mature Gemini browsers, but it also has some unique ones.\n"
78 1b412079 2021-06-19 op "\n"
79 67679476 2021-06-20 op "The UI is strongly inspired from Emacs and W3M, so you'll find some"
80 67679476 2021-06-20 op " familiar concepts, such as the minibuffer or the tabline, but care"
81 67679476 2021-06-20 op " has been taken to make it as familiar as possible for vi and CUA"
82 67679476 2021-06-20 op " users too.\n"
83 1b412079 2021-06-19 op "\n"
84 67679476 2021-06-20 op "=> gemini://telescope.omarpolo.com Telescope Project Homepage\n"
85 67679476 2021-06-20 op "\n"
86 6304b525 2021-06-24 op "Telescope is documented very carefully, so please check out the"
87 6304b525 2021-06-24 op " manpage to know more:\n"
88 67679476 2021-06-20 op "\n"
89 1b412079 2021-06-19 op "> man telescope\n"
90 1b412079 2021-06-19 op "\n"
91 355bef22 2021-06-25 op "=> gemini://gemini.omarpolo.com/cgi/man/telescope"
92 355bef22 2021-06-25 op " Telescope man page in the gemini space.\n"
93 1b412079 2021-06-19 op "\n"
94 355bef22 2021-06-25 op "\n"
95 1b412079 2021-06-19 op "### Appearance\n"
96 1b412079 2021-06-19 op "\n"
97 dd2c34ba 2021-06-19 op "Telescope is fully customizable. The default configuration file is\n"
98 1b412079 2021-06-19 op "\n"
99 dd2c34ba 2021-06-19 op "> ~/.telescope/config\n"
100 5c57b212 2021-06-19 op "\n"
101 dd2c34ba 2021-06-19 op "If your terminal emulator doesn't have problems with UTF-8 glyphs,"
102 dd2c34ba 2021-06-19 op " try to load Telescope with the following configuration:\n"
103 dd2c34ba 2021-06-19 op "\n"
104 dd2c34ba 2021-06-19 op "``` Example of configuration file with some pretty defaults\n"
105 1b412079 2021-06-19 op "# pretty prefixes\n"
106 1b412079 2021-06-19 op "style line.item {\n"
107 6322dee3 2021-06-21 op " prefix \" • \" \" \"\n"
108 1b412079 2021-06-19 op "}\n"
109 1b412079 2021-06-19 op "\n"
110 1b412079 2021-06-19 op "style line.link {\n"
111 6322dee3 2021-06-21 op " prefix \"→ \" \" \"\n"
112 1b412079 2021-06-19 op "}\n"
113 1b412079 2021-06-19 op "\n"
114 1b412079 2021-06-19 op "style line.quote {\n"
115 2dd1e060 2021-06-19 op " prefix \" ┃ \"\n"
116 1b412079 2021-06-19 op "}\n"
117 1b412079 2021-06-19 op "```\n"
118 1b412079 2021-06-19 op ;
119 1b412079 2021-06-19 op
120 86395f5c 2021-03-02 op const char *about_new =
121 86395f5c 2021-03-02 op ASCII_ART
122 86395f5c 2021-03-02 op "\n"
123 81ea92ab 2021-03-08 op "=> " CIRCUMLUNAR_SPACE "/docs Gemini documentation\n"
124 81ea92ab 2021-03-08 op "=> " CIRCUMLUNAR_SPACE "/software Gemini software\n"
125 81ea92ab 2021-03-08 op "\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 };