From afe37fa0b34610c6f179a9b184a5d0e2a7c836fd Mon Sep 17 00:00:00 2001 From: Nicholas Jitkoff Date: Sat, 11 Feb 2023 16:52:17 -0700 Subject: [PATCH] Delete index.js --- functions/index.js | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 functions/index.js diff --git a/functions/index.js b/functions/index.js deleted file mode 100644 index 7736bb7..0000000 --- a/functions/index.js +++ /dev/null @@ -1,37 +0,0 @@ -const functions = require("firebase-functions"); - -exports.index = functions.https.onRequest((request, response) => { - functions.logger.info("Hello logs!", ); - const agent = request.headers["user-agent"]; - let path = request.path; - if (agent.indexOf("Twitterbot") != -1 || agent.indexOf("facebookexternalhit") != -1 || agent.indexOf("Slackbot-LinkExpanding") != -1 || agent.indexOf("Discordbot") != -1) { - let components = path.split("/"); - components.shift(); - components.pop(); - let title = decodeURIComponent(components.shift()).replace("_", " "); - let desc = decodeURIComponent(components.shift()).replace("_", " "); - let image = decodeURIComponent(components.join("/")); - console.log("components", title, desc, image) - - let content = ""; - if (title) content += `${title}`; - if (desc && desc.length > 1) content += ``; - if (image) { - if (image.startsWith("http")) { - content += ``; - } else { - image = decodeURIComponent(image) - console.log("image", image); - let codepoints = []; - for (const char of image) { - codepoints.push(char.codePointAt(0).toString(16)); - } - content += `` - } - } - response.send(content); - } else { - response.redirect("/?" + path); - } - -}); \ No newline at end of file