From ae5df582f5afc2916d45dd563ee7ec92c3537b74 Mon Sep 17 00:00:00 2001 From: Zohan Subhash Date: Fri, 10 Feb 2023 05:43:27 +0530 Subject: [PATCH 01/10] Update vercel.json --- vercel.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vercel.json b/vercel.json index 33d8629..4d58852 100644 --- a/vercel.json +++ b/vercel.json @@ -1,6 +1,6 @@ { "builds": [{ "src": "index.js", - "use": "@now/node-server" + "use": "@vercel/node-server" }] } From 58ec543cc3e786ea94f7c10075906267effaed5b Mon Sep 17 00:00:00 2001 From: Zohan Subhash Date: Fri, 10 Feb 2023 05:49:14 +0530 Subject: [PATCH 02/10] Update vercel.json --- vercel.json | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/vercel.json b/vercel.json index 4d58852..af87ecc 100644 --- a/vercel.json +++ b/vercel.json @@ -1,6 +1,13 @@ { + "version": 2, "builds": [{ "src": "index.js", - "use": "@vercel/node-server" - }] + "use": "@now/node-server" + }], + "routes": [ + { + "src": "/(.*)", + "dest": "index.js" + } + ] } From 6d15c70bae4cf99fd87ced790f291cc02796dd48 Mon Sep 17 00:00:00 2001 From: Zohan Subhash Date: Fri, 10 Feb 2023 05:50:54 +0530 Subject: [PATCH 03/10] Update vercel.json --- vercel.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vercel.json b/vercel.json index af87ecc..d75206a 100644 --- a/vercel.json +++ b/vercel.json @@ -2,7 +2,7 @@ "version": 2, "builds": [{ "src": "index.js", - "use": "@now/node-server" + "use": "@vercel/node" }], "routes": [ { From 7e538ab08ca5aa36c712794410e7b5d384785294 Mon Sep 17 00:00:00 2001 From: Zohan Subhash Date: Fri, 10 Feb 2023 05:57:41 +0530 Subject: [PATCH 04/10] Update index.js --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 60a46b7..efbc5cb 100644 --- a/index.js +++ b/index.js @@ -5,7 +5,7 @@ const StackOverflowCard = require('./src/StackOverflowCard'); http.createServer(async (req, res) => { const reqURL = url.parse(req.url, true); - const { userID, theme = 'light', layout = 'default' } = reqURL.query; + const { userID, theme = 'light', layout = 'default', site = 'stackoverflow' } = reqURL.query; if (!userID) { res.write(JSON.stringify({error: 'Add your StackOverflow userID as query string'})); @@ -13,7 +13,7 @@ http.createServer(async (req, res) => { return; } - const responseArticles = await fetch(`https://api.stackexchange.com/2.2/users/${userID}?site=stackoverflow&filter=!--1nZv)deGu1`); + const responseArticles = await fetch(`https://api.stackexchange.com/2.2/users/${userID}?site=${site}&filter=!--1nZv)deGu1`); const json = await responseArticles.json(); if (!json.items || json.items.length === 0) { @@ -33,4 +33,4 @@ http.createServer(async (req, res) => { res.end(); }).listen(process.env.PORT || 3000, function(){ console.log("server start at port 3000"); -}); \ No newline at end of file +}); From fa2062769e1be1073926b88977ebdd41d2fc6f0f Mon Sep 17 00:00:00 2001 From: Zohan Subhash Date: Fri, 10 Feb 2023 06:00:30 +0530 Subject: [PATCH 05/10] Update index.js --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index efbc5cb..425b4fb 100644 --- a/index.js +++ b/index.js @@ -17,7 +17,7 @@ http.createServer(async (req, res) => { const json = await responseArticles.json(); if (!json.items || json.items.length === 0) { - res.write(JSON.stringify({error: 'Your stackoverflow userID is not correct'})); + res.write(JSON.stringify({error: 'Your userID/site is not valid'})); res.end(); return; } From 7fa768b222c471f1b13a9c274faeff044d1ef40c Mon Sep 17 00:00:00 2001 From: Zohan Subhash Date: Fri, 10 Feb 2023 06:05:51 +0530 Subject: [PATCH 06/10] Update README.md --- README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4dc9064..eb3cbc2 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,17 @@ If you want to have a compact layout, just you need to add `layout=compact` as a [![Omid Nikrah StackOverflow](https://github-readme-stackoverflow.vercel.app/?userID=6558042&layout=compact)](https://stackoverflow.com/users/6558042/omid-nikrah) [![Omid Nikrah StackOverflow](https://github-readme-stackoverflow.vercel.app/?userID=6558042&layout=compact&theme=dark)](https://stackoverflow.com/users/6558042/omid-nikrah) +#### Other Sites + +You can use other StackExchange sites instead of StackOverflow too, such as Biology StackExchange or AskUbuntu. Just add `site={SITE}` as a parameter. Examples: +- `site=biology` +- `site=askubuntu` +- `site=money` + +The site name provided as a parameter must be the same as the domain for that site. For example, Personal Finance and Money StackExchange has a URL of `money.stackexchange.com`, so `site=money` must be provided. + +> **Warning** +> Different sites have different userIDs. So your StackOverflow userID will not be the same as your Biology StackExchange userID.
@@ -36,13 +47,15 @@ If you want to have a compact layout, just you need to add `layout=compact` as a | ---------- | ------------------------------- | -------------------------- | | userID | Your StackOverflow userID | REQUIRED | | theme | Theme of the StackOverflow card (light or dark) | light | -| layout | Layout of the StackOverflow card (compact or default) | default | +| layout | Layout of the StackOverflow card (compact or default) | default | +| site | Which StackExchange site to get the data from | stackoverflow |
## Contributors - [Omid Nikrah](https://github.com/omidnikrah) - [Soroush Chehresa](https://github.com/soroushchehresa) +- [Zohan Subhash](https://github.com/Zo-Bro-23)
From 6a537010d4056c2b385bffac3a90be2d6543bbb8 Mon Sep 17 00:00:00 2001 From: Zohan Subhash Date: Fri, 10 Feb 2023 06:09:23 +0530 Subject: [PATCH 07/10] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index eb3cbc2..4e998ab 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Copy paste following markdown into your markdown content, and that's it. Easy Easy Tammam Tammam! -Change the `?userID=` value to your StackOverflow's userID. +Change the `?userID=` value to your StackExchange userID (for the relevant site). ```md [![Omid Nikrah StackOverflow](https://github-readme-stackoverflow.vercel.app/?userID=6558042)](https://stackoverflow.com/users/6558042/omid-nikrah) @@ -45,7 +45,7 @@ The site name provided as a parameter must be the same as the domain for that si ## Options | Name | Description | Default value | | ---------- | ------------------------------- | -------------------------- | -| userID | Your StackOverflow userID | REQUIRED | +| userID | Your StackExchange userID | REQUIRED | | theme | Theme of the StackOverflow card (light or dark) | light | | layout | Layout of the StackOverflow card (compact or default) | default | | site | Which StackExchange site to get the data from | stackoverflow | From c3b49231624c6577e2a9e41201a72ca276aaf105 Mon Sep 17 00:00:00 2001 From: Zohan Subhash Date: Fri, 10 Feb 2023 06:10:35 +0530 Subject: [PATCH 08/10] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 4e998ab..5c0c403 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,9 @@ The site name provided as a parameter must be the same as the domain for that si > **Warning** > Different sites have different userIDs. So your StackOverflow userID will not be the same as your Biology StackExchange userID. +[![Zohan Subhash Biology.SE](https://github-readme-stackoverflow.vercel.app/?userID=68669&site=biology)](https://biology.stackexchange.com/users/68669/zo-bro-23) +[![Zohan Subhash Biology.SE](https://github-readme-stackoverflow.vercel.app/?userID=68669&theme=dark&site=biology)](https://biology.stackexchange.com/users/68669/zo-bro-23) +
## Options From e3545825b867a811c8ea3df2a42a6d79930069ef Mon Sep 17 00:00:00 2001 From: Zohan Subhash Date: Fri, 10 Feb 2023 06:10:58 +0530 Subject: [PATCH 09/10] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5c0c403..e3c7eed 100644 --- a/README.md +++ b/README.md @@ -40,8 +40,8 @@ The site name provided as a parameter must be the same as the domain for that si > **Warning** > Different sites have different userIDs. So your StackOverflow userID will not be the same as your Biology StackExchange userID. -[![Zohan Subhash Biology.SE](https://github-readme-stackoverflow.vercel.app/?userID=68669&site=biology)](https://biology.stackexchange.com/users/68669/zo-bro-23) -[![Zohan Subhash Biology.SE](https://github-readme-stackoverflow.vercel.app/?userID=68669&theme=dark&site=biology)](https://biology.stackexchange.com/users/68669/zo-bro-23) +[![Zohan Subhash Biology.SE](https://github-readme-stackoverflow.zohan.tech/?userID=68669&site=biology)](https://biology.stackexchange.com/users/68669/zo-bro-23) +[![Zohan Subhash Biology.SE](https://github-readme-stackoverflow.zohan.tech/?userID=68669&theme=dark&site=biology)](https://biology.stackexchange.com/users/68669/zo-bro-23)
From 9bd00de6e5393ee2e573353d8fc506537fc5672b Mon Sep 17 00:00:00 2001 From: Zohan Subhash Date: Sat, 11 Feb 2023 07:25:08 +0530 Subject: [PATCH 10/10] =?UTF-8?q?Added=20J=C3=A9f=20Bueno=20as=20a=20contr?= =?UTF-8?q?ibutor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: jfbueno --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e3c7eed..26d364d 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ The site name provided as a parameter must be the same as the domain for that si - [Omid Nikrah](https://github.com/omidnikrah) - [Soroush Chehresa](https://github.com/soroushchehresa) - [Zohan Subhash](https://github.com/Zo-Bro-23) +- [Jéf Bueno](https://github.com/jfbueno)