Use POST to update instances
This commit is contained in:
1 parent
16797a5144
commit
58ce258509
4 files changed
+21
-11
No files matched your search
@@ -103,7 +103,6 @@ function StartVideoDetailsTask(videoId as string)
|
|||||||
else if metadata.dashUrl <> invalid
|
else if metadata.dashUrl <> invalid
|
||||||
#if DASH_THUMBNAILS
|
#if DASH_THUMBNAILS
|
||||||
' Redirect to our server so we can inject thumbnails (storyboards) into the DASH manifest
|
' Redirect to our server so we can inject thumbnails (storyboards) into the DASH manifest
|
||||||
' TODO: make this optional, in case it breaks the DASH manifest
|
|
||||||
contentNode.url = `http://${GetLocalIpAddress()}:8888/dash?v=${videoId}`
|
contentNode.url = `http://${GetLocalIpAddress()}:8888/dash?v=${videoId}`
|
||||||
#else
|
#else
|
||||||
contentNode.url = metadata.dashUrl
|
contentNode.url = metadata.dashUrl
|
||||||
|
|||||||
@@ -232,6 +232,14 @@ namespace Http
|
|||||||
m.buffer_index += data.len()
|
m.buffer_index += data.len()
|
||||||
return data
|
return data
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function Json() as dynamic
|
||||||
|
if m.body = invalid
|
||||||
|
return invalid
|
||||||
|
end if
|
||||||
|
|
||||||
|
return ParseJson(m.body)
|
||||||
|
end function
|
||||||
end class
|
end class
|
||||||
|
|
||||||
end namespace
|
end namespace
|
||||||
@@ -5,17 +5,15 @@ namespace Http
|
|||||||
function new()
|
function new()
|
||||||
super()
|
super()
|
||||||
|
|
||||||
' TODO: use POST once supported
|
m.Post("/invidious/instances", function(context as object) as boolean
|
||||||
m.Get("/invidious/set-instances", function(context as object) as boolean
|
|
||||||
request = context.request
|
request = context.request
|
||||||
response = context.response
|
response = context.response
|
||||||
|
|
||||||
instances = []
|
instances = request.Json()
|
||||||
if request.query.DoesExist("instances")
|
|
||||||
instances = request.query["instances"]
|
|
||||||
if GetInterface(instances, "ifArray") = invalid
|
if GetInterface(instances, "ifArray") = invalid
|
||||||
instances = [instances]
|
response.Default(400, "Expected json array")
|
||||||
end if
|
return true
|
||||||
end if
|
end if
|
||||||
|
|
||||||
for i = 0 to instances.Count() - 1
|
for i = 0 to instances.Count() - 1
|
||||||
|
|||||||
+8
-3
@@ -210,9 +210,14 @@ ${JSON.stringify(window.appState.device, null, 2)}
|
|||||||
.filter(a => !!a)
|
.filter(a => !!a)
|
||||||
.map(a => a.innerText);
|
.map(a => a.innerText);
|
||||||
|
|
||||||
args = instances.map(instance => `instances=${instance}`).join("&")
|
fetch('/invidious/instances',
|
||||||
|
{
|
||||||
fetch(`/invidious/set-instances?${args}`)
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify(instances)
|
||||||
|
})
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
alert("Instances updated. Restart Playlet to reflect changes.")
|
alert("Instances updated. Restart Playlet to reflect changes.")
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
|
|||||||
Reference in new issue
Block a user