diff --git a/API.md b/API.md new file mode 100644 index 0000000..2950f44 --- /dev/null +++ b/API.md @@ -0,0 +1,62 @@ +# API + +## Create a paste + +### Request + +**Method:** `POST /api/paste` + +#### Body + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| `content` | `string` | Paste content. If encrypted, must be encoded into a string (preferably Base64). | Yes | +| `config` | `object` | Configuration for the paste | No | +| `passwordProtected` | `boolean` | Whether the paste is password protected. | No | +| `initVector` | `string` | Initialization vector for AES encryption. Max length: 64. | No | + +**Config Object:** + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| `language` | `string` | Programming language of the paste. Default: `plaintext`. | No | +| `encrypted` | `boolean` | Whether the paste is encrypted. Default: `false`. | No | +| `expiresAfter` | `number` | Time in seconds until the paste expires. | No | +| `burnAfterRead` | `boolean` | Whether the paste is deleted after reading. | No | + +### Examples + +```json +{ + "content": "i0n3PW6qDUhDaTrzoKg+/ip4qQwu+iq8/fWDVg==", + "config": { + "language": "plaintext", + "encrypted": true, + "expiresAfter": 3600, + "burnAfterRead": false + }, + "passwordProtected": false, + "initVector": "27DIWK00yDiGx001" +} +``` + +```json +{ + "content": "Hello World!", + "config": { + "language": "plaintext" + } +} +``` + +## Get a paste + +### Request + +**Method:** `GET /api/paste` + +#### Query Parameters + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| `key` | `string` | Paste key. | Yes | diff --git a/README.md b/README.md index f97d553..62dea3c 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,12 @@ Well, cause no pastebin I could find had ALL of the following features: - API support to create and get pastes from command line. - View raw pastes. Normally, encrypted pastebins do not have this. With this site, you can either get the Base64-encoded encrypted paste, or decrypt it on the server side (even with the password) and get the raw paste. - Keyboard shortcuts! - - And ofcourse, being fully open-source and easily self-hostable. + - And of course, being fully open-source and easily self-hostable. + - **It can even be run on edge servers and in serverless environments!** + + ## API Documentation + +See [API.md](API.md). ## How to use @@ -34,3 +39,9 @@ yarn dev docker build -t yabin:latest . docker run --env-file .env -it -p 3000:3000 yabin:latest ``` + +#### In a serverless environment (Cloudflare Workers, Netlify, Vercel, etc.) + +I have not yet tested this, but this is made with SvelteKit. Please take a look at the [SvelteKit documentation](https://kit.svelte.dev/docs/adapters) for more information. If there are any issues, please open an issue, and I will put up a proper guide on how to deploy on such environmments. + +**Right now, it is using PostgreSQL (cause I had a server lying around). However, it can be run using any SQL DB such as SQLite or MySQL. To use other backends, please update the provider in [schema.prisma](src/lib/server/prisma/schema.prisma)** \ No newline at end of file diff --git a/package.json b/package.json index fbfe96c..f8574e2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "yabin", - "version": "0.0.1", + "version": "1.0.0", "private": true, "scripts": { "dev": "vite dev", diff --git a/src/app.html b/src/app.html index 0e86b82..113f6ff 100644 --- a/src/app.html +++ b/src/app.html @@ -7,7 +7,7 @@ - +
+ The API documentation is available here. +
+
If you really like this project, I'd love it if you me on GitHub.
-- Soon, after the development is mostly complete, I will be running managed servers on a - custom and short domain. You can also support me by subscribing to a monthly service, and - you get your own pastebin, with your custom styles, colours, text and more! +
+ Soon, I will be running managed servers on a custom and short domain. You can support me by + subscribing to a monthly service, and you get your own pastebin, with your custom styles, + colours, text and more! If you are interested, please send me an email at contact@sohamsen.me, and I will get back to you as soon as possible.