[skip ci] Fix invidious instance tests
This commit is contained in:
1 parent
965ac9dfce
commit
501ee5178b
4 files changed
+35
-22
No files matched your search
+3
-1
@@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
- Nothing worth mentioning yet.
|
### Fixed
|
||||||
|
|
||||||
|
- Fix Invidious tests - `Me at the zoo` video was getting blocked
|
||||||
|
|
||||||
## [0.40.7] - 2025-06-21
|
## [0.40.7] - 2025-06-21
|
||||||
|
|
||||||
|
|||||||
+13
-9
@@ -1,8 +1,8 @@
|
|||||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||||
|
import "pkg:/components/JobSystem/Jobs.bs"
|
||||||
|
import "pkg:/components/JobSystem/JobSystem.bs"
|
||||||
import "pkg:/components/Navigation/Navigation.bs"
|
import "pkg:/components/Navigation/Navigation.bs"
|
||||||
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
|
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
|
||||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
|
||||||
import "pkg:/source/AsyncTask/Tasks.bs"
|
|
||||||
import "pkg:/source/utils/FocusManagement.bs"
|
import "pkg:/source/utils/FocusManagement.bs"
|
||||||
import "pkg:/source/utils/RemoteKeys.bs"
|
import "pkg:/source/utils/RemoteKeys.bs"
|
||||||
import "pkg:/source/utils/StringUtils.bs"
|
import "pkg:/source/utils/StringUtils.bs"
|
||||||
@@ -46,25 +46,29 @@ function OnKeyEvent(key as string, press as boolean) as boolean
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function Close()
|
function Close()
|
||||||
if m.testingTask <> invalid
|
if m.invidiousInstanceTestingJob <> invalid
|
||||||
m.testingTask.cancel = true
|
m.invidiousInstanceTestingJob.cancel = true
|
||||||
|
m.invidiousInstanceTestingJob = invalid
|
||||||
end if
|
end if
|
||||||
|
|
||||||
m.appController@.PopScreen()
|
m.appController@.PopScreen()
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function RunTestsTask()
|
function RunTestsJob()
|
||||||
instance = m.top.instance
|
instance = m.top.instance
|
||||||
m.titleLabel.text = Tr(Locale.InvidiousTesting.TestingInstance).Replace("%1", instance)
|
m.titleLabel.text = Tr(Locale.InvidiousTesting.TestingInstance).Replace("%1", instance)
|
||||||
|
|
||||||
if m.testingTask <> invalid
|
if m.invidiousInstanceTestingJob <> invalid
|
||||||
m.testingTask.cancel = true
|
m.invidiousInstanceTestingJob.cancel = true
|
||||||
end if
|
end if
|
||||||
|
|
||||||
m.testingTask = AsyncTask.Start(Tasks.InvidiousInstanceTestingTask, {
|
input = {
|
||||||
instance: instance
|
instance: instance
|
||||||
listNode: m.testList
|
listNode: m.testList
|
||||||
})
|
}
|
||||||
|
|
||||||
|
m.invidiousInstanceTestingJob = JobSystem.CreateCallback()
|
||||||
|
JobSystem.QueueJob(m.jobQueue, Jobs.InvidiousInstanceTestingJob, input, m.invidiousInstanceTestingJob)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function ShowTestDetails() as void
|
function ShowTestDetails() as void
|
||||||
|
|||||||
+2
-1
@@ -1,8 +1,9 @@
|
|||||||
<component name="InvidiousInstanceTesting" extends="Group" includes="AutoBind,Focus">
|
<component name="InvidiousInstanceTesting" extends="Group" includes="AutoBind,Focus">
|
||||||
<interface>
|
<interface>
|
||||||
<field id="instance" type="string" />
|
<field id="instance" type="string" />
|
||||||
<field id="run" type="boolean" alwaysNotify="true" onChange="RunTestsTask" />
|
<field id="run" type="boolean" alwaysNotify="true" onChange="RunTestsJob" />
|
||||||
<field id="appController" type="node" bind="/AppController" />
|
<field id="appController" type="node" bind="/AppController" />
|
||||||
|
<field id="jobQueue" type="node" bind="/JobQueue" />
|
||||||
</interface>
|
</interface>
|
||||||
<children>
|
<children>
|
||||||
<Rectangle
|
<Rectangle
|
||||||
|
|||||||
+17
-11
@@ -5,21 +5,23 @@ import "pkg:/source/utils/ErrorUtils.bs"
|
|||||||
import "pkg:/source/utils/Locale.bs"
|
import "pkg:/source/utils/Locale.bs"
|
||||||
import "pkg:/source/utils/StringUtils.bs"
|
import "pkg:/source/utils/StringUtils.bs"
|
||||||
|
|
||||||
@asynctask
|
@job("InvidiousInstanceTestingJob")
|
||||||
function InvidiousInstanceTestingTask(input as object) as object
|
function ExecuteJob() as void
|
||||||
|
input = JobGetInput()
|
||||||
|
|
||||||
instance = input.instance
|
instance = input.instance
|
||||||
listNode = input.listNode
|
listNode = input.listNode
|
||||||
|
|
||||||
if m.top.cancel
|
if JobIsCancelled()
|
||||||
return invalid
|
JobCancel()
|
||||||
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
content = PrepareTests()
|
content = PrepareTests()
|
||||||
listNode.content = content
|
listNode.content = content
|
||||||
|
|
||||||
RunTests(instance, content, m.top.cancellation)
|
cancellation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true)
|
||||||
|
RunTests(instance, content, cancellation)
|
||||||
return invalid
|
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function PrepareTests() as object
|
function PrepareTests() as object
|
||||||
@@ -63,7 +65,8 @@ function RunTests(instance as string, content as object, cancellation as object)
|
|||||||
LogError(testNode.details)
|
LogError(testNode.details)
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if m.top.cancel
|
if CancellationUtils.IsCancelled(cancellation)
|
||||||
|
JobCancel()
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
end for
|
end for
|
||||||
@@ -139,7 +142,8 @@ end function
|
|||||||
|
|
||||||
function CanFetchVideoDetails(instance as string, testNode as object, cancellation as object) as void
|
function CanFetchVideoDetails(instance as string, testNode as object, cancellation as object) as void
|
||||||
try
|
try
|
||||||
videoId = "jNQXAC9IVRw"
|
' videoId = "jNQXAC9IVRw"
|
||||||
|
videoId = "k85mRPqvMbE"
|
||||||
url = `${instance}${Invidious.VIDEOS_ENDPOINT}/${videoId}`
|
url = `${instance}${Invidious.VIDEOS_ENDPOINT}/${videoId}`
|
||||||
response = HttpClient.Get(url).NoCache().Cancellation(cancellation).Await()
|
response = HttpClient.Get(url).NoCache().Cancellation(cancellation).Await()
|
||||||
|
|
||||||
@@ -173,7 +177,8 @@ end function
|
|||||||
|
|
||||||
function CanFetchVideoComments(instance as string, testNode as object, cancellation as object) as void
|
function CanFetchVideoComments(instance as string, testNode as object, cancellation as object) as void
|
||||||
try
|
try
|
||||||
videoId = "jNQXAC9IVRw"
|
' videoId = "jNQXAC9IVRw"
|
||||||
|
videoId = "k85mRPqvMbE"
|
||||||
url = `${instance}/api/v1/comments/${videoId}`
|
url = `${instance}/api/v1/comments/${videoId}`
|
||||||
response = HttpClient.Get(url).NoCache().Cancellation(cancellation).Await()
|
response = HttpClient.Get(url).NoCache().Cancellation(cancellation).Await()
|
||||||
|
|
||||||
@@ -260,7 +265,8 @@ end function
|
|||||||
|
|
||||||
function CanFetchVideoThumbails(instance as string, testNode as object, cancellation as object) as void
|
function CanFetchVideoThumbails(instance as string, testNode as object, cancellation as object) as void
|
||||||
try
|
try
|
||||||
videoId = "jNQXAC9IVRw"
|
' videoId = "jNQXAC9IVRw"
|
||||||
|
videoId = "k85mRPqvMbE"
|
||||||
url = `${instance}${Invidious.VIDEOS_ENDPOINT}/${videoId}`
|
url = `${instance}${Invidious.VIDEOS_ENDPOINT}/${videoId}`
|
||||||
response = HttpClient.Get(url).NoCache().Cancellation(cancellation).Await()
|
response = HttpClient.Get(url).NoCache().Cancellation(cancellation).Await()
|
||||||
|
|
||||||
Reference in new issue
Block a user