From 39a88b27223a4cc6955e7c0a288d9422d201a5a9 Mon Sep 17 00:00:00 2001 From: vulet Date: Sun, 25 Apr 2021 15:53:23 +0800 Subject: [PATCH] fix(notifications/timeline): low lengths. chore(config): add invidious.fdn.fr. --- commands/fediverse/flood.js | 3 ++- commands/fediverse/notify.js | 3 ++- config.example.js | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/commands/fediverse/flood.js b/commands/fediverse/flood.js index eec2f4a..b016abd 100644 --- a/commands/fediverse/flood.js +++ b/commands/fediverse/flood.js @@ -12,7 +12,8 @@ exports.runQuery = function (roomId) { const len = events.length; for (let i = len - 1; i >= 0; i--) { if (past.findIndex((x) => x.created_at === events[i].created_at) === -1) { - if (events[i].created_at < past.slice(18, 19)[0].created_at) return; + const lastStored = past.slice(past.length - 1, past.length); + if (events[i].created_at < lastStored[0].created_at) return; events[i].label = 'status'; fediverse.utils.formatter(events[i], roomId); } diff --git a/commands/fediverse/notify.js b/commands/fediverse/notify.js index 04a3f18..c77c6b1 100644 --- a/commands/fediverse/notify.js +++ b/commands/fediverse/notify.js @@ -12,7 +12,8 @@ exports.runQuery = function (roomId) { const len = events.length; for (let i = len - 1; i >= 0; i--) { if (past.findIndex((x) => x.created_at === events[i].created_at) === -1) { - if (events[i].created_at < past.slice(18, 19)[0].created_at) return; + const lastStored = past.slice(past.length - 1, past.length); + if (events[i].created_at < lastStored[0].created_at) return; events[i].label = 'notifications'; fediverse.utils.formatter(events[i], roomId); } diff --git a/config.example.js b/config.example.js index 3524c62..ebc4c85 100644 --- a/config.example.js +++ b/config.example.js @@ -25,12 +25,12 @@ module.exports = { nitter: { domain: 'nitter.fdn.fr', userAgent: 'Mozilla/4.0 (compatible; Beep Boop)', - domains: [ 'nitter.net', 'www.nitter.net', 'twitter.com', 'www.twitter.com', 'mobile.twitter.com', 'm.twitter.com' ], + domains: [ 'nitter.net', 'www.nitter.net', 'twitter.com', 'www.twitter.com', 'mobile.twitter.com', 'm.twitter.com', 'nitter.fdn.fr' ], check: '(✅)' }, invidious: { domain: 'invidious.fdn.fr', userAgent: 'Mozilla/4.0 (compatible; Beep Boop)', - domains: [ 'invidious.snopyta.org', 'invidious.xyz', 'youtube.com', 'www.youtube.com', 'youtu.be', 'm.youtube.com' ] + domains: [ 'invidious.snopyta.org', 'invidious.xyz', 'youtube.com', 'www.youtube.com', 'youtu.be', 'm.youtube.com', 'invidious.fdn.fr' ] } };