diff --git a/lib/convert.js b/lib/convert.js index 49073a1..df510e9 100644 --- a/lib/convert.js +++ b/lib/convert.js @@ -12,7 +12,6 @@ const hour = 3600000; // note: rejects on HTTP 4xx or 5xx async function apGet(url) { - return new Promise(function(resolve,reject){ // fail early diff --git a/lib/emoji.js b/lib/emoji.js new file mode 100644 index 0000000..3d54ea2 --- /dev/null +++ b/lib/emoji.js @@ -0,0 +1,15 @@ +import axios from "axios"; +import fs from "fs"; + +//Grab emote list so when rendering +export default function getEmojiJson(url) { + let emojiUrl = "https://" + url + "/api/v1/custom_emojis"; + axios + .get(emojiUrl) + .then(res => { + console.log(`statusCode: ${res.status}`); + const emojiJson = res.data; + console.log(emojiJson); + }); +} +getEmojiJson("freecumextremist.com"); \ No newline at end of file diff --git a/lib/template.ejs b/lib/template.ejs index 815e91d..8150f46 100644 --- a/lib/template.ejs +++ b/lib/template.ejs @@ -79,9 +79,9 @@ --> <% let regexp = /s*(?<=:).+?(?=:)s*/; let postWithEmoji = item.content; + let emoteName = postWithEmoji.match(regexp); - item.content = postWithEmoji.replace(regexp, "") - console.log(item.content); + item.content = postWithEmoji.replace(regexp, ``) %>
<%- item.content %> diff --git a/src/public/js/script.js b/src/public/js/script.js index ae1008b..2c2c244 100644 --- a/src/public/js/script.js +++ b/src/public/js/script.js @@ -1,8 +1,11 @@ +import getEmojiJson from "./emojis.js"; + window.genUrl = function genUrl() { function val(id) { return document.getElementById(id).value; } - + //download emoji pack + getEmojiJson(val("urlin")); let user = val("usernamein"); let instance = "https://" + val("urlin");