Use POST to update instances
This commit is contained in:
1 parent
16797a5144
commit
58ce258509
4 files changed
+22
-12
No files matched your search
@@ -232,6 +232,14 @@ namespace Http
|
||||
m.buffer_index += data.len()
|
||||
return data
|
||||
end function
|
||||
|
||||
function Json() as dynamic
|
||||
if m.body = invalid
|
||||
return invalid
|
||||
end if
|
||||
|
||||
return ParseJson(m.body)
|
||||
end function
|
||||
end class
|
||||
|
||||
end namespace
|
||||
@@ -5,17 +5,15 @@ namespace Http
|
||||
function new()
|
||||
super()
|
||||
|
||||
' TODO: use POST once supported
|
||||
m.Get("/invidious/set-instances", function(context as object) as boolean
|
||||
m.Post("/invidious/instances", function(context as object) as boolean
|
||||
request = context.request
|
||||
response = context.response
|
||||
|
||||
instances = []
|
||||
if request.query.DoesExist("instances")
|
||||
instances = request.query["instances"]
|
||||
if GetInterface(instances, "ifArray") = invalid
|
||||
instances = [instances]
|
||||
end if
|
||||
instances = request.Json()
|
||||
|
||||
if GetInterface(instances, "ifArray") = invalid
|
||||
response.Default(400, "Expected json array")
|
||||
return true
|
||||
end if
|
||||
|
||||
for i = 0 to instances.Count() - 1
|
||||
|
||||
Reference in new issue
Block a user