馃崄 A very simple static Gemini server, now with Titan support!
cpp
gemini
titan
gemini-protocol
titan-protocol
1# Maple
2
3A very simple static Gemini server, now with Titan support!
4
5### Lines-of-code
6
7This codebase is now 351 lines of lines-of-code!
8
9The statement "... written within a single file and liberally
10spanning 159 lines-of-code." has been removed.
11
12If you would still like the minimal 159-LOC experience, checkout
13[49ce0f8](https://github.com/gemrest/maple/tree/49ce0f83b8abd1af4760e56c1673c6997ef8a2c4)!
14(Docker tag `0.1.4`) Do note, that version of this project is outdated and only
15has Gemini support.
16
17## Usage
18
19### Docker Compose
20
21A Docker Compose file is already setup [here](./docker-compose.yaml). The only
22field which should be modified is the `ports`, if need be.
23
24```shell
25docker-compose up -d
26```
27
28### Docker
29
30```shell
31docker run -p 1965:1965 -v ./your_capsules_directory:/maple/.maple fuwn/maple:latest
32```
33
34### Executable
35
361. Build: `tup` (requires [Tup](https://gittup.org/tup/index.html))
372. Run: `build/maple`, or
38 `TITAN=1 TITAN_TOKEN=secret TITAN_MAX_SIZE=2048 build/maple`
39
40### Certificates
41
42Before any possible method of usage; you must generate or use a preexisting
43server certificate.
44
45If you do not have an existing certificate, generate one using the provided
46certificate generations script: [`bin/genkey`](bin/genkey) (requires
47[OpenSSL](https://www.openssl.org/)).
48
49The server certificate must be placed in a directory -- directly adjacent to the
50Docker Compose file or executable -- named [`.maple`](.maple). The public and
51private keys must be named `public.pem` and `private.pem`, respectively.
52
53### Gemini Content
54
55Gemini content must be placed in a directory -- directly adjacent to the
56Docker Compose file or executable -- named [`.maple/gmi`](.maple/gmi) and
57ending with the file extension `.gmi`.
58
59### Environment Variables
60
61Maple can be configured with three optional environment variables:
62
63#### `TITAN`
64
65Enable Titan support.
66
67Takes a value of either `true` or `1`, case-insensitive.
68
69Defaults to off.
70
71#### `TITAN_TOKEN`
72
73Set a token to restrict Titan access.
74
75Takes a string value, case-sensitive.
76
77Defaults to no token, **anyone can upload!**
78
79#### `TITAN_MAX_SIZE`
80
81The maximum size in bytes which a Titan upload is permitted to perform.
82
83Takes an integer.
84
85Default to `1024`.
86
87### Hacking
88
89If you decide to tamper with Maple, you should give your commits a test. As
90there isn't a test suite yet, feel free to use any of these examples:
91
92```bash
93# Using OpenSSL directly to debug different requests:
94$ openssl s_client -ign_eof -quiet -connect localhost:1965 <<< \
95> "gemini://localhost:1965"
96
97# Using Bollux to debug proper requests... or any client!
98$ bollux localhost
99```
100
101## Capsules using Maple
102
103[Add yours!](https://github.com/gemrest/maple/edit/main/README.md)
104
105- <gemini://gem.rest/> (<https://gem.rest/>)
106
107## License
108
109This project is licensed with the [GNU General Public License v3.0](./LICENSE).