Commit 8f9e1522 authored by Iván Sánchez Ortega's avatar Iván Sánchez Ortega

Bugs in display, updated readme

parent 5ef4ca96
......@@ -4,10 +4,13 @@
It's social, and it's CLI. So, soCLIal.
As of now, soCLIal is buggy, and feature-incomplete. But it allows you to sign into a
`mastodon.social` account and display your home timeline.
As of now, soCLIal is feature-incomplete. The current list of features is:
- It allows you to sign into a `mastodon.social` account and display your home timeline.
- It allows you to sign into a twitter account and display your home timeline.
The interface is meant to be as close as TTYtter/oysttyer as possible. Interactive
shell, streaming of messages by default, different colours for different kinds
of messages.
### Quickstart
......
......@@ -201,6 +201,7 @@ class TwitterAccount extends Account {
// return striptags( he.decode( str.replace('</p><p>', ' // ') ) );
return str.
replace(/\n/g, ' // ').
replace(/&amp;/g, "&").
replace(/&gt;/g, ">").
replace(/&lt;/g, "<");
}
......
......@@ -41,14 +41,34 @@ function handle(account, data, metadata) {
data.metadata = metadata;
data.account = account;
let { timestamp, channel } = data;
if (timestamp === undefined) {
timestamp = Date.now();
}
// https://stackoverflow.com/questions/10645994/node-js-how-to-format-a-date-string-in-utc
let timestampString =
new Date(timestamp)
.toISOString()
.replace(/T/, ' ') // replace T with a space
.replace(/\..+/, ''); // delete the dot and everything after
let id = circularBuffer.push(data);
let badge = account._opts.badge; // What's the badge for this platform/account??
data.soclialId = id;
const timestampColour = conf.get('global.colours.timestamp');
const badgeColour = conf.get('global.colours.badge');
let header = '[' + chalk.foreground(timestampColour)(timestampString) + '] ' +
id + '> ' + chalk.foreground(badgeColour)(badge + '/' + channel);
let formatted = stringify(conf, data);
// Printing out should NOT be synchronous with the handling.
vorpal.log(formatted);
vorpal.log(header + formatted);
}
......
......@@ -8,23 +8,9 @@ export default function stringify(conf, item) {
let { str, channel, realtime, timestamp, account } = item;
if (timestamp === undefined) {
timestamp = Date.now();
}
// https://stackoverflow.com/questions/10645994/node-js-how-to-format-a-date-string-in-utc
let timestampString =
new Date(timestamp)
.toISOString()
.replace(/T/, ' ') // replace T with a space
.replace(/\..+/, ''); // delete the dot and everything after
// What's the badge for this platform/account??
let badge = account._opts.badge;
let sender = item.sender;
const timestampColour = conf.get('global.colours.timestamp');
const badgeColour = conf.get('global.colours.badge');
const updateColour = conf.get('global.colours.updates');
const mediaColour = conf.get('global.colours.media');
......@@ -36,11 +22,10 @@ export default function stringify(conf, item) {
// }
}
let formatted = '[' + chalk.foreground(timestampColour)(timestampString) + '] ' +
item.soclialId + '> ' + chalk.foreground(badgeColour)(badge + '/' + channel) +
(sender ? (' <' + chalk.bold(sender) + '>') : '') +
' ' + chalk.foreground(updateColour)(str) +
formattedMedia;
let formatted =
(sender ? (' <' + chalk.bold(sender) + '>') : '') +
' ' + chalk.foreground(updateColour)(str) +
formattedMedia;
/// TODO: handle quotes (by recursive call)
/// TODO: handle echoes/boosts/RT (by recursive call)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment