Compare commits
5 commits
Author | SHA1 | Date | |
---|---|---|---|
|
8906b82751 | ||
|
c222b50cbd | ||
|
1b6346f1b3 | ||
|
e31eebc844 | ||
|
8063fd6680 |
7 changed files with 9836 additions and 2023 deletions
|
@ -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
|
||||
|
@ -113,7 +112,6 @@ function metaForUser(user) {
|
|||
async function itemsForFeed(opts,user,feed) {
|
||||
|
||||
let items = feed.orderedItems;
|
||||
|
||||
if (opts.boosts){
|
||||
// yes, I have to fetch all the fucking boosts for this whole feed apparently >:/
|
||||
let boostData = [];
|
||||
|
@ -178,6 +176,7 @@ async function itemsForFeed(opts,user,feed) {
|
|||
|
||||
let op = item._userdata?item._userdata:user;
|
||||
|
||||
|
||||
return {
|
||||
isBoost:!!item._userdata,
|
||||
title:item._userdata?user.preferredUsername+" shared a status by "+op.preferredUsername:"",
|
||||
|
|
15
lib/emoji.js
Normal file
15
lib/emoji.js
Normal file
|
@ -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");
|
|
@ -72,7 +72,17 @@
|
|||
<input type="checkbox" class="showmore" id="<%- cwId %>">
|
||||
<label class="button" for="<%- cwId %>">Show</label>
|
||||
<% } %>
|
||||
|
||||
<!--
|
||||
Ok so this is so fucked but basically, this matches a status with the regex expression (to capture text between two colons) and
|
||||
needs to take the matched text and search the instances emoji pack for the value and replace it in item content.
|
||||
I tested this and it _does not_ alter posts without emojis.
|
||||
-->
|
||||
<% let regexp = /s*(?<=:).+?(?=:)s*/;
|
||||
let postWithEmoji = item.content;
|
||||
let emoteName = postWithEmoji.match(regexp);
|
||||
<!--If a post with matching regex for :whatever: is found replace with img tag for the instance's emoji packs-->
|
||||
item.content = postWithEmoji.replace(regexp, `<img src=https://freecumextremist.com/emoji/emojos/${emoteName}.jpg width='30' height='30'/>`)
|
||||
%>
|
||||
<div class="item-content">
|
||||
<%- item.content %>
|
||||
</div>
|
||||
|
|
7617
package-lock.json
generated
Normal file
7617
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -67,7 +67,7 @@
|
|||
<h3>Live Preview:</h3>
|
||||
<span class="iframe-contain">
|
||||
<iframe id="frame" allowfullscreen sandbox="allow-top-navigation allow-scripts" width="400" height="800"
|
||||
src="/api/v1/feed?userurl=https%3A%2F%2Fmastodon.social%2Fusers%2Fgargron&replies=false&boosts=true">></iframe>
|
||||
src="/api/v1/feed?userurl=https%3A%2F%2Ffreecumextremist.com%2Fusers%2Fgrumbulon&replies=false&boosts=true">></iframe>
|
||||
</span>
|
||||
<br>
|
||||
</div>
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
Reference in a new issue