summary refs log tree commit diff
path: root/cdn/README.md
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-12 20:17:41 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-12 20:17:41 +0200
commitaffd3b109282fa6077093658a7abca1d11be11f0 (patch)
tree4e7abc3b4fc4494e620e15e47538672060a76d78 /cdn/README.md
parent:bug: fix rabbit mq -> fanout instead of work queue (diff)
parent:sparkles: cdn (diff)
downloadserver-affd3b109282fa6077093658a7abca1d11be11f0.tar.xz
Merge branch 'master' into gateway
Diffstat (limited to '')
-rw-r--r--cdn/README.md89
1 files changed, 89 insertions, 0 deletions
diff --git a/cdn/README.md b/cdn/README.md
new file mode 100644

index 00000000..6cd6186a --- /dev/null +++ b/cdn/README.md
@@ -0,0 +1,89 @@ +# Fosscord-CDN +CDN for Fosscord + +## Run localy: +``` +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 + +body: +{"url": URL} // "https://discord.com" +``` +##### Returns: +``` +Content-Type: application/json + +{ + "id": string, // "aHR0cHM6Ly9kaXNjb3JkLmNvbQ==" + "ogTitle": string, // "Discord | Your Place to Talk and Hang Out" + "ogDescription": string, // "Discord is the easiest way to talk over voice, video, and text. Talk, chat, hang out, and stay close with your friends and communities." + "cachedImage": string, // "/external/aHR0cHM6Ly9kaXNjb3JkLmNvbQ==/discord.png" + "ogUrl": string, // "https://discord.com/" + "ogType": string // "website" +} +``` +### GET `/external/<id>/<filename>` +- requests cached crawled image +``` +url-params: + :id // aHR0cHM6Ly9kaXNjb3JkLmNvbQ== + :filename // discord.png +``` +``` +/external/aHR0cHM6Ly9kaXNjb3JkLmNvbQ==/discord.png +``` +##### Returns: +``` +Content-Type: image/<imageType(png,img,gif)> +Image +```