diff options
author | xnacly <matteogropp@gmail.com> | 2020-12-31 13:58:20 +0100 |
---|---|---|
committer | xnacly <matteogropp@gmail.com> | 2020-12-31 13:58:20 +0100 |
commit | 9955183fa1fb50b9b6167bf844c1bc3e1e255723 (patch) | |
tree | fea18173d3c7bb715ab0ec1f00443e9ac402670b | |
parent | dist dir (diff) | |
parent | Update README.md (diff) | |
download | server-9955183fa1fb50b9b6167bf844c1bc3e1e255723.tar.xz |
Merge branch 'main' of https://github.com/discord-open-source/discord-cdn into main
-rw-r--r-- | README.md | 59 |
1 files changed, 54 insertions, 5 deletions
diff --git a/README.md b/README.md index 68cc50da..d34bd264 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,68 @@ # Discord-CDN cdn for discord clone +## Run localy: +``` +npm i +node dist/ +``` + ## Endpoints: +### POST `/attachments/<filename>` +``` +Content-Type: form-data -### `/external` -#### POST +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 + body: {"url": URL} // "https://discord.com" ``` ##### Returns: +``` Content-Type: application/json -```ts + { "id": string, // "aHR0cHM6Ly9kaXNjb3JkLmNvbQ==" "ogTitle": string, // "Discord | Your Place to Talk and Hang Out" @@ -23,8 +72,8 @@ Content-Type: application/json "ogType": string // "website" } ``` -### `/external/<id>/<filename>` -#### GET +### GET `/external/<id>/<filename>` +- requests cached crawled image ``` url-params: :id // aHR0cHM6Ly9kaXNjb3JkLmNvbQ== |