mirror of
https://github.com/Ry3yr/Fake-Social-MediaWriter.git
synced 2026-08-19 17:20:03 -04:00
454 lines
18 KiB
Plaintext
454 lines
18 KiB
Plaintext
|
|
<!---Twitter-esque--aesthetic-->
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
margin: 0;
|
|
padding: 20px;
|
|
}
|
|
|
|
.post {
|
|
background-color: white;
|
|
border: 1px solid #ccd6dd;
|
|
border-radius: 8px;
|
|
padding: 15px;
|
|
margin-bottom: 20px;
|
|
max-width: 600px;
|
|
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
|
|
}
|
|
|
|
.post img {
|
|
border-radius: 5%;
|
|
vertical-align: middle;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.post a {
|
|
color: #1da1f2;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.post a:hover {
|
|
text-decoration: underline;
|
|
}
|
|
|
|
.post p {
|
|
margin: 10px 0;
|
|
color: #14171a;
|
|
font-size: 15px;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
.btn, .btn2 {
|
|
background-color: #1da1f2;
|
|
color: white;
|
|
border: none;
|
|
padding: 8px 12px;
|
|
border-radius: 9999px;
|
|
cursor: pointer;
|
|
margin-right: 10px;
|
|
font-size: 14px;
|
|
margin-top: 10px;
|
|
text-decoration: none;
|
|
display: inline-block;
|
|
}
|
|
|
|
.btn2 {
|
|
background-color: #657786;
|
|
}
|
|
|
|
.btn:hover, .btn2:hover {
|
|
opacity: 0.9;
|
|
}
|
|
|
|
.post iframe {
|
|
margin-top: 10px;
|
|
border-radius: 8px;
|
|
}
|
|
|
|
blockquote {
|
|
border-left: 4px solid #657786;
|
|
background-color: #f5f8fa;
|
|
padding: 10px;
|
|
margin: 10px 0;
|
|
font-style: italic;
|
|
color: #657786;
|
|
}
|
|
</style>
|
|
|
|
<script src="other/extra/scripts/libraries/crypto-js.min.js"></script>
|
|
|
|
|
|
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
</head>
|
|
<body>
|
|
<div id="errorLog"></div>
|
|
<div id="jsonloaded"></div>
|
|
<!--Search-->
|
|
<form action="/other/extra/scripts/fakesocialmedia/commentload.html" method="get" target="_blank">
|
|
<input type="text" id="keyword" name="text" required>
|
|
<input type="hidden" name="number" value="4000">
|
|
<button type="submit">Search</button>
|
|
</form>
|
|
<div id="containerfakesocialmedia"></div>
|
|
|
|
<script>
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
const limit = urlParams.get("limit") || "15";
|
|
const baseurl = "https://alcea-wisteria.de/z_files/emoji";
|
|
const errorLogDiv = document.getElementById('errorLog');
|
|
|
|
function getQueryParam(param) {
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
return urlParams.get(param);
|
|
}
|
|
|
|
function logError(message) {
|
|
const errorMessage = document.createElement('p');
|
|
errorMessage.textContent = message;
|
|
errorLogDiv.appendChild(errorMessage);
|
|
|
|
const fixLink = document.createElement('a');
|
|
fixLink.textContent = 'Fix!';
|
|
fixLink.target = '_blank';
|
|
fixLink.href = '/other/extra/scripts/fakesocialmedia/fix.php';
|
|
fixLink.style.color = 'blue';
|
|
errorLogDiv.appendChild(fixLink);
|
|
}
|
|
|
|
let all = "";
|
|
const url = new URL(window.location.href);
|
|
if (url.searchParams.get("all") === "yes") {
|
|
all = "";
|
|
} else {
|
|
all = "_part";
|
|
}
|
|
|
|
const user = getQueryParam('user');
|
|
if (user) {
|
|
const jsonFile = `/other/extra/scripts/fakesocialmedia/data${all}_${user}.json?t=${Date.now()}`;
|
|
console.log(jsonFile);
|
|
let myDiv = document.getElementById("jsonloaded");
|
|
myDiv.textContent = jsonFile;
|
|
fetch(jsonFile)
|
|
.then(response => response.text())
|
|
.then(text => {
|
|
try {
|
|
const jsonData = JSON.parse(text);
|
|
const containerfakesocialmedia = document.getElementById('containerfakesocialmedia');
|
|
jsonData.slice(0, limit).forEach(obj => {
|
|
const date = Object.keys(obj)[0];
|
|
const innerObj = obj[date];
|
|
const value = innerObj.value;
|
|
const hashtags = innerObj.hashtags;
|
|
const postElement = document.createElement('div');
|
|
postElement.classList.add('post');
|
|
const dateElement = document.createElement('p');
|
|
dateElement.innerHTML = `<hr>Date: ${date}`;
|
|
const valueElement = document.createElement('p');
|
|
const valueWithoutQuotes = value.replace(/𒐫[\s\S]*?𒐫/g, ''); // Removes 𒐫...𒐫 block
|
|
valueElement.innerHTML = `<img src=https://alcea-wisteria.de/z_files/emoji/${user}.png width=100px><br>@<a target="_blank" href="/fakesocialrender_limited.html?user=${user}" style="color:pink">${user}</a>: ${replaceEmojis(valueWithoutQuotes).replace(/(https?:\/\/[^\s]+)/g, (match) => {
|
|
if (match.includes('pixiv.net')) {
|
|
const pixivRegex = /https?:\/\/(?:www\.)?pixiv\.net\/(?:en\/)?artworks\/(\d+)/;
|
|
const pixivMatch = match.match(pixivRegex);
|
|
if (pixivMatch) {
|
|
const artworkId = pixivMatch[1];
|
|
return `<div><img src="https://embed.pixiv.net/decorate.php?illust_id=${artworkId}&mode=sns-automator" width="50%"></div><br><a href="${match}" target="_blank">${match}</a>`;
|
|
}
|
|
}
|
|
if (match.endsWith('.gif') || match.endsWith('.png') || match.endsWith('.webp') ||match.endsWith('.jpg') || match.endsWith('.jpeg')) {
|
|
let imageWidth = "50%";
|
|
if (match.includes("emoji")) {
|
|
imageWidth = "45px";
|
|
}
|
|
const imageElement = `<img src="${match}" width="${imageWidth}" alt="${match}">`;
|
|
if (match.includes(`${baseurl}`)) {
|
|
return imageElement;
|
|
} else {
|
|
return `${imageElement}<br><a href="${match}" target="_blank">${match}</a>`;
|
|
}
|
|
}
|
|
return `<a href="${match}" target="_blank">${match}</a>`;
|
|
}).replace(/\n/g, '<br>')}`;
|
|
const hashtagsElement = document.createElement('p');
|
|
hashtagsElement.textContent = `Hashtags: ${hashtags}`;
|
|
postElement.appendChild(dateElement);
|
|
postElement.appendChild(valueElement);
|
|
|
|
//quote function
|
|
const quoteRegex = /𒐫([\s\S]*?)𒐫/g; // Updated regex to support multiline matching
|
|
let match;
|
|
while ((match = quoteRegex.exec(value)) !== null) {
|
|
const quoteBlock = document.createElement('div');
|
|
quoteBlock.style.borderLeft = '4px solid #ccc';
|
|
quoteBlock.style.padding = '10px';
|
|
quoteBlock.style.backgroundColor = '#f9f9f9';
|
|
const formattedQuote = match[1].replace(/\n/g, '<br>');
|
|
quoteBlock.innerHTML = formattedQuote.trim();
|
|
postElement.appendChild(quoteBlock);
|
|
}
|
|
|
|
|
|
//link2acws-akkoma
|
|
if (value.includes("•acws")) {
|
|
function safeFetchJson(url) {
|
|
return fetch(url, { cache: "no-store" })
|
|
.then(res => res.json())
|
|
.catch(() => null);
|
|
}
|
|
function normalizeLineBreaks(str) {
|
|
return str.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
|
|
}
|
|
function normalizeText(str) {
|
|
return normalizeLineBreaks(str).normalize('NFC').trim();
|
|
}
|
|
function removeLineBreaks(str) {
|
|
return normalizeText(str).replace(/\n/g, '');
|
|
}
|
|
Promise.all([
|
|
safeFetchJson("/other/extra/scripts/fakesocialmedia/0ld/data_akkoma.json")
|
|
])
|
|
.then(([akkomaData]) => {
|
|
if (!akkomaData) throw new Error("JSON parse failure");
|
|
let matchedUrl = null;
|
|
let matchedPreview = null;
|
|
let matchType = null; // 'raw', 'normalized', 'noBreaks', 'loose'
|
|
const rawValue = value;
|
|
const normValue = normalizeText(value);
|
|
const noBreaksValue = removeLineBreaks(value);
|
|
for (const akkoma of akkomaData) {
|
|
if (!akkoma.preview) continue;
|
|
const rawPreview = akkoma.preview;
|
|
const normPreview = normalizeText(rawPreview);
|
|
const noBreaksPreview = removeLineBreaks(rawPreview);
|
|
if (rawValue.startsWith(rawPreview)) {
|
|
matchedUrl = akkoma.url;
|
|
matchedPreview = rawPreview;
|
|
matchType = 'raw';
|
|
break;
|
|
}
|
|
if (normValue.startsWith(normPreview)) {
|
|
matchedUrl = akkoma.url;
|
|
matchedPreview = rawPreview;
|
|
matchType = 'normalized';
|
|
break;
|
|
}
|
|
if (noBreaksValue.startsWith(noBreaksPreview)) {
|
|
matchedUrl = akkoma.url;
|
|
matchedPreview = rawPreview;
|
|
matchType = 'noBreaks';
|
|
break;
|
|
}
|
|
const maxOffset = 30;
|
|
const indexInNorm = normValue.indexOf(normPreview);
|
|
if (indexInNorm >= 0 && indexInNorm <= maxOffset) {
|
|
matchedUrl = akkoma.url;
|
|
matchedPreview = rawPreview;
|
|
matchType = 'loose';
|
|
break;
|
|
}
|
|
}
|
|
if (matchedUrl) {
|
|
const container = document.createElement('span');
|
|
const link = document.createElement('a');
|
|
link.target = "_blank";
|
|
link.classList.add('btn2');
|
|
link.href = matchedUrl;
|
|
link.textContent = "Permalink (match found)";
|
|
const proof = document.createElement('div');
|
|
proof.style.fontSize = '0em';
|
|
proof.style.marginTop = '0px';
|
|
if (matchType === 'raw') {
|
|
proof.style.color = 'green';
|
|
proof.textContent = `✔ Match found on first try (raw):
|
|
Preview: "${matchedPreview}"
|
|
Post value: "${value.slice(0, matchedPreview.length + 20)}..."`;
|
|
} else if (matchType === 'normalized') {
|
|
proof.style.color = 'lightgreen';
|
|
proof.textContent = `✔ Match found after normalization:
|
|
Preview: "${matchedPreview}"
|
|
Post value: "${value.slice(0, matchedPreview.length + 20)}..."`;
|
|
} else if (matchType === 'noBreaks') {
|
|
proof.style.color = 'lightblue';
|
|
proof.textContent = `✔ Match found after removing line breaks:
|
|
Preview: "${matchedPreview}"
|
|
Post value: "${value.slice(0, matchedPreview.length + 20)}..."`;
|
|
} else if (matchType === 'loose') {
|
|
proof.style.color = 'orange';
|
|
proof.textContent = `✔ Loose match found (near start of post):
|
|
Preview: "${matchedPreview}"
|
|
Post value: "${value.slice(0, matchedPreview.length + 20)}..."`;
|
|
}
|
|
container.appendChild(link);
|
|
container.appendChild(proof);
|
|
const iframeContainer = document.createElement('div');
|
|
const iframe = document.createElement('iframe');
|
|
iframe.src = `/other/extra/scripts/fakesocialmedia/replyhandler.html?url=${matchedUrl}`;
|
|
iframe.style.border = 'none';
|
|
iframe.style.height = '65px'; // Initial height
|
|
iframe.style.width = '100%';
|
|
iframe.style.overflow = 'auto';
|
|
const iframeHeightText = document.createElement('div'); // To show iframe height as text
|
|
iframeHeightText.style.marginTop = '10px';
|
|
iframeHeightText.style.fontFamily = 'monospace';
|
|
iframeHeightText.style.color = 'gray';
|
|
iframeHeightText.textContent = "";
|
|
iframe.onload = function() {
|
|
const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
|
|
function measureIframeHeight() {
|
|
const bodyHeight = iframeDocument.body.scrollHeight;
|
|
iframe.style.height = `${bodyHeight + 33}px`; // Add 15px to height
|
|
iframeHeightText.textContent = `Iframe height: ${bodyHeight + 33}px`;
|
|
}
|
|
measureIframeHeight();
|
|
setInterval(measureIframeHeight, 3000);
|
|
};
|
|
iframeContainer.appendChild(iframe);
|
|
container.appendChild(iframeContainer);
|
|
//container.appendChild(iframeHeightText);
|
|
postElement.appendChild(container); // Add container to the document
|
|
}
|
|
})
|
|
.catch(err => {
|
|
console.error("Fetch error:", err);
|
|
const fallback = document.createElement('a');
|
|
fallback.classList.add('btn2');
|
|
fallback.href = "#";
|
|
fallback.textContent = "Fetch error";
|
|
postElement.appendChild(fallback); // Add the fallback to the document
|
|
});
|
|
}
|
|
|
|
|
|
|
|
|
|
postElement.appendChild(hashtagsElement);
|
|
const buttonElement = document.createElement('button');
|
|
buttonElement.classList.add('btn');
|
|
const buttonText = value.slice(0, 25) || 'btn'; // Use 'btn' if value is empty or less than 25 characters
|
|
buttonElement.textContent = 'Comment';
|
|
buttonElement.addEventListener('click', () => {
|
|
window.open(`/other/extra/scripts/fakesocialmedia/comment.php?text=${encodeURIComponent(buttonText)}`, '_blank');
|
|
});
|
|
postElement.appendChild(buttonElement);
|
|
// Comment href2
|
|
const buttonElement2 = document.createElement('a');
|
|
buttonElement2.classList.add('btn2');
|
|
const buttonText2 = value.slice(0, 25) || 'btn'; // Use 'btn' if value is empty or less than 25 characters
|
|
buttonElement2.textContent = '(load comments)';
|
|
buttonElement2.href = `/other/extra/scripts/fakesocialmedia/commentload.html?number=40&text=${encodeURIComponent(buttonText2)}`;
|
|
buttonElement2.target = "_blank"; // Open the link in a new tab
|
|
postElement.appendChild(buttonElement2);
|
|
|
|
if (value.includes('youtube.com') && !value.includes('youtube.com/shorts')) {
|
|
const videoEmbed = document.createElement('iframe');
|
|
videoEmbed.src = `https://www.youtube.com/embed/${getVideoId(value)}`;
|
|
videoEmbed.width = '560';
|
|
videoEmbed.height = '315';
|
|
videoEmbed.frameborder = '0';
|
|
videoEmbed.allowfullscreen = 'true';
|
|
videoEmbed.setAttribute('allowfullscreen', '');
|
|
postElement.appendChild(videoEmbed);
|
|
}
|
|
containerfakesocialmedia.appendChild(postElement);
|
|
});
|
|
} catch (error) {
|
|
logError(`JSON Parse Error: ${error.message}`);
|
|
logError(`Problematic JSON: ${text}`);
|
|
}
|
|
})
|
|
.catch(error => {
|
|
logError(`Fetch Error: ${error.message}`);
|
|
});
|
|
} else {
|
|
const element = document.createElement('div');
|
|
element.textContent = 'No user specified (?user=user)';
|
|
console.log('No user selected, defaulting to alcea');
|
|
var currentUrl = window.location.href;
|
|
var newUrl = currentUrl.split('?')[0] + '?user=alcea';
|
|
window.location.href = newUrl;
|
|
document.body.appendChild(element);
|
|
}
|
|
|
|
function getVideoId(url) {
|
|
const videoIdMatch = url.match(/(?:\/embed\/|v=|v\/|vi\/|youtu\.be\/|\/v\/|\/e\/|\/u\/\w\/|\/embed\/|\/v=|\/e=|\/u\/\w\/|\/vi\/)([^#\&\?]*).*/);
|
|
return videoIdMatch[1];
|
|
}
|
|
|
|
function replaceEmojis(text) {
|
|
return text.replace(/:(\w+):/g, (match, emoji) => {
|
|
return `${baseurl}/${emoji}.gif`;
|
|
});
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|
|
|
|
<!---
|
|
Old version for ceabot:
|
|
//link2acws
|
|
if (value.includes("•acws")) {
|
|
// --- decode \uXXXX manually ---
|
|
function decodeUnicodeEscapes(str) {
|
|
return str.replace(/\\u([\dA-Fa-f]{4})/g, (_, hex) =>
|
|
String.fromCharCode(parseInt(hex, 16))
|
|
).replace(/\\ud([89abAB][0-9a-fA-F]{2})\\ud([cdefCDEF][0-9a-fA-F]{2})/g, (match, p1, p2) => {
|
|
// handle surrogate pairs (optional extension)
|
|
return '𒐫';
|
|
});
|
|
}
|
|
const decodedValue = decodeUnicodeEscapes(value);
|
|
const normalized = decodedValue.replace(/𒐫([\s\S]*?)𒐫/g, '<blockquote>$1</blockquote>');
|
|
|
|
fetch("https://alceawis.com/data_alcea.json", {
|
|
method: "GET",
|
|
cache: "no-store"
|
|
})
|
|
.then(res => res.json())
|
|
.then(json2 => {
|
|
const values2 = [];
|
|
json2.forEach(obj => {
|
|
const entry = Object.values(obj)[0];
|
|
values2.push({
|
|
value: entry.value ? entry.value.replace(/𒐫([\s\S]*?)𒐫/g, '<blockquote>$1</blockquote>').trim() : '',
|
|
status: entry.status || ''
|
|
});
|
|
});
|
|
|
|
let matched = values2.find(e => e.value === normalized);
|
|
if (!matched) {
|
|
const prefix = normalized.slice(0, 16);
|
|
matched = values2.find(e => e.value.slice(0, 16) === prefix);
|
|
}
|
|
const link = document.createElement('a');
|
|
link.target = "_blank";
|
|
link.classList.add('btn2');
|
|
if (matched) {
|
|
const dateClean = date.replace(/-/g, '');
|
|
const hash = CryptoJS.MD5(normalized).toString().substring(0, 8);
|
|
link.href = `https://alceawis.com/alceawis/status/${dateClean}-${hash}`;
|
|
link.textContent = `Permalink (status: ${matched.status || 'n/a'})`;
|
|
} else {
|
|
link.href = "#";
|
|
link.textContent = 'No match found';
|
|
}
|
|
|
|
postElement.appendChild(link);
|
|
})
|
|
.catch(err => {
|
|
console.error("Fetch error:", err);
|
|
const fallback = document.createElement('a');
|
|
fallback.classList.add('btn2');
|
|
fallback.href = "#";
|
|
fallback.textContent = 'Fetch error';
|
|
postElement.appendChild(fallback);
|
|
});
|
|
}
|
|
-->
|