-
Notifications
You must be signed in to change notification settings - Fork 0
Support more formats and protocols #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I have added twtxt to the list. I have wrote this code to parse twtxt. function renderTwtxt(txtFile) {
let lines = txtFile.trim().split('\n');
let metadata = {};
for (const line of lines) {
if (line.startsWith('#') && line.includes('=')) {
let newLine = line.replace('#','');
let keyValue = newLine.split('=');
let key = keyValue[0].trim();
let value = keyValue[1].trim();
metadata[key] = value;
}
}
let newDocument = createPage();
newDocument.title = metadata['nick'];
if (metadata['lang']) {
newDocument
.documentElement
.setAttribute('lang', metadata['lang']);
}
let feed = newDocument.createElement('div');
feed.id = 'feed';
let title = newDocument.createElement('h1');
if (metadata['nick']) {
title.textContent = metadata['nick'];
} else {
title.textContent = document.location.hostname;
}
title.id = 'title';
feed.append(title);
let subtitle = newDocument.createElement('h2');
if (metadata['description']) {
subtitle.textContent = metadata['description'];
} else {
subtitle.textContent = defaultSubtitle;
}
subtitle.id = 'subtitle';
feed.append(subtitle);
if (enableIcon) {
let iconPath = metadata['avatar'];
if (iconPath) {
let div = newDocument.createElement('div');
let logoLink = newDocument.createElement('a');
let logoImage = newDocument.createElement('img');
logoLink.className = 'homepage-link';
logoLink.id = 'logo';
logoImage.src = metadata['avatar'];
logoLink.append(logoImage);
div.append(logoLink);
feed.append(div);
}
}
let toc = newDocument.createElement('ol');
toc.id = 'toc';
feed.append(toc);
let articles = newDocument.createElement('div');
articles.id = 'articles';
feed.append(articles);
for (const line of lines.reverse()) {
if (!line.startsWith('#')) {
let twtEntry = line.split(' ');
let timestamp = twtEntry[0];
let message = twtEntry[1];
let items = lines.length;
let index = lines.indexOf(line) + 1;
let titleToc = newDocument.createElement('a');
let dateAsTitle = new Date(timestamp);
titleToc.textContent = dateAsTitle;
titleToc.href = `#newspaper-oujs-${index}`;
titleToc.title = titleToc.textContent;
let liElement = newDocument.createElement('li');
liElement.append(titleToc)
toc.append(liElement);
let entry = newDocument.createElement('div');
entry.className = 'entry';
let link = newDocument.createElement('a');
link.textContent = dateAsTitle;
link.href = '';
link.id = `newspaper-oujs-${index}`;
title = newDocument.createElement('h3');
title.className = 'title';
title.append(link);
entry.append(title);
let date = newDocument.createElement('div');
date.className = 'published';
date.textContent = dateAsTitle;
entry.append(date);
let text = newDocument.createElement('div');
text.className = 'content';
text.textContent = message;
entry.append(text);
articles.append(entry);
if (
index > minimumItemNumber &&
index < items &&
!ignoreMinimumItemNumber
)
{
let titleToc = newDocument.createElement('a');
titleToc.textContent = 'See all posts >';
titleToc.title = `This feed offers ${items} items`;
titleToc.className = 'expand';
toc.append(titleToc);
articles.append(titleToc.cloneNode(true));
break;
}
}
}
newDocument.body.append(feed);
newDocument = checkContentEmptiness(newDocument);
return newDocument;
} https://greasyfork.org/en/scripts/465932-newspaper-syndication-feed-reader |
@SeveFP @lwindolf |
At the moment I don't want to support such a variety of formats and protocols. |
Fair. Perhaps we should create a plugin, if the plugin system of NewsAgain would allow it. Of noteI suppose that adding support for XMPP would cause to NewsAgain nto feature at https://xmpp.org/software/ So it would be for Nostr. I am not usre for the rest. Post scriptI am working on a news bot for XMPP, which currently supports HTTP, yet I intend to add support for various of other protocols and formats, and I will inform you of my progress, especially if I am to visit Germany! |
Yes, I intend to provide a plugin system (more our less ad-hoc loading extra JS). But this will take a while. As with Liferea I plan to implement "sources" (like TTRSS, TheOldReader...) as plugins to encourage implementing more. |
I suggest to engineer NewsAgain for multiple protocols.
Protocols
gemini://woodpeckersnest.space/~schapps/journal/2024-08-02-good-news-friday-a-new-dawn-of-syndications.gmi
Gemini and Gopher
Jabber/XMPP
You can also refer to people of the Berlin XMPP Meetup.
I do not want to communicate the considerations here, yet.
I would be delightful for us to converse over a VoIP session on SIP or XMPP, whichever you want.
It should not require more than 5 minutes for me to explain it.
A NEW MESSAGE
I have created an XMPP gateway for HTTP.
I encourage you to view the video demonstration (length 7:44).
https://video.xmpp-it.net/w/vNqcMooy3pqRAZ8Yb8grr1
https://git.xmpp-it.net/sch/Rivista
I am not sure why I have wrote this line
I have created a News Bot for XMPP, and even though it currently supports only XMPP, it is structured to add more protocols (e.g. Email, IRC etc.). See https://git.xmpp-it.net/sch/SlixfeedThe text was updated successfully, but these errors were encountered: