From a542a67e3ba2a5277bf442643f6ccf1776ef21fa Mon Sep 17 00:00:00 2001 From: Bingus_Violet Date: Sun, 7 Jan 2024 02:23:18 -0600 Subject: [PATCH] Yay --- index.js | 19 ++++++++++++++++--- resources/userPage.html | 3 ++- static/index.html | 17 +++++++++++++---- static/style.css | 25 +++++++++++++++++++++---- 4 files changed, 52 insertions(+), 12 deletions(-) diff --git a/index.js b/index.js index df70e45..b52441e 100644 --- a/index.js +++ b/index.js @@ -34,11 +34,12 @@ app.listen(PORT, () => { app.get('/embedCard', async (req, res) => { var discID = req.query.discordid + var server = 'https://' + (req.query.server || 'api.lanyard.rest') res.header("Content-Type", "text/html") var html = fs.readFileSync(path.join(__dirname, 'resources/embedCard.html')).toString() - var result = (await fetch(`https://api.lanyard.rest/v1/users/${discID}`).then(response => response.json())).data + var result = (await fetch(`${server}/v1/users/${discID}`).then(response => response.json())).data var user = result.discord_user @@ -75,11 +76,23 @@ app.get('/embedCard', async (req, res) => { app.get('/getUser', async (req, res) => { var discID = req.query.discordid + var server = 'https://' + (req.query.server || 'api.lanyard.rest') res.header("Content-Type", "text/html") var html = fs.readFileSync(path.join(__dirname, 'resources/userPage.html')).toString() - var data = (await fetch(`https://api.lanyard.rest/v1/users/${discID}`).then(response => response.json())) + try { + var data = (await fetch(`${server}/v1/users/${discID}`).then(response => response.json())) + } catch (error) { + res.send(` + +

Error!

+

Code: ${error}
+ Try clearing cache and trying again. +

+ `) + return + } var result = data.data @@ -102,7 +115,7 @@ app.get('/getUser', async (req, res) => { "USERNAME": user.username, "DISCORD_ID": user.id, "STATUS": user.discord_status, - "BASE_LINK": "https://code-server-production-d69b.up.railway.app/proxy/8080/" + "BASE_LINK": "localhost:8080/" } if (user.discriminator != 0) { diff --git a/resources/userPage.html b/resources/userPage.html index f56c8ad..461f17b 100644 --- a/resources/userPage.html +++ b/resources/userPage.html @@ -15,6 +15,7 @@

{DISPLAY_NAME}

{USERNAME}

-

Code to embed:
<iframe style="width: 90%; max-width: 750px; height: 300px;" src="{BASE_LINK}embedCard?discordid={DISCORD_ID}"></iframe>

+

Code to embed:
<iframe style="width: 90%; max-width: 750px; height: 300px;" src="{BASE_LINK}embedCard?discordid={DISCORD_ID}"></iframe>

+ Customize Card \ No newline at end of file diff --git a/static/index.html b/static/index.html index c91d6f9..1e3bc8e 100644 --- a/static/index.html +++ b/static/index.html @@ -11,11 +11,20 @@

Discord Embedder

+
- + + +
+ + +

+
- -

You can get your Discord ID by:

-

Lorem ipsum dolor sit amet consectetur, adipisicing elit. Aspernatur odio dolores reiciendis recusandae ad explicabo repellendus possimus dignissimos quam quo necessitatibus error excepturi cumque sapiente quos, autem obcaecati quidem enim.

+
+

Usage

+

To use Discord Embedder, first make sure you're in the corresponding Discord Server of one of our supported apis. Then, enable developer mode on discord, copy your ID, and paste it here! If you've set it all up correctly, you should be able to view your data!

\ No newline at end of file diff --git a/static/style.css b/static/style.css index 5d3b65a..5d17282 100644 --- a/static/style.css +++ b/static/style.css @@ -12,14 +12,31 @@ body, input { } input[type="text"] { - font-size: 1.5rem; - margin: 15vh auto; - padding: 15px; width: 90%; max-width: 500px; } -input { +form { + margin: 10px; +} + +input, select { + margin: 5px auto; + padding: 10px; + font-size: 1.25rem; background-color: black; + color: white; border: 2px gray solid; + border-radius: 10px; +} + +label { + font-size: 1.5rem; +} + +.code { + font-family: 'Source Code Pro'; + background-color: rgb(40, 40, 50); + display: block; + padding: 10px; } \ No newline at end of file