From 5f480b4baac427b258fac304a3224528ff7e80ad Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Wed, 10 Feb 2021 01:35:29 -0500 Subject: [PATCH 1/4] don't retrieve TL if user is protected --- .../Processors/RetrieveTweetsProcessor.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/BirdsiteLive.Pipeline/Processors/RetrieveTweetsProcessor.cs b/src/BirdsiteLive.Pipeline/Processors/RetrieveTweetsProcessor.cs index e60c121..bb5e026 100644 --- a/src/BirdsiteLive.Pipeline/Processors/RetrieveTweetsProcessor.cs +++ b/src/BirdsiteLive.Pipeline/Processors/RetrieveTweetsProcessor.cs @@ -68,6 +68,10 @@ namespace BirdsiteLive.Pipeline.Processors { var tweets = new ExtractedTweet[0]; + // Don't retrieve TL if protected + var userView = _twitterUserService.GetUser(user.Acct); + if (userView == null || userView.Protected) return tweets; + try { if (user.LastTweetPostedId == -1) From 7fec7e765e51399ed24b725a7bd6d3309be83bb2 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Wed, 10 Feb 2021 01:41:55 -0500 Subject: [PATCH 2/4] fix tests --- .../Processors/RetrieveTweetsProcessorTests.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Tests/BirdsiteLive.Pipeline.Tests/Processors/RetrieveTweetsProcessorTests.cs b/src/Tests/BirdsiteLive.Pipeline.Tests/Processors/RetrieveTweetsProcessorTests.cs index 02fd7bd..38b750c 100644 --- a/src/Tests/BirdsiteLive.Pipeline.Tests/Processors/RetrieveTweetsProcessorTests.cs +++ b/src/Tests/BirdsiteLive.Pipeline.Tests/Processors/RetrieveTweetsProcessorTests.cs @@ -62,6 +62,9 @@ namespace BirdsiteLive.Pipeline.Tests.Processors .Returns(Task.CompletedTask); var twitterUserServiceMock = new Mock(MockBehavior.Strict); + twitterUserServiceMock + .Setup(x => x.GetUser(It.Is(y => y == user1.Acct))) + .Returns(new TwitterUser {Protected = false}); var logger = new Mock>(MockBehavior.Strict); #endregion @@ -126,6 +129,9 @@ namespace BirdsiteLive.Pipeline.Tests.Processors var twitterUserDalMock = new Mock(MockBehavior.Strict); var twitterUserServiceMock = new Mock(MockBehavior.Strict); + twitterUserServiceMock + .Setup(x => x.GetUser(It.Is(y => y == user1.Acct))) + .Returns(new TwitterUser { Protected = false }); var logger = new Mock>(MockBehavior.Strict); #endregion @@ -193,6 +199,9 @@ namespace BirdsiteLive.Pipeline.Tests.Processors var twitterUserDalMock = new Mock(MockBehavior.Strict); var twitterUserServiceMock = new Mock(MockBehavior.Strict); + twitterUserServiceMock + .Setup(x => x.GetUser(It.Is(y => y == user1.Acct))) + .Returns(new TwitterUser { Protected = false }); var logger = new Mock>(MockBehavior.Strict); #endregion From 5aa8deb47b4aa589c34455896f68cc765a96f9c7 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Wed, 10 Feb 2021 23:31:29 -0500 Subject: [PATCH 3/4] make sure avatar is served in https, fix #87 --- src/BirdsiteLive.Twitter/TwitterUserService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BirdsiteLive.Twitter/TwitterUserService.cs b/src/BirdsiteLive.Twitter/TwitterUserService.cs index dd80c4d..2370cea 100644 --- a/src/BirdsiteLive.Twitter/TwitterUserService.cs +++ b/src/BirdsiteLive.Twitter/TwitterUserService.cs @@ -64,7 +64,7 @@ namespace BirdsiteLive.Twitter Name = user.Name, Description = description, Url = $"https://twitter.com/{username}", - ProfileImageUrl = user.ProfileImageUrlFullSize, + ProfileImageUrl = user.ProfileImageUrlFullSize.Replace("http://", "https://"), ProfileBackgroundImageUrl = user.ProfileBackgroundImageUrlHttps, ProfileBannerURL = user.ProfileBannerURL, Protected = user.Protected From d660dc990c85a5df9eb9dfeef58ad118abc596d3 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Wed, 10 Feb 2021 23:32:57 -0500 Subject: [PATCH 4/4] road to 0.14.2 --- src/BirdsiteLive/BirdsiteLive.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BirdsiteLive/BirdsiteLive.csproj b/src/BirdsiteLive/BirdsiteLive.csproj index cb2c708..7c24384 100644 --- a/src/BirdsiteLive/BirdsiteLive.csproj +++ b/src/BirdsiteLive/BirdsiteLive.csproj @@ -4,7 +4,7 @@ netcoreapp3.1 d21486de-a812-47eb-a419-05682bb68856 Linux - 0.14.1 + 0.14.2