[nitter] Disable Adding of new Sources (#163)

This commit disables the adding of new Nitter sources, because Nitter is
deprecated 😞 and adding new sources is not working anymore. Nitter
sources are also not updated anymore, because the update for Nitter
sources isn't working as well. To ensure that the Nitter sources are not
updated anymore the sources with type `nitter` are skipped in the
scheduler.

The Nitter source isn't removed completly, because we would also have to
cleanup the database and their might be items, which are bookmarked by
users.

See https://github.com/zedeus/nitter/issues/1155#issuecomment-1913361757
This commit is contained in:
Rico Berger
2024-04-06 17:22:27 +02:00
committed by GitHub
parent 4c34d33ac0
commit 38fc655a53
3 changed files with 24 additions and 32 deletions

View File

@@ -148,14 +148,20 @@ const scheduleSources = async (
});
for (const source of sources) {
/**
* Skip "reddit" and "nitter" sources for users on the free tier, when
* the source was already updated in the last 24 hours. This is done
* to avoid hitting the rate limits of the Reddit and Nitter APIs.
* The "nitter" source type is deprecated and should not be scheduled
* for updates anymore.
* See https://github.com/zedeus/nitter/issues/1155#issuecomment-1913361757
*/
if (
profile.tier === 'free' &&
(source.type === 'reddit' || source.type === 'nitter')
) {
if (source.type === 'nitter') {
continue;
}
/**
* Skip "reddit" sources for users on the free tier, when the source
* was already updated in the last 24 hours. This is done to avoid
* hitting the rate limits of the Reddit API.
*/
if (profile.tier === 'free' && source.type === 'reddit') {
if (
source.updatedAt > Math.floor(new Date().getTime() / 1000) -
(60 * 60 * 24)