diff --git a/src/cards/motivational-quote.js b/src/cards/motivational-quote.js index e774985..f28d02e 100644 --- a/src/cards/motivational-quote.js +++ b/src/cards/motivational-quote.js @@ -1,7 +1,12 @@ const express = require("express"); const router = express.Router(); const fs = require("fs").promises; -const { generateCard, CARD_AGE, generateHTMLCard, Languages } = require("../card-generator"); +const { + generateCard, + CARD_AGE, + generateHTMLCard, + Languages, +} = require("../card-generator"); const { parseOptions } = require("../options-parser"); const DATA_FILE_PATH = "./src/data/motivational_quotes.json"; @@ -27,20 +32,38 @@ router.get("/", handleTheme, handleOptions, async (req, res) => { let quote_card; // Custom theme moderation - if(req.theme === "skeleton") { + if (req.theme === "skeleton") { const html_content = `
${random_quote.quote} - ${random_quote.author}
`; + + // Generate card using custom HTML + quote_card = await generateHTMLCard(html_content, Languages.ENGLISH); + } else if (req.theme === "neon") { + const html_content = ` +
+
+ "${random_quote.quote}" + - ${random_quote.author} +
+
+
+ `; // Generate card using custom HTML quote_card = await generateHTMLCard(html_content, Languages.ENGLISH); - }else{ + } else { const quote_content = `${random_quote.quote}\n\n- ${random_quote.author}`; - quote_card = await generateCard(quote_content, req.theme, req.options, Languages.ENGLISH); + quote_card = await generateCard( + quote_content, + req.theme, + req.options, + Languages.ENGLISH + ); } - + res.writeHead(200, { "Content-Type": "image/svg+xml", "Cache-Control": `public, max-age=${CARD_AGE}`, diff --git a/src/help.js b/src/help.js index c557e04..7916bff 100644 --- a/src/help.js +++ b/src/help.js @@ -132,9 +132,9 @@ router.get("/", (req, res) => { info: "Random motivational quotes card", api: { args: { - theme: "Theme of card. All themes. Default: dark_2 [Optional]", + theme: "Theme of card. All themes. Default: dark_2 [Optional]. Additional themes: skeleton, neon", }, - example: [`${baseurl}/motivational-quotes-card`], + example: [`${baseurl}/motivational-quotes-card`, `${baseurl}/motivational-quotes-card?theme=neon`, `${baseurl}/motivational-quotes-card?theme=skeleton`], }, }, "word-of-the-day-card": {