You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
phd/README.md

61 lines
1.9 KiB
Markdown

4 years ago
```
/ |
___ (___ ___|
| )| )| )
4 years ago
|__/ | / |__/
|
4 years ago
```
4 years ago
🐀 lil gopher daemon
4 years ago
4 years ago
point it at a directory and it'll serve up all its text files, sub-directories, and binary files over gopher.
4 years ago
special files:
4 years ago
4 years ago
- **header.gph**: if it exists in a directory, its content will be shown above the directory's content. put ascii art in it.
4 years ago
- **footer.gph**: same, but will be shown below a directory's content.
- **index.gph**: completely replaces a directory's content with what's in this file.
4 years ago
- **??.gph**: visiting gopher://yoursite/1/dog/ will try to render `dog.gph` from disk.
4 years ago
- **.reverse**: if this exists, the directory contents will be listed in reverse alphanumeric order. useful for phloggin'.
4 years ago
4 years ago
Any line in a `.gph` file that doesn't contain tabs (`\t`) and doesn't start with an `i` will get an `i` automatically prefixed, turning it into a gopher information item.
4 years ago
4 years ago
Any `.gph` file that is marked **executable** with be run as if it were a shell script and its output will be sent to the client. It will be passed three arguments: the query string (if any, the host, and the port. Do with them what you will. (CGI-BIN is back, baby.)
4 years ago
For example:
$ cat echo.gph
#!/bin/sh
4 years ago
echo "Hi, world! You said:" $1
4 years ago
Then:
4 years ago
$ gopher-client gopher://localhost/1/echo?something
Hi, world! You said: something
4 years ago
4 years ago
## usage
4 years ago
phd [options] <directory>
4 years ago
phd ./path/to/gopher/root # Serve directory over port 70.
4 years ago
phd -p 7070 docs # Serve 'docs' directory on port 7070
phd -h localhost # Serve cwd using hostname "localhost".
4 years ago
## development
cargo run -- ./path/to/gopher/site
## resources
- https://github.com/gophernicus/gophernicus/blob/master/README.Gophermap
- https://gopher.zone/posts/how-to-gophermap/
4 years ago
- [rfc 1436](https://tools.ietf.org/html/rfc1436)
4 years ago
4 years ago
## todo
- [ ] logo
- [ ] script mode
- [ ] run mode
- [ ] log options
4 years ago
- [ ] 404 message