multi-redirect handler
This commit is contained in:
@@ -4,18 +4,34 @@ local autoload = require("lapis.util").autoload
|
||||
local function Authhandler(self)
|
||||
local name = self.params.name
|
||||
local password = self.params.password
|
||||
|
||||
print(name)
|
||||
print(password)
|
||||
local yt_streamkey = self.params.youtube or nil
|
||||
|
||||
local endpoints = {
|
||||
puik='something',
|
||||
wstd='something',
|
||||
buzz='something'
|
||||
}
|
||||
|
||||
|
||||
if endpoints[name] == password then
|
||||
return {status = 201}
|
||||
local urls = {}
|
||||
|
||||
local hls_url = "rtmp://127.0.0.1/streamhls/" .. name
|
||||
table.insert(urls, hls_url)
|
||||
|
||||
if yt_streamkey then
|
||||
local yt_url = "rtmp://127.0.0.1/youtube/" .. yt_streamkey
|
||||
table.insert(urls, yt_url)
|
||||
end
|
||||
|
||||
local redirect_urls = table.concat(urls, ",")
|
||||
|
||||
return {
|
||||
"remote push", {
|
||||
layout=false,
|
||||
redirect_to=redirect_urls
|
||||
}
|
||||
}
|
||||
else
|
||||
return {status = 404}
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user