forked from vgaNAR6ta/drags-and-nerds
edit : gestion du ptn de REBLOG aaaaah xD
This commit is contained in:
@@ -22,8 +22,13 @@ function titleAndContent(str){
|
||||
for(let line of contentData){
|
||||
if(line.includes('http')||line.includes('@')){
|
||||
let linkData = line.split("# ");
|
||||
//console.log(linkData);
|
||||
let linkNoFormat = linkData[1].split("\"");
|
||||
//console.log(title, linkData);
|
||||
let linkNoFormat;
|
||||
if (linkData.includes('http')){
|
||||
linkNoFormat = linkData[1].split("\"");
|
||||
} else {
|
||||
linkNoFormat = linkData[0]
|
||||
}
|
||||
let url = "";
|
||||
for(let el of linkNoFormat){
|
||||
if(el.includes('http')){
|
||||
@@ -76,7 +81,7 @@ export async function loadPeopleData() {
|
||||
|
||||
const pouets = await res.json();
|
||||
//console.log("POUETS :" , pouets);
|
||||
const filtered = pouets.filter(p => pData.some(user => p.account.username === user.name));
|
||||
const filtered = pouets.filter(p => pData.some(user => p.account.username === user.name || p.reblog?.account.username === user.name));
|
||||
//console.log("FILTERED :" , filtered);
|
||||
const files = {};
|
||||
for (const user of pData) {
|
||||
@@ -84,40 +89,47 @@ export async function loadPeopleData() {
|
||||
}
|
||||
const description = {};
|
||||
for (const user of pData){
|
||||
const pouet = filtered.find(p => p.account.username === user.name);
|
||||
const pouet = filtered.find(p => p.account.username === user.name || p.reblog?.account.username === user.name);
|
||||
if (pouet){
|
||||
description[user.name] = pouet.account.note;
|
||||
}
|
||||
}
|
||||
|
||||
for (const pouet of filtered) {
|
||||
const username = pouet.account.username;
|
||||
const displayName = pouet.account.display_name;
|
||||
let infos = idAndDate(pouet.created_at);
|
||||
let selectedPouet;
|
||||
if(pouet.reblog){
|
||||
selectedPouet = pouet.reblog;
|
||||
} else {
|
||||
selectedPouet = pouet;
|
||||
}
|
||||
//console.log(selectedPouet);
|
||||
const username = selectedPouet.account.username;
|
||||
const displayName = selectedPouet.account.display_name;
|
||||
let infos = idAndDate(selectedPouet.created_at);
|
||||
let entry;
|
||||
//console.log(pouet);
|
||||
//ignorer autres que images
|
||||
if (pouet.media_attachments?.length > 0 &&
|
||||
if (selectedPouet.media_attachments?.length > 0 &&
|
||||
!pouet.media_attachments[0].type.includes('image')) {
|
||||
continue;
|
||||
}
|
||||
//ignorer réponses
|
||||
if (pouet.in_reply_to_account_id) {
|
||||
if (selectedPouet.in_reply_to_account_id) {
|
||||
continue;
|
||||
}
|
||||
//ignorer exceptions
|
||||
let exception = exceptionKey(username, pouet.content);
|
||||
let exception = exceptionKey(username, selectedPouet.content);
|
||||
//console.log(exception)
|
||||
if(exception){
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pouet.content.includes('http')) {
|
||||
let textInfos = titleAndContent(pouet.content);
|
||||
if (selectedPouet.content.includes('http')) {
|
||||
let textInfos = titleAndContent(selectedPouet.content);
|
||||
entry = {
|
||||
id: 'link' + displayName + infos.id,
|
||||
date: infos.date,
|
||||
dateInfo: pouet.created_at,
|
||||
dateInfo: selectedPouet.created_at,
|
||||
type: "link",
|
||||
author: displayName,
|
||||
caption: textInfos.title + '.liens',
|
||||
@@ -125,28 +137,28 @@ export async function loadPeopleData() {
|
||||
description: textInfos.content,
|
||||
isSelected: false
|
||||
};
|
||||
} else if (pouet.media_attachments?.length > 0) {
|
||||
let textInfos = titleAndContent(pouet.content);
|
||||
} else if (selectedPouet.media_attachments?.length > 0) {
|
||||
let textInfos = titleAndContent(selectedPouet.content);
|
||||
//console.log(pouet);
|
||||
entry = {
|
||||
id: 'img' + displayName + infos.id,
|
||||
date: infos.date,
|
||||
dateInfo: pouet.created_at,
|
||||
dateInfo: selectedPouet.created_at,
|
||||
type: "image",
|
||||
author: displayName,
|
||||
caption: textInfos.title + '.star',
|
||||
src: pouet.media_attachments[0].url,
|
||||
alt: pouet.media_attachments[0].description,
|
||||
src: selectedPouet.media_attachments[0].url,
|
||||
alt: selectedPouet.media_attachments[0].description,
|
||||
description: textInfos.content,
|
||||
like: pouet.favourites_count,
|
||||
like: selectedPouet.favourites_count,
|
||||
isSelected: false
|
||||
}
|
||||
} else {
|
||||
let textInfos = titleAndContent(pouet.content);
|
||||
let textInfos = titleAndContent(selectedPouet.content);
|
||||
entry = {
|
||||
id: 'txt' + displayName + infos.id,
|
||||
date: infos.date,
|
||||
dateInfo: pouet.created_at,
|
||||
dateInfo: selectedPouet.created_at,
|
||||
type: "text",
|
||||
author: displayName,
|
||||
caption: textInfos.title + '.msg',
|
||||
|
||||
Reference in New Issue
Block a user