agate

Simple gemini server for static files
git clone https://github.com/mbrubeck/agate.git
Log | Files | Refs | README

commit 7899d9addbabc934de6d8b7909a5b601e3d2afc0
parent 5314e234158d2e6f6d1514fad94d5c2f5493a8a7
Author: Matt Brubeck <mbrubeck@limpet.net>
Date:   Sun,  7 Jun 2020 08:53:32 -0700

Change file extension from .gemini to .gmi

Diffstat:
MREADME.md | 2+-
Msrc/main.rs | 4++--
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md @@ -29,7 +29,7 @@ openssl req -x509 -newkey rsa:4096 -keyout key.rsa -out cert.pem \ agate 0.0.0.0:1965 path/to/content/ cert.pem key.rsa ``` -When a client requests the URL `gemini://example.com/foo/bar`, Agate will respond with the file at `path/to/content/foo/bar`. If there is a directory at that path, Agate will look for a file named `index.gemini` inside that directory. +When a client requests the URL `gemini://example.com/foo/bar`, Agate will respond with the file at `path/to/content/foo/bar`. If there is a directory at that path, Agate will look for a file named `index.gmi` inside that directory. [Gemini]: https://gemini.circumlunar.space/ [Rust]: https://www.rust-lang.org/ diff --git a/src/main.rs b/src/main.rs @@ -125,14 +125,14 @@ async fn send_response<W: Write + Unpin>(url: &Url, mut stream: W) -> Result { } if path.is_dir().await { if url.as_str().ends_with('/') { - path.push("index.gemini"); + path.push("index.gmi"); } else { return redirect_slash(url, stream).await; } } match async_std::fs::read(&path).await { Ok(body) => { - if path.extension() == Some(OsStr::new("gemini")) { + if path.extension() == Some(OsStr::new("gmi")) { stream.write_all(b"20 text/gemini\r\n").await?; } else { let mime = tree_magic::from_u8(&body);