blob: 93861b2b8d9bf529f597d53db87e82c57d78d957 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# 🏕️ Momoka
> A Gemini-to-Gopher proxy that bridges the smolweb to even more smolweb
Momoka is a [Gopher](https://www.rfc-editor.org/info/rfc1436) proxy that sits in
between Gopher clients and [Gemini](https://fuwn.me/proxy/geminiprotocol.net/)
servers. It translates any Gemini requests containing Gemtext into
Gopher-compatible responses.
Momoka is written in under 350 (345) lines of code in the functional
[Gleam](https://gleam.run) programming language. It's designed to be small and
simple.
<br>
For reference of accuracy, here is a screenshot of the
[Lagrange](https://gmi.skyjake.fi/lagrange/) client displaying both the Gopher
and the Gemini responses side-by-side. It's **literally** the same output.
<p align="center">
<br>
<img src="https://i.imgur.com/07aLdRj.png" width="75%">
</p>
## Usage
If you'd like to test out a production deployment of Momoka, you can visit
[`gopher://fuwn.me:70/1`](gopher://fuwn.me:70/1).
### Local
```bash
$ git clone [email protected]:Fuwn/momoka.git
$ cd momoka
$ gleam run
$ # or
$ nix run
```
### Docker
```shell
docker run -p '70:70' --rm fuwn/momoka:latest
```
### Proxy
By default, top-level requests, like `gopher://fuwn.me/1`, are proxied to
their mapped Gemini equivalents. Here are a few examples.
- [`gopher://fuwn.me`](gopher://fuwn.me) =>
[`gemini://fuwn.me`](gemini://fuwn.me)
- [`gopher://fuwn.me/1`](gopher://fuwn.me/1) =>
[`gemini://fuwn.me`](gemini://fuwn.me)
- [`gopher://fuwn.me/1/index2`](gopher://fuwn.me/1/index2) =>
[`gemini://fuwn.me/index2`](gemini://fuwn.me/index2)
Prepending `/proxy/` to the path will allow you to proxy any Gemini server.
Here are a few examples.
- [`gopher://fuwn.me/1/proxy/geminiprotocol.net`](gopher://fuwn.me/1/proxy/geminiprotocol.net)
=> [`gemini://geminiprotocol.net`](gemini://geminiprotocol.net)
- [`gopher://fuwn.me/1/proxy/fuwn.me/index2`](gopher://fuwn.me/1/proxy/fuwn.me/index2)
=> [`gemini://fuwn.me/index2`](`gemini://fuwn.me/index2`)
### Configuration
Momoka contains three environment variables that can be set to your liking.
- `ROOT` – The root Gemini capsule to proxy for top-level requests (defaults to
`fuwn.me`)
- `PORT` – The port to listen on for Gopher clients (defaults to `70`)
- `GEMINI_PROXY` – A raw-Gemtext producing Gemini-to-HTTP proxy. (defaults to
the [fuwn.me](https://fuwn.me)
[September](https://github.com/gemrest/september) instance)
## GemRest
I'm also the author of [GemRest](https://github.com/gemrest), the largest
organisation of Gemini-oriented software, tooling, and libraries. If you're
interested in Gemini, I'd recommend checking it out.
## Licence
This project is licensed with the [GNU General Public License v3.0](./LICENSE).
|