From 8ab1de35f7d6b2fead7ca8ca80e7ca41df327b98 Mon Sep 17 00:00:00 2001 From: Marcus Noble Date: Sun, 21 Mar 2021 14:23:47 +0000 Subject: [PATCH] Updated webpage --- index.html | 151 +++++++++++++++++++++++++++++++++++++++++++++++++++++ index.js | 19 +------ 2 files changed, 153 insertions(+), 17 deletions(-) create mode 100644 index.html diff --git a/index.html b/index.html new file mode 100644 index 0000000..c4dcc33 --- /dev/null +++ b/index.html @@ -0,0 +1,151 @@ + + + + + + + TwitterProfilePic + + + + + + + + + + + + + + + + + +
+

+ TwitterProfilePic + +

+ +
+ Get a twitter profile pic using a given handle +
+ +
+

Features

+ +
    +
  • Multiple image size support (currently supported: normal, bigger, mini, original, 200x200, 400x400)
  • +
  • JSON support using application/json content type header
  • +
  • Returns a default profile pic for unknown users
  • +
+
+ +
+
+
+ + + + +
+
+ +
+ + +
+
+ +
+ +
+

HTML

+ + Code: +

+<img src="https://twitter-profile-pic.cluster.fun/marcus_noble_?size=200x200" />
+      
+ + Result:
+ +
+ +
+

JSON

+ + cURL Request: +

+curl -X GET \
+  https://twitter-profile-pic.cluster.fun/marcus_noble_ \
+  -H 'cache-control: no-cache' \
+  -H 'content-type: application/json'
+      
+ + Result: +

+{
+    "normal": "https://pbs.twimg.com/profile_images/776738772759277569/hfaM5zhA_normal.jpg",
+    "bigger": "https://pbs.twimg.com/profile_images/776738772759277569/hfaM5zhA_bigger.jpg",
+    "mini": "https://pbs.twimg.com/profile_images/776738772759277569/hfaM5zhA_mini.jpg",
+    "original": "https://pbs.twimg.com/profile_images/776738772759277569/hfaM5zhA.jpg",
+    "200x200": "https://pbs.twimg.com/profile_images/776738772759277569/hfaM5zhA_200x200.jpg",
+    "400x400": "https://pbs.twimg.com/profile_images/776738772759277569/hfaM5zhA_400x400.jpg"
+}
+      
+ +
+ +
+ +
+ Source code available on GitHub, GitLab, Bitbucket & my own Gitea server. +
+
+ +
+
+
+ +
+
+
+ + + + diff --git a/index.js b/index.js index 29f8ba8..6377396 100644 --- a/index.js +++ b/index.js @@ -25,23 +25,8 @@ const handleResponse = (profileURLs, req, res) => { server.use(restify.plugins.queryParser()); server.get(/^(\/|\/index.html)$/, function(req, res) { - fs.readFile(`${__dirname}/README.md`, { encoding: 'utf8' }, (err, data) => { - return res.sendRaw(` - - - Twitter-Profile-Pic - - - - - ${md.makeHtml(data)} - - `); + fs.readFile(`${__dirname}/index.html`, { encoding: 'utf8' }, (err, data) => { + return res.sendRaw(data); }); });