From 226b309df15c047033d1aa161a9446b34699429d Mon Sep 17 00:00:00 2001
From: Luck
Date: Wed, 27 Aug 2025 21:55:46 +0100
Subject: [PATCH] Update readme
---
API.md | 42 ++++++++++++++++++++++++++++++++++++++++
README.md | 38 ++----------------------------------
src/components/About.tsx | 19 ++++++++++++------
3 files changed, 57 insertions(+), 42 deletions(-)
create mode 100644 API.md
diff --git a/API.md b/API.md
new file mode 100644
index 0000000..3bd9e0e
--- /dev/null
+++ b/API.md
@@ -0,0 +1,42 @@
+
+
+
+
+# API
+paste has a simple HTTP API which can be used to read and write pastes programmatically.
+
+> [!IMPORTANT]
+> If you are using the official instance of paste (https://pastes.dev), please note the following:
+>
+> * You must **provide a `User-Agent` header** to uniquely identify your application in all requests. This should include the application name and contact information, e.g. `ExampleApp (github.com/ExampleUser/ExampleApp)` or `MyExampleScript (github.com/ExampleUser)`.
+> * You must **only upload content when prompted by a user action**, e.g. a button click or command line input. Automated or scheduled uploads are not allowed.
+> * An additional **terms of service** applies. In summary:
+> * No Illegal Use *(no illegal, harmful or unlawful content)*
+> * No Malicious Content *(no malware, phishing, personal data without consent, etc.)*
+> * Content Responsibility *(you are responsible for what you post)*
+> * Moderation *(we reserve the right to remove content or block access)*
+> * No Liability *(the service is provided "as is" without warranties)*
+>
+> Otherwise, please enjoy using the service! :)
+
+### Base URL
+The base URL for the 'official' paste instance is: `https://api.pastes.dev/`.
+
+If you are self-hosting, use the base URL of your own instance. With the default Docker Compose setup, this will be `http://localhost:8080/data/`.
+
+## Upload: `POST {BASE URL}/post`
+
+To upload content, send an HTTP `POST` request to `{BASE URL}/post`.
+
+* Include the content in the request body.
+* Specify the language with the `Content-Type: text/` header
+* If using the official instance, please remember to provide a suitable `User-Agent` header as well. (see above for more details)
+* The paste "key" is returned in the `Location` header, and in the response body as a JSON object in the format `{"key": ""}`.**
+
+## Read: `GET {BASE URL}/{key}`
+
+To read content, send an HTTP `GET` request to `{BASE URL}/{key}`.
+
+* Replace `{key}` with the id of the paste.
+* The content is returned in the response body.
+* The `Content-Type` header is `text/`, where language is the id of the language the paste was saved with.
diff --git a/README.md b/README.md
index bf4102b..52a891c 100644
--- a/README.md
+++ b/README.md
@@ -23,18 +23,6 @@ You can submit content most easily using [curl](https://curl.se/docs/manpage.htm
> echo "Hello world" | curl -T - https://api.pastes.dev/post
```
-
- If curl isn't installed on your system, you can also post using netcat.
-
- ```shell
- # Pipe in some output from any command
- > echo "Hello world" | nc nc.pastes.dev 1337
-
- # Upload the contents of a file
- > cat example.txt | nc nc.pastes.dev 1337
- ```
-
-
If you don't want to do so much typing, you can create a shorter alias.
@@ -56,8 +44,8 @@ You can submit content most easily using [curl](https://curl.se/docs/manpage.htm
```
-##### 3) From Code
-Send GET/POST/PUT requests to `https://api.pastes.dev/`. More info [below](#pastesdev-api).
+##### 3) From Code / Scripts
+Please see the [API Documentation](/API.md). :)
___
@@ -66,28 +54,6 @@ The frontend _(this repository)_ is written using the React framework. The backe
The user-interface is based on the [Monaco Editor](https://microsoft.github.io/monaco-editor/), the engine behind the popular Visual Studio Code text editor. It's quite simple; it supports syntax highlighting, automatic indentation, many supported languages, themes, zooming in/out, linking to specific lines or sections, and more!
-### pastes.dev
-
-I host a public instance at https://pastes.dev. Please feel free to use it to share code/configs/whatever!
-
-Please note that the following (very-non-legally worded) [terms of service](https://github.com/lucko/bytebin#public-instances) apply.
-If you come across any content which is illegal or infringes on copyright, please [get in touch](https://lucko.me/contact) and let me know so I can remove it.
-
-Uploaded content is retained for 90 days then deleted.
-
-### pastes.dev API
-
-* To **read** content, send a HTTP `GET` request to `https://api.pastes.dev/`.
- * Replace `` with the id of the paste.
- * The content is returned in the response body.
- * The `Content-Type` header is `text/`, where language is the id of the language the paste was saved with.
-* To **upload** content, send a HTTP `POST` request to `https://api.pastes.dev/post`.
- * Include the content in the request body.
- * Specify the language with the `Content-Type: text/` header, and please provide a `User-Agent` header too.
- * The paste "key" is returned in the `Location` header, or in the response body as a JSON object in the format `{"key": ""}`.
-
-The API is powered by the [bytebin](https://github.com/lucko/bytebin) service, so more information about how it works can be found there.
-
___
### Self-hosting
diff --git a/src/components/About.tsx b/src/components/About.tsx
index fc611e8..2357761 100644
--- a/src/components/About.tsx
+++ b/src/components/About.tsx
@@ -30,6 +30,7 @@ export default function About({
}: {
setVisible: (show: boolean) => void;
}) {
+ const official = window.location.hostname === 'localhost';
const [showTos, setShowTos] = useState(false);
if (showTos) {
@@ -47,7 +48,7 @@ export default function About({
different take on conventional pastebin sites like pastebin.com or
hastebin.
- {window.location.hostname === 'pastes.dev' && (
+ {official && (
<>
pastes.dev is the official, publicly accessible paste
@@ -65,7 +66,10 @@ export default function About({
To access pastes.dev programmatically, please use the{' '}
-
+
API
. :)
@@ -141,7 +145,7 @@ const Tos = ({ setVisible }: { setVisible: (show: boolean) => void }) => {
abuse or violations of these terms.
- No Guarantees: This service is provided "as is" with no
+ No Liability: This service is provided "as is" with no
warranties. We do not guarantee uptime, data retention, or
availability.
@@ -150,11 +154,10 @@ const Tos = ({ setVisible }: { setVisible: (show: boolean) => void }) => {
By using pastes.dev, you accept these terms. If you do not agree, please
do not use the service.
+ Reporting Abuse
- Reporting Abuse
-
If you encounter illegal or malicious content, please report it by email
- to report-abuse {''} pastes.dev.
+ to report-abuse@pastes.dev.
);
@@ -173,6 +176,10 @@ const AboutPanel = styled.div`
color: ${props => props.theme.primary};
background-color: ${props => props.theme.secondary};
+
+ span {
+ color: ${props => props.theme.logo};
+ }
`;
const BannerContainer = styled.div`