Skip to content

Commit cd47c0d

Browse files
authored
chore: merge pr Spacebin v1.0.1
2 parents 1368d96 + c741ff8 commit cd47c0d

File tree

5 files changed

+71
-38
lines changed

5 files changed

+71
-38
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.20.7-alpine3.18
1+
FROM golang:1.22.4-alpine3.19
22

33
RUN mkdir /opt/spirit
44

README.md

+51-10
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
/>
77
</p>
88

9-
# 🚀 Spirit
9+
# 🚀 Spacebin
1010

1111
[![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)
1212
[![Go report card](https://goreportcard.com/badge/github.com/orca-group/spirit)](https://goreportcard.com/report/github.com/orca-group/spirit)
1313

14-
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!
14+
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.
1515

16-
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).
16+
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).
1717

1818
## Table of Contents
1919

20-
- [🚀 Spirit](#-spirit)
20+
- [🚀 Spacebin](#-spacebin)
2121
- [Table of Contents](#table-of-contents)
2222
- [Documentation](#documentation)
2323
- [Self-hosting](#self-hosting)
@@ -49,7 +49,7 @@ WIP
4949

5050
#### On the Web
5151

52-
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).
52+
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.
5353

5454
#### CLI
5555

@@ -58,26 +58,67 @@ Since Spirit supports `multipart/form-data` uploads, it's extremely easy to use
5858
**To upload a string of text:**
5959

6060
```sh
61-
curl -v -F content="Hello, world!" https://spaceb.in/api | jq payload.id
61+
curl -v -F content="Hello, world!" https://spaceb.in/ | jq payload.id
6262
```
6363

6464
**To upload from a file:**
6565

6666
```sh
67-
curl -v -F content=@helloworld.txt https://spaceb.in/api | jq payload.id
67+
curl -v -F content=@helloworld.txt https://spaceb.in/ | jq payload.id
6868
```
6969

7070
### API
7171

72-
Work in progress. Check out the documentation website: [docs.spaceb.in](https://docs.spaceb.in).
72+
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.
73+
74+
* `/api/`: Create Document
75+
* Accepts JSON and multipart/form-data
76+
* For both formats, include document content in a `content` field
77+
* Only accepts POST requests
78+
* Instances are able to specify a maximum document length.
79+
* `spaceb.in` uses a 4MB maximum size.
80+
* Successful requests return a JSON body with the following format:
81+
```json
82+
{
83+
"error": "",
84+
"payload": {
85+
"id": "WfwKGJfs",
86+
"content": "hello",
87+
"created_at": "2023-08-06T00:01:33.143532-04:00",
88+
"updated_at": "2023-08-06T00:01:33.143532-04:00"
89+
}
90+
}
91+
```
92+
* `/api/{document}`: Fetch Document
93+
* `{document}` = Document ID
94+
* Document ID lengths vary between instances. For `spaceb.in`, they will be exactly characters.
95+
*
96+
* Upon successful request, returns a JSON body with the following format:
97+
```json
98+
{
99+
"error": "",
100+
"payload": {
101+
"id": "WfwKGJfs",
102+
"content": "hello",
103+
"created_at": "2023-08-06T00:01:33.143532-04:00",
104+
"updated_at": "2023-08-06T00:01:33.143532-04:00"
105+
}
106+
}
107+
```
108+
* `/api/{document}/raw`: Fetch Document - Raw
109+
* `{document}` = Document ID
110+
* Document ID lengths vary between instances. For `spaceb.in`, they will be exactly 8 characters
111+
* Returns a `plain/text` file containing the content of the document.
112+
113+
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.
73114

74115
## Credits
75116

76-
Spacebin (and Spirit) is a project by Luke Whritenour, associated with the [Orca Group](https://github.com/orca-group)&mdash;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!
117+
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!
77118

78119
You can see a full list of code contributors to Spirit [here, on Github](https://github.com/orca-group/spirit/graphs/contributors).
79120

80-
Additionally, we'd like to thank [@uwukairi](https://github.com/uwukairi) for designing our logo/brand.
121+
Additionally, we'd like to thank [@jackdorland](https://github.com/jackdorland) for designing our logo/brand.
81122

82123
## Vulnerabilities
83124

go.mod

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ go 1.22.4
44

55
require (
66
github.com/caarlos0/env/v9 v9.0.0
7-
github.com/go-chi/chi/v5 v5.0.10
7+
github.com/go-chi/chi/v5 v5.0.14
88
github.com/go-chi/cors v1.2.1
9-
github.com/go-chi/httprate v0.7.4
9+
github.com/go-chi/httprate v0.9.0
1010
github.com/go-ozzo/ozzo-validation/v4 v4.3.0
1111
github.com/lib/pq v1.10.9
1212
github.com/lukewhrit/phrase v0.1.1
13-
github.com/rs/zerolog v1.30.0
14-
github.com/stretchr/testify v1.8.4
13+
github.com/rs/zerolog v1.33.0
14+
github.com/stretchr/testify v1.9.0
1515
golang.org/x/exp v0.0.0-20230807204917-050eac23e9de
1616
)
1717

@@ -22,7 +22,7 @@ require (
2222
github.com/mattn/go-colorable v0.1.13 // indirect
2323
github.com/mattn/go-isatty v0.0.19 // indirect
2424
github.com/pmezard/go-difflib v1.0.0 // indirect
25-
github.com/stretchr/objx v0.5.0 // indirect
26-
golang.org/x/sys v0.11.0 // indirect
25+
github.com/stretchr/objx v0.5.2 // indirect
26+
golang.org/x/sys v0.12.0 // indirect
2727
gopkg.in/yaml.v3 v3.0.1 // indirect
2828
)

go.sum

+12-20
Original file line numberDiff line numberDiff line change
@@ -9,52 +9,44 @@ github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV
99
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1010
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
1111
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
12-
github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk=
13-
github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
12+
github.com/go-chi/chi/v5 v5.0.14 h1:PyEwo2Vudraa0x/Wl6eDRRW2NXBvekgfxyydcM0WGE0=
13+
github.com/go-chi/chi/v5 v5.0.14/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
1414
github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4=
1515
github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58=
16-
github.com/go-chi/httprate v0.7.4 h1:a2GIjv8he9LRf3712zxxnRdckQCm7I8y8yQhkJ84V6M=
17-
github.com/go-chi/httprate v0.7.4/go.mod h1:6GOYBSwnpra4CQfAKXu8sQZg+nZ0M1g9QnyFvxrAB8A=
16+
github.com/go-chi/httprate v0.9.0 h1:21A+4WDMDA5FyWcg7mNrhj63aNT8CGh+Z1alOE/piU8=
17+
github.com/go-chi/httprate v0.9.0/go.mod h1:6GOYBSwnpra4CQfAKXu8sQZg+nZ0M1g9QnyFvxrAB8A=
1818
github.com/go-ozzo/ozzo-validation/v4 v4.3.0 h1:byhDUpfEwjsVQb1vBunvIjh2BHQ9ead57VkAEY4V+Es=
1919
github.com/go-ozzo/ozzo-validation/v4 v4.3.0/go.mod h1:2NKgrcHl3z6cJs+3Oo940FPRiTzuqKbvfrL2RxCj6Ew=
2020
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
2121
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
2222
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
2323
github.com/lukewhrit/phrase v0.1.1 h1:QMZImLkC+u/g9PKZDDp48qLLVir6WxWpsRqjr77n/ZY=
2424
github.com/lukewhrit/phrase v0.1.1/go.mod h1:8HaO55bEkVlI5Ma+o+HGJ5Yo3rCd3Yl/8djwE/GRG4Y=
25-
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
2625
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
2726
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
28-
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
2927
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
3028
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
3129
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
3230
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
3331
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
3432
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
3533
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
36-
github.com/rs/zerolog v1.30.0 h1:SymVODrcRsaRaSInD9yQtKbtWqwsfoPcRff/oRXLj4c=
37-
github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w=
34+
github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8=
35+
github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
3836
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
39-
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
40-
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
41-
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
37+
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
38+
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
4239
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
43-
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
44-
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
45-
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
46-
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
40+
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
41+
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
4742
golang.org/x/exp v0.0.0-20230807204917-050eac23e9de h1:l5Za6utMv/HsBWWqzt4S8X17j+kt1uVETUX5UFhn2rE=
4843
golang.org/x/exp v0.0.0-20230807204917-050eac23e9de/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
49-
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
50-
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
5144
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
5245
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
53-
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
54-
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
46+
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
47+
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
5548
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
5649
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
5750
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
58-
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
5951
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
6052
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

internal/server/web/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
</svg>
4444
</a>
4545

46-
<a id="wiki" href="https://docs.spaceb.in" aria-label="Spacebin Documentation">
46+
<a id="wiki" href="https://github.com/orca-group/spirit/blob/main/README.md/#-spirit" aria-label="Spacebin Documentation">
4747
<svg fill="none" height="24" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
4848
stroke-width="2" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
4949
<path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z" />

0 commit comments

Comments
 (0)