diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 51ceeb19e..5b94876bc 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,8 @@ 更新履歴 +==== Ver 3.10.1(2023/12/23) + * FIX: OAuth 1.0a によるAPIアクセスに失敗する不具合を修正 + ==== Ver 3.10.0(2023/12/16) * NEW: graphqlエンドポイント経由で取得した引用ツイートの表示に対応 * FIX: APIリクエストがタイムアウトした場合のキャンセル処理を改善 diff --git a/OpenTween.Tests/Api/GraphQL/SearchTimelineRequestTest.cs b/OpenTween.Tests/Api/GraphQL/SearchTimelineRequestTest.cs index 7003b27c3..7e960eb4f 100644 --- a/OpenTween.Tests/Api/GraphQL/SearchTimelineRequestTest.cs +++ b/OpenTween.Tests/Api/GraphQL/SearchTimelineRequestTest.cs @@ -62,6 +62,28 @@ public async Task Send_Test() mock.VerifyAll(); } + [Fact] + public async Task Send_ReplaceCursorTest() + { + using var apiResponse = await TestUtils.CreateApiResponse("Resources/Responses/SearchTimeline_ReplaceCursor.json"); + + var mock = new Mock(); + mock.Setup(x => x.SendAsync(It.IsAny())) + .ReturnsAsync(apiResponse); + + var request = new SearchTimelineRequest(rawQuery: "#OpenTween") + { + Count = 20, + }; + + var response = await request.Send(mock.Object); + Assert.Empty(response.Tweets); + Assert.Equal("DAADDAABCgABFnlh4hraMAYKAAIOTm0DEhTAAQAIAAIAAAABCAADAAAAAQgABAAAAAAKAAUX8j3ezIBOIAoABhfyPd7Mf9jwAAA", response.CursorTop); + Assert.Equal("DAADDAABCgABFnlh4hraMAYKAAIOTm0DEhTAAQAIAAIAAAACCAADAAAAAQgABAAAAAAKAAUX8j3ezIBOIAoABhfyPd7Mf9jwAAA", response.CursorBottom); + + mock.VerifyAll(); + } + [Fact] public async Task Send_RequestCursor_Test() { diff --git a/OpenTween.Tests/Resources/Responses/SearchTimeline_ReplaceCursor.json b/OpenTween.Tests/Resources/Responses/SearchTimeline_ReplaceCursor.json new file mode 100644 index 000000000..a4d866f4b --- /dev/null +++ b/OpenTween.Tests/Resources/Responses/SearchTimeline_ReplaceCursor.json @@ -0,0 +1,40 @@ +{ + "data": { + "search_by_raw_query": { + "search_timeline": { + "timeline": { + "instructions": [ + { + "type": "TimelineReplaceEntry", + "entry_id_to_replace": "cursor-top-9223372036854775807", + "entry": { + "entryId": "cursor-top-9223372036854775807", + "sortIndex": "9223372036854775807", + "content": { + "entryType": "TimelineTimelineCursor", + "__typename": "TimelineTimelineCursor", + "value": "DAADDAABCgABFnlh4hraMAYKAAIOTm0DEhTAAQAIAAIAAAABCAADAAAAAQgABAAAAAAKAAUX8j3ezIBOIAoABhfyPd7Mf9jwAAA", + "cursorType": "Top" + } + } + }, + { + "type": "TimelineReplaceEntry", + "entry_id_to_replace": "cursor-bottom-0", + "entry": { + "entryId": "cursor-bottom-0", + "sortIndex": "0", + "content": { + "entryType": "TimelineTimelineCursor", + "__typename": "TimelineTimelineCursor", + "value": "DAADDAABCgABFnlh4hraMAYKAAIOTm0DEhTAAQAIAAIAAAACCAADAAAAAQgABAAAAAAKAAUX8j3ezIBOIAoABhfyPd7Mf9jwAAA", + "cursorType": "Bottom" + } + } + } + ] + } + } + } + } +} diff --git a/OpenTween/Api/TwitterApi.cs b/OpenTween/Api/TwitterApi.cs index f1186b1e7..b8e46a72e 100644 --- a/OpenTween/Api/TwitterApi.cs +++ b/OpenTween/Api/TwitterApi.cs @@ -640,7 +640,7 @@ public async Task> DirectMessagesEventsNew(l JsonString = json, }; - var response = await this.Connection.SendAsync(request) + using var response = await this.Connection.SendAsync(request) .ConfigureAwait(false); return response.ReadAsLazyJson(); diff --git a/OpenTween/Properties/AssemblyInfo.cs b/OpenTween/Properties/AssemblyInfo.cs index 7046ae2b8..1b6461bdb 100644 --- a/OpenTween/Properties/AssemblyInfo.cs +++ b/OpenTween/Properties/AssemblyInfo.cs @@ -22,7 +22,7 @@ // 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です [assembly: Guid("2d0ae0ba-adac-49a2-9b10-26fd69e695bf")] -[assembly: AssemblyVersion("3.10.0.0")] +[assembly: AssemblyVersion("3.10.1.0")] [assembly: InternalsVisibleTo("OpenTween.Tests")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] // for Moq diff --git a/OpenTween/Properties/Resources.Designer.cs b/OpenTween/Properties/Resources.Designer.cs index aebbd9b49..72428ee55 100644 --- a/OpenTween/Properties/Resources.Designer.cs +++ b/OpenTween/Properties/Resources.Designer.cs @@ -580,6 +580,9 @@ internal static string ChangeIconToolStripMenuItem_Confirm { /// /// 更新履歴 /// + ///==== Ver 3.10.1(2023/12/23) + /// * FIX: OAuth 1.0a によるAPIアクセスに失敗する不具合を修正 + /// ///==== Ver 3.10.0(2023/12/16) /// * NEW: graphqlエンドポイント経由で取得した引用ツイートの表示に対応 /// * FIX: APIリクエストがタイムアウトした場合のキャンセル処理を改善 @@ -592,9 +595,7 @@ internal static string ChangeIconToolStripMenuItem_Confirm { /// - この問題が起きるユーザーのツイートが含まれているとタイムラインの読み込みに失敗する問題も改善されます /// ///==== Ver 3.8.0(2023/11/29) - /// * NEW: graphqlエンドポイントを使用した検索タイムラインの取得に対応 - /// * NEW: graphqlエンドポイントを使用したプロフィール情報の取得に対応 - /// * NEW: graphq [残りの文字列は切り詰められました]"; に類似しているローカライズされた文字列を検索します。 + /// * NEW: graphqlエンドポイントを使用した [残りの文字列は切り詰められました]"; に類似しているローカライズされた文字列を検索します。 /// internal static string ChangeLog { get { diff --git a/OpenTween/Setting/SettingCommon.cs b/OpenTween/Setting/SettingCommon.cs index 488d926b2..c57f1ee2d 100644 --- a/OpenTween/Setting/SettingCommon.cs +++ b/OpenTween/Setting/SettingCommon.cs @@ -354,7 +354,7 @@ public class UserAccount public string Username = ""; public long UserId = 0; - public APIAuthType TwitterAuthType { get; set; } + public APIAuthType TwitterAuthType { get; set; } = APIAuthType.OAuth1; public string TwitterOAuth1ConsumerKey { get; set; } = ""; @@ -405,7 +405,7 @@ public ITwitterCredential GetTwitterCredential() return appToken.AuthType switch { APIAuthType.OAuth1 - => new TwitterCredentialOAuth1(appToken, this.TwitterOAuth1ConsumerKey, this.TwitterOAuth1ConsumerSecret), + => new TwitterCredentialOAuth1(appToken, this.Token, this.TokenSecret), APIAuthType.TwitterComCookie => new TwitterCredentialCookie(appToken), _ => new TwitterCredentialNone(), diff --git a/OpenTween/Twitter.cs b/OpenTween/Twitter.cs index ba09b07b8..341b69631 100644 --- a/OpenTween/Twitter.cs +++ b/OpenTween/Twitter.cs @@ -260,7 +260,7 @@ await this.SendDirectMessage(param.Text, mediaId) } else { - var response = await this.Api.StatusesUpdate( + using var response = await this.Api.StatusesUpdate( param.Text, param.InReplyToStatusId?.ToTwitterStatusId(), param.MediaIds, @@ -317,7 +317,7 @@ public async Task UploadMedia(IMediaItem item, string? mediaCategory = nul _ => "application/octet-stream", }; - var initResponse = await this.Api.MediaUploadInit(item.Size, mediaType, mediaCategory) + using var initResponse = await this.Api.MediaUploadInit(item.Size, mediaType, mediaCategory) .ConfigureAwait(false); var initMedia = await initResponse.LoadJsonAsync() @@ -328,7 +328,7 @@ public async Task UploadMedia(IMediaItem item, string? mediaCategory = nul await this.Api.MediaUploadAppend(mediaId, 0, item) .ConfigureAwait(false); - var response = await this.Api.MediaUploadFinalize(mediaId) + using var response = await this.Api.MediaUploadFinalize(mediaId) .ConfigureAwait(false); var media = await response.LoadJsonAsync() @@ -374,7 +374,7 @@ public async Task SendDirectMessage(string postStr, long? mediaId = null) var recipient = await this.GetUserInfo(recipientName) .ConfigureAwait(false); - var response = await this.Api.DirectMessagesEventsNew(recipient.Id, body, mediaId) + using var response = await this.Api.DirectMessagesEventsNew(recipient.Id, body, mediaId) .ConfigureAwait(false); var messageEventSingle = await response.LoadJsonAsync() @@ -405,7 +405,7 @@ await this.CreateDirectMessagesEventFromJson(messageEventSingle, read: true) return null; } - var response = await this.Api.StatusesRetweet(target.ToTwitterStatusId()) + using var response = await this.Api.StatusesRetweet(target.ToTwitterStatusId()) .ConfigureAwait(false); var status = await response.LoadJsonAsync() @@ -1324,7 +1324,7 @@ await this.Api.ListsDestroy(listId) public async Task EditList(long listId, string new_name, bool isPrivate, string description) { - var response = await this.Api.ListsUpdate(listId, new_name, description, isPrivate) + using var response = await this.Api.ListsUpdate(listId, new_name, description, isPrivate) .ConfigureAwait(false); var list = await response.LoadJsonAsync() @@ -1349,7 +1349,7 @@ public async Task CreateListApi(string listName, bool isPrivate, string descript { this.CheckAccountState(); - var response = await this.Api.ListsCreate(listName, description, isPrivate) + using var response = await this.Api.ListsCreate(listName, description, isPrivate) .ConfigureAwait(false); var list = await response.LoadJsonAsync() diff --git a/OpenTween/UserInfoDialog.cs b/OpenTween/UserInfoDialog.cs index 176ac2e4d..3a98320d1 100644 --- a/OpenTween/UserInfoDialog.cs +++ b/OpenTween/UserInfoDialog.cs @@ -527,7 +527,7 @@ private async void ButtonEdit_Click(object sender, EventArgs e) { try { - var response = await this.twitterApi.AccountUpdateProfile( + using var response = await this.twitterApi.AccountUpdateProfile( this.TextBoxName.Text, this.TextBoxWeb.Text, this.TextBoxLocation.Text, diff --git a/appveyor.yml b/appveyor.yml index 1893d8839..fb643672c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 3.9.0.{build} +version: 3.10.0.{build} os: Visual Studio 2022