Merge branch 'main' of https://github.com/discord-open-source/discord-cdn into main
This commit is contained in:
commit
9955183fa1
63
README.md
63
README.md
@ -1,19 +1,68 @@
|
|||||||
# Discord-CDN
|
# Discord-CDN
|
||||||
cdn for discord clone
|
cdn for discord clone
|
||||||
|
|
||||||
## Endpoints:
|
## Run localy:
|
||||||
|
|
||||||
### `/external`
|
|
||||||
#### POST
|
|
||||||
```
|
```
|
||||||
|
npm i
|
||||||
|
node dist/
|
||||||
|
```
|
||||||
|
|
||||||
|
## Endpoints:
|
||||||
|
### POST `/attachments/<filename>`
|
||||||
|
```
|
||||||
|
Content-Type: form-data
|
||||||
|
|
||||||
|
attachment: File (binary-data)
|
||||||
|
```
|
||||||
|
##### Returns:
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"success": boolean, // true
|
||||||
|
"message": string, // "attachment uploaded"
|
||||||
|
"id": snowflake, // "794183329158135808"
|
||||||
|
"filename": string // "lakdoiauej.png"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
### GET `/attachments/<id>/<filename>`
|
||||||
|
```
|
||||||
|
requests image from database with given <id> and <filename>
|
||||||
|
```
|
||||||
|
##### Returns:
|
||||||
|
```
|
||||||
|
Content-Type: image/<imageType(png,img,gif)>
|
||||||
|
Image
|
||||||
|
```
|
||||||
|
### DELETE `/attachments/<id>/<filename>`
|
||||||
|
```
|
||||||
|
deletes database entry
|
||||||
|
```
|
||||||
|
##### Returns:
|
||||||
|
```
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"message": "attachment deleted"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
_(endpoints for crawler):_
|
||||||
|
### POST `/external`
|
||||||
|
|
||||||
|
```
|
||||||
|
requests crawling of `og:`metadata and the download of the `og:image` property
|
||||||
|
--------
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
|
||||||
body:
|
body:
|
||||||
{"url": URL} // "https://discord.com"
|
{"url": URL} // "https://discord.com"
|
||||||
```
|
```
|
||||||
##### Returns:
|
##### Returns:
|
||||||
|
```
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
```ts
|
|
||||||
{
|
{
|
||||||
"id": string, // "aHR0cHM6Ly9kaXNjb3JkLmNvbQ=="
|
"id": string, // "aHR0cHM6Ly9kaXNjb3JkLmNvbQ=="
|
||||||
"ogTitle": string, // "Discord | Your Place to Talk and Hang Out"
|
"ogTitle": string, // "Discord | Your Place to Talk and Hang Out"
|
||||||
@ -23,8 +72,8 @@ Content-Type: application/json
|
|||||||
"ogType": string // "website"
|
"ogType": string // "website"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
### `/external/<id>/<filename>`
|
### GET `/external/<id>/<filename>`
|
||||||
#### GET
|
- requests cached crawled image
|
||||||
```
|
```
|
||||||
url-params:
|
url-params:
|
||||||
:id // aHR0cHM6Ly9kaXNjb3JkLmNvbQ==
|
:id // aHR0cHM6Ly9kaXNjb3JkLmNvbQ==
|
||||||
|
Loading…
x
Reference in New Issue
Block a user