[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

@@ -1,5 +1,7 @@
import 'package:flutter/material.dart';
import 'package:collection/collection.dart';
import 'package:feeddeck/models/column.dart';
import 'package:feeddeck/models/source.dart';
import 'package:feeddeck/utils/constants.dart';
@@ -39,6 +41,9 @@ class AddSource extends StatefulWidget {
}
class _AddSourceState extends State<AddSource> {
final List<FDSourceType> _sourceTypeValues = FDSourceType.values
.whereNot((e) => e == FDSourceType.nitter || e == FDSourceType.none)
.toList();
FDSourceType _sourceType = FDSourceType.none;
/// [_buildBody] returns a list of all supported source types when no source
@@ -109,14 +114,14 @@ class _AddSourceState extends State<AddSource> {
height: Constants.spacingMiddle,
);
},
itemCount: FDSourceType.values.length - 1,
itemCount: _sourceTypeValues.length,
itemBuilder: (context, index) {
return MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
onTap: () {
setState(() {
_sourceType = FDSourceType.values[index];
_sourceType = _sourceTypeValues[index];
});
},
child: Container(
@@ -126,7 +131,7 @@ class _AddSourceState extends State<AddSource> {
/// If we decide later to use a generic color as background
/// the following line can be used:
/// color: Constants.secondary,
color: FDSourceType.values[index].bgColor,
color: _sourceTypeValues[index].bgColor,
borderRadius: BorderRadius.circular(4),
),
child: Column(
@@ -134,7 +139,7 @@ class _AddSourceState extends State<AddSource> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SourceIcon(
type: FDSourceType.values[index],
type: _sourceTypeValues[index],
icon: null,
size: 48,
),
@@ -142,7 +147,7 @@ class _AddSourceState extends State<AddSource> {
height: Constants.spacingSmall,
),
Text(
FDSourceType.values[index].toLocalizedString(),
_sourceTypeValues[index].toLocalizedString(),
style: TextStyle(
/// Since we are using the brand color as background
/// color, we are using the same color as for the icon
@@ -150,7 +155,7 @@ class _AddSourceState extends State<AddSource> {
/// to use a generic color as background the following
/// line can be used:
/// color: Constants.onSecondary,
color: FDSourceType.values[index].fgColor,
color: _sourceTypeValues[index].fgColor,
),
),
],

View File

@@ -71,7 +71,6 @@ export default function Home() {
<Lemmy />
<Mastodon />
<Medium />
<Nitter />
<Pinterest />
<Reddit />
<RSS />
@@ -311,24 +310,6 @@ const Medium = () => (
</div>
);
const Nitter = () => (
<div className="flex flex-col items-center justify-center">
<svg
width="32px"
height="32px"
viewBox="0 0 4096 4096"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
fill="currentColor"
>
<g id="Nitter" transform="matrix(7.0137,0,0,7.0137,-289.9,-289.9)">
<path d="M98.133,44.8L94.667,48.4L94.667,618.267L98.133,621.867L101.733,625.334L218.267,625.334L221.867,621.867L225.333,618.267L225.333,453.2C225.333,316.4 225.6,288 227.067,288C228.133,288 281.867,362.8 346.667,454.267C411.334,545.867 465.6,621.734 467.2,622.934C469.734,625.067 474.534,625.334 517.467,625.334L564.934,625.334L568.534,621.867L572,618.267L572,48.4L568.534,44.8L564.934,41.333L448.4,41.333L444.8,44.8L441.334,48.4L441.334,213.467C441.334,350.267 441.067,378.667 439.6,378.667C438.534,378.667 384.8,303.867 320,212.267C255.333,120.8 201.067,44.933 199.467,43.733C196.933,41.6 192.133,41.333 149.2,41.333L101.733,41.333L98.133,44.8ZM310,240.933C378.267,337.334 435.867,418.4 438.134,420.8C442,424.934 442.934,425.334 450.267,425.334C457.2,425.334 458.8,424.8 461.867,421.867L465.334,418.267L465.334,65.333L548,65.333L548,601.334L514.4,601.2L480.667,601.2L356.667,425.734C288.533,329.333 230.8,248.267 228.533,245.867C224.667,241.733 223.733,241.333 216.4,241.333C209.467,241.333 207.867,241.867 204.8,244.8L201.333,248.4L201.333,601.334L118.667,601.334L118.667,65.333L152.4,65.467L186,65.467L310,240.933Z" />
</g>
</svg>
<div className="pt-4">Nitter</div>
</div>
);
const Pinterest = () => (
<div className="flex flex-col items-center justify-center">
<svg

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)