Fix bug with requests not sent

This commit is contained in:
Brahim Hadriche committed 2023-11-10 17:34:31 -05:00
1 parent 3c43934081
commit 665fa44a49
4 files changed
+6 -3

No files matched your search

+1
View File
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- A rare bug that causes the app to crash when displaying video cells - A rare bug that causes the app to crash when displaying video cells
- A bug where we show error dialogs that happened on screens that are already closed - A bug where we show error dialogs that happened on screens that are already closed
- A bug where bookmarks show duplicate videos - A bug where bookmarks show duplicate videos
- A bug where watch history is not always sent to Invidious
## [0.15.0] - 2023-11-05 ## [0.15.0] - 2023-11-05
@@ -88,7 +88,7 @@ namespace Invidious
url = `${authToken.instance}${Invidious.HISTORY_ENDPOINT}/${videoId}` url = `${authToken.instance}${Invidious.HISTORY_ENDPOINT}/${videoId}`
request = HttpClient.Post(url, "") request = HttpClient.Post(url, "")
request.Headers(m.GetAuthenticationHeaders(authToken.token)) request.Headers(m.GetAuthenticationHeaders(authToken.token))
request.Send() request.Await()
end function end function
function SearchSuggestions(q as string, cancellation = invalid as object) as object function SearchSuggestions(q as string, cancellation = invalid as object) as object
@@ -482,7 +482,7 @@ namespace Invidious
request.Headers(m.GetAuthenticationHeaders(authToken.token)) request.Headers(m.GetAuthenticationHeaders(authToken.token))
request.Header("Content-Type", "application/json") request.Header("Content-Type", "application/json")
request.Send() request.Await()
end function end function
function GetAuthorizeTokenLink() as dynamic function GetAuthorizeTokenLink() as dynamic
@@ -84,7 +84,7 @@ namespace SponsorBlock
end if end if
url = `${m.sponsorBlockConfig.serverAddress}${SponsorBlock.VIEWED_SEGMENT_ENDPOINT}?UUID=${segmentId}` url = `${m.sponsorBlockConfig.serverAddress}${SponsorBlock.VIEWED_SEGMENT_ENDPOINT}?UUID=${segmentId}`
HttpClient.Post(url, "").Send() HttpClient.Post(url, "").Await()
end function end function
function GenerateProgressBarBackground(segments as object, lengthSeconds as integer, path as string) function GenerateProgressBarBackground(segments as object, lengthSeconds as integer, path as string)
@@ -202,6 +202,8 @@ namespace HttpClient
return command return command
end function end function
' Note: Calling Send() only without Await() will not guarentee a request will be sent.
' If a Task finishes before the request is sent, the request might be dropped.
function Send() as HttpRequest function Send() as HttpRequest
if m.urlTransfer <> invalid or m._cache <> invalid if m.urlTransfer <> invalid or m._cache <> invalid
return m return m