From f1d63918efe1559137e14ee1252bf19152d4925e Mon Sep 17 00:00:00 2001 From: xnacly Date: Thu, 31 Dec 2020 13:54:40 +0100 Subject: [PATCH 1/4] Update README.md --- README.md | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 68cc50da..ec28d6d5 100644 --- a/README.md +++ b/README.md @@ -2,18 +2,64 @@ cdn for discord clone ## Endpoints: +### `/attachments/` +#### POST +``` +Content-Type: form-data +attachment: File +``` +##### Returns: +``` +{ + "success": boolean, // true + "message": string, // "attachment uploaded" + "id": snowflake, // "794183329158135808" + "filename": string // "lakdoiauej.png" +} +``` +### `/attachments//` +#### GET +``` +requests image from database with given and +``` +##### Returns: +``` +Content-Type: image/ +Image +``` +### `/attachments//` +#### DELETE +``` +deletes database entry +``` +##### Returns: +``` +Content-Type: application/json + +{ + "success": true, + "message": "attachment deleted" +} +``` + +
+ +_(endpoints for crawler):_ ### `/external` #### POST ``` +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" @@ -25,6 +71,7 @@ Content-Type: application/json ``` ### `/external//` #### GET +- requests cached crawled image ``` url-params: :id // aHR0cHM6Ly9kaXNjb3JkLmNvbQ== From b9d40cbca0c91fd3f42d42a47496e0f16e5ebe38 Mon Sep 17 00:00:00 2001 From: xnacly Date: Thu, 31 Dec 2020 13:55:28 +0100 Subject: [PATCH 2/4] Update README.md --- README.md | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index ec28d6d5..491db0c0 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,7 @@ cdn for discord clone ## Endpoints: -### `/attachments/` -#### POST +### POST `/attachments/` ``` Content-Type: form-data @@ -18,8 +17,7 @@ attachment: File "filename": string // "lakdoiauej.png" } ``` -### `/attachments//` -#### GET +### GET `/attachments//` ``` requests image from database with given and ``` @@ -28,8 +26,7 @@ requests image from database with given and Content-Type: image/ Image ``` -### `/attachments//` -#### DELETE +### DELETE `/attachments//` ``` deletes database entry ``` @@ -46,8 +43,8 @@ Content-Type: application/json
_(endpoints for crawler):_ -### `/external` -#### POST +### POST `/external` + ``` requests crawling of `og:`metadata and the download of the `og:image` property -------- @@ -69,8 +66,7 @@ Content-Type: application/json "ogType": string // "website" } ``` -### `/external//` -#### GET +### GET `/external//` - requests cached crawled image ``` url-params: From f971d83785ff0bf31568aaa3ba955c4df012216e Mon Sep 17 00:00:00 2001 From: xnacly Date: Thu, 31 Dec 2020 13:56:35 +0100 Subject: [PATCH 3/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 491db0c0..9747e175 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ cdn for discord clone ``` Content-Type: form-data -attachment: File +attachment: File (binary-data) ``` ##### Returns: ``` From 2e4e7b826d3a5b2eeaa7e12c188dbf2393221093 Mon Sep 17 00:00:00 2001 From: xnacly Date: Thu, 31 Dec 2020 13:57:48 +0100 Subject: [PATCH 4/4] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 9747e175..d34bd264 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,12 @@ # Discord-CDN cdn for discord clone +## Run localy: +``` +npm i +node dist/ +``` + ## Endpoints: ### POST `/attachments/` ```