summaryrefslogtreecommitdiffstats
path: root/README.md
blob: 32a6df73b59d06cf7cfd22934b7aacdc3850a0dd (plain)
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
# Coffeepaste

Coffeepaste is a pastebin-like service intended to be used from the command line.

## Building

Build with `cargo build` (or `cargo build --release` for a release build).

## Config

The config file `config.toml` contains config options like data path,
page URL, max file size, etc. It's compiled into the binary, so
any changes requires a recompile.

## Usage

The basic usage is to do `curl --upload-file <file> <URL>` to upload a file,
or `curl --upload-file - <URL>` to upload from stdin.
The server will respond with a URL to your content.

The URL's extension doesn't change the content of the file, but might change
the way it's presented.

## HTTP endpoints

### `GET /`, `GET /index.html`

Get the main page which provides usage information.

### `GET /<ID>`

Get the raw content of the file with the given ID.

### `GET /<ID>.<EXT>`

View the contents of the file with the given ID,
but displayed in a way determined by the extension.

* Any extension associated with an image, video or audio file is sent unmodified,
  but with the appropriate Content-Type header.
* Other extensions are a bit more complex:
    * If the client doing the request doesn't advertise HTML support, the client
      is sent the content unmodified.
    * Otherwise, the client is sent an HTML page which adds syntax highlighting
      and other features, where the syntax highlighting is determined by the
      extension (or, if the extension is `.auto`, the syntax highlighting
      guesses the file type based on content).

### `PUT /<PATH>`

Upload a file to the server. The path is ignored (a random ID is generated
instead), but if the path has a file extension, the returned URL will have
the same file extension.