-# 🚀 Spirit
+# 🚀 Spacebin
[![codecov](https://codecov.io/gh/orca-group/spirit/branch/develop/graph/badge.svg?token=NNZDS74DB1)](https://codecov.io/gh/orca-group/spirit) [![GitHub license](https://img.shields.io/github/license/orca-group/spirit?color=%20%23e34b4a&logoColor=%23000000)](LICENSE) [![Build](https://github.com/orca-group/spirit/actions/workflows/build.yml/badge.svg?branch=develop)](https://github.com/orca-group/spirit/actions/workflows/build.yml)
[![Go report card](https://goreportcard.com/badge/github.com/orca-group/spirit)](https://goreportcard.com/report/github.com/orca-group/spirit)
-Spirit is the primary implementation of the Spacebin Server, written in Go and maintained by the Orca Group. Spacebin itself is a standardized pastebin server, that's capable of serving notes, novels, code or any other form of text!
+Spacebin is a modern Pastebin server implemented in Go and maintained by Luke Whritenour. It is capable of serving notes, novels, code, or any other form of text! Spacebin was designed to be fast and reliable, avoiding the problems of many current pastebin servers. Spacebin features JavaScript-based text highlighting, but works completely fine with JS disabled. Besides text highlighting, we have many more features in the works. It is entirely self-hostable, and available in a Docker image.
-Pastebin's are a type of online content storage service where users can store plain text document, e.g. program source code. For more information and the history of Pastebin see Wikipedia's [article on them](https://en.wikipedia.org/wiki/Pastebin).
+Pastebins are a type of online content storage service where users can store plain text document, e.g. program source code. For more information and the history of Pastebin see Wikipedia's [article on them](https://en.wikipedia.org/wiki/Pastebin).
## Table of Contents
-- [🚀 Spirit](#-spirit)
+- [🚀 Spacebin](#-spacebin)
- [Table of Contents](#table-of-contents)
- [Documentation](#documentation)
- [Self-hosting](#self-hosting)
@@ -58,13 +58,13 @@ Since Spirit supports `multipart/form-data` uploads, it's extremely easy to use
**To upload a string of text:**
```sh
-curl -v -F content="Hello, world!" https://spaceb.in/api | jq payload.id
+curl -v -F content="Hello, world!" https://spaceb.in/ | jq payload.id
```
**To upload from a file:**
```sh
-curl -v -F content=@helloworld.txt https://spaceb.in/api | jq payload.id
+curl -v -F content=@helloworld.txt https://spaceb.in/ | jq payload.id
```
### API
@@ -73,11 +73,11 @@ Work in progress. Check out the documentation website: [docs.spaceb.in](https://
## Credits
-Spacebin (and Spirit) is a project by Luke Whritenour, associated with the [Orca Group](https://github.com/orca-group)—a developer collective. Spirit was forked from [hastebin](https://github.com/toptal/haste-server) by John Crepezzi (now managed by Toptal), and although it no longer contains **any** code from the original we'd like to thank him regardless. Spirit itself is built using [Chi](https://github.com/go-chi/chi), and [pq](https://github.com/lib/pq), [Ozzo Validation](https://github.com/go-ozzo/ozzo-validation), [Cron](https://github.com/robfig/cron), [env](https://github.com/caarlos0/env), and (of course) [Go](https://go.dev/) itself!
+Spacebin (and all other associated programs) is a project designed and maintained by Luke Whritenour. Spirit was forked from [hastebin](https://github.com/toptal/haste-server) by John Crepezzi (now managed by Toptal), and although it no longer contains **any** code from the original we'd like to thank him regardless. Spirit itself is built using [Chi](https://github.com/go-chi/chi), and [pq](https://github.com/lib/pq), [Ozzo Validation](https://github.com/go-ozzo/ozzo-validation), [Cron](https://github.com/robfig/cron), [env](https://github.com/caarlos0/env), and (of course) [Go](https://go.dev/) itself!
You can see a full list of code contributors to Spirit [here, on Github](https://github.com/orca-group/spirit/graphs/contributors).
-Additionally, we'd like to thank [@uwukairi](https://github.com/uwukairi) for designing our logo/brand.
+Additionally, we'd like to thank [@jackdorland](https://github.com/jackdorland) for designing our logo/brand.
## Vulnerabilities
From c741ff88c0d4b0403a3d712a668d420e7a84858b Mon Sep 17 00:00:00 2001
From: Luke
Date: Sat, 22 Jun 2024 22:54:24 -0400
Subject: [PATCH 7/7] docs(readme.md): api documentation
---
README.md | 45 ++++++++++++++++++++++++++++++++--
internal/server/web/index.html | 2 +-
2 files changed, 44 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 291195a4..ffc26dce 100644
--- a/README.md
+++ b/README.md
@@ -49,7 +49,7 @@ WIP
#### On the Web
-To use Spacebin on the web, our team provides a web app written in [Svelte](https://svelte.dev): [Pulsar](https://github.com/orca-group/pulsar). A public instance of Spacebin using this client is available at [https://spaceb.in](https://spaceb.in) (the `/api` route can be used to access Spirit itself).
+To use Spacebin on the web, our team provides a web app. You can access the web app at [spaceb.in](https://spaceb.in). You must use `https://spaceb.in/api` to access the API routes.
#### CLI
@@ -69,7 +69,48 @@ curl -v -F content=@helloworld.txt https://spaceb.in/ | jq payload.id
### API
-Work in progress. Check out the documentation website: [docs.spaceb.in](https://docs.spaceb.in).
+There are three primary API routes to: create a document, fetch a documents text content in JSON format, and fetch a documents **plain text** content.
+
+* `/api/`: Create Document
+ * Accepts JSON and multipart/form-data
+ * For both formats, include document content in a `content` field
+ * Only accepts POST requests
+ * Instances are able to specify a maximum document length.
+ * `spaceb.in` uses a 4MB maximum size.
+ * Successful requests return a JSON body with the following format:
+```json
+{
+ "error": "",
+ "payload": {
+ "id": "WfwKGJfs",
+ "content": "hello",
+ "created_at": "2023-08-06T00:01:33.143532-04:00",
+ "updated_at": "2023-08-06T00:01:33.143532-04:00"
+ }
+}
+```
+* `/api/{document}`: Fetch Document
+ * `{document}` = Document ID
+ * Document ID lengths vary between instances. For `spaceb.in`, they will be exactly characters.
+ *
+ * Upon successful request, returns a JSON body with the following format:
+```json
+{
+ "error": "",
+ "payload": {
+ "id": "WfwKGJfs",
+ "content": "hello",
+ "created_at": "2023-08-06T00:01:33.143532-04:00",
+ "updated_at": "2023-08-06T00:01:33.143532-04:00"
+ }
+}
+```
+* `/api/{document}/raw`: Fetch Document - Raw
+ * `{document}` = Document ID
+ * Document ID lengths vary between instances. For `spaceb.in`, they will be exactly 8 characters
+ * Returns a `plain/text` file containing the content of the document.
+
+There are two additional non-API routes that are documented: `/ping`: returns a 200 OK if the service is online, and `/config`: returns a JSON body with the instances configuration settings.
## Credits
diff --git a/internal/server/web/index.html b/internal/server/web/index.html
index 8874f226..ca1a3d79 100644
--- a/internal/server/web/index.html
+++ b/internal/server/web/index.html
@@ -43,7 +43,7 @@
-
+