https://github.com/kyleterry/jot
Simple editable pastebin
https://github.com/kyleterry/jot
editable golang http pastebin pastebin-service
Last synced: 10 months ago
JSON representation
Simple editable pastebin
- Host: GitHub
- URL: https://github.com/kyleterry/jot
- Owner: kyleterry
- Created: 2018-06-30T05:01:38.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2024-06-09T22:01:01.000Z (over 1 year ago)
- Last Synced: 2025-03-20T12:07:35.488Z (11 months ago)
- Topics: editable, golang, http, pastebin, pastebin-service
- Language: Go
- Size: 1.46 MB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Jot
===
Jot is a simple and editable pastebin that's super easy to host yourself. It
doesn't require installation of large dependencies and everything runs from a
single binary. Outside a data dir and encryption seed file for password
generation, you don't need a programming language installed or assets anywhere
on your server.
## Features
The Jot feature set is very simple. The server exposes a very limited set of
CRUD operations defined below:
- `POST` content and get back a unique URL (`JOT_URL`) and a Jot-Password header
- `GET` to `JOT_URL` and you get back the content and an ETag header with the last
modified date set.
- `GET` to `JOT_URL` with `If-None-Match` header set and you will get a 304 Not
Modified status code back with no content, if the last modified date matches
the value sent in that header. Useful for client caching. Browsers support
this out of the box.
- `PUT` to `JOT_URL` with `?password=` and you can update that
content.
- `PUT` supports `If-Match` header allowing you to bail if the content has been
updated since the last modified date returned with a `GET`.
- `DELETE` to `JOT_URL` with `?password=` and you will delete
the jot.
## Endpoints
`GET /`: help text
`POST /txt`: create a text jot
`GET /txt/`: get a text jot
`PUT /txt/?password=`: edit a text jot
`DELETE /txt/?password=`: delete a text jot
`POST /img`: upload an image
`GET /img/`: get an image
`DELETE /img/?password=`: delete an image
## Building and Running
Requires: Go >=1.14
Running from localhost is simple. Below describes the minimal effort that goes
into running Jot:
```
# setup the source code dir
export JOT_HOME="${HOME}/code/jot"
mkdir -p "${JOT_HOME}"
git clone https://github.com/kyleterry/jot "${JOT_HOME}"
# these two are for config and data storage
mkdir -p "${HOME}/.config/jot"
mkdir -p "${HOME}/.local/share/jot"
# export the configuration for the jot proc
export JOT_MASTER_PASSWORD="please change this, this is your master password (also don't lose it)"
export JOT_SEED_FILE="${HOME}/.config/jot/seed"
export JOT_DATA_DIR="${HOME}/.local/share/jot"
cd "${JOT_HOME}"
# generate the seed file encrypted with the master password
go install github.com/cloudflare/gokey/cmd/gokey
gokey -p "${JOT_MASTER_PASSWORD}" -t seed -o "${JOT_SEED_FILE}"
# build and run jot
go build ./cmd/jot
./jot
curl http://localhost:8095
```