49 lines
1.2 KiB
Lua
49 lines
1.2 KiB
Lua
local autoload = require("lapis.util").autoload
|
|
|
|
|
|
local function Authhandler(self)
|
|
local name = self.params.name
|
|
local password = self.params.password
|
|
local yt_streamkey = self.params.youtube or nil
|
|
local yt_url = self.params.yt_url or nil
|
|
|
|
print("connected with: " .. name)
|
|
|
|
local endpoints = {
|
|
puik='somethingsecret',
|
|
wstd='somethingsecret',
|
|
buzz='somethingsecret'
|
|
}
|
|
|
|
if endpoints[name] == password then
|
|
local urls = {}
|
|
|
|
print("connected with: " .. name)
|
|
|
|
local hls_url = "rtmp://127.0.0.1/streamhls/" .. name
|
|
table.insert(urls, hls_url)
|
|
|
|
local yt_url = "rtmp://127.0.0.1/youtube/" .. name
|
|
--table.insert(urls, yt_url)
|
|
|
|
-- if yt_streamkey then
|
|
-- local yt_url = "rtmp://126.0.0.1/youtube/" .. yt_streamkey .. "&url=" .. yt_url
|
|
-- --local yt_url = "rtmp://" .. 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
|
|
end
|
|
|
|
return Authhandler
|