add auth endpoint for on_publish
This commit is contained in:
parent
a2ad5e3d8c
commit
e9bb401170
@ -11,4 +11,8 @@ app:get("/", function(self)
|
|||||||
return handlers.Roothandler(self)
|
return handlers.Roothandler(self)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
app:post("/auth", function(self)
|
||||||
|
return handlers.Authhandler(self)
|
||||||
|
end)
|
||||||
|
|
||||||
return app
|
return app
|
||||||
|
|||||||
24
code/handlers/authhandler.lua
Normal file
24
code/handlers/authhandler.lua
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
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 endpoints = {
|
||||||
|
puik='something',
|
||||||
|
wstd='something',
|
||||||
|
buzz='something'
|
||||||
|
}
|
||||||
|
|
||||||
|
if endpoints[name] == password then
|
||||||
|
return {status = 201}
|
||||||
|
else
|
||||||
|
return {status = 404}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return Authhandler
|
||||||
@ -15,6 +15,8 @@ rtmp {
|
|||||||
application stream {
|
application stream {
|
||||||
live on;
|
live on;
|
||||||
|
|
||||||
|
on_publish http://localhost:${{PORT}}/auth;
|
||||||
|
|
||||||
#relays the incoming video to low quality streams on this server, audio-only version and to a different server
|
#relays the incoming video to low quality streams on this server, audio-only version and to a different server
|
||||||
exec ffmpeg -i rtmp://localhost:1935/stream/$name
|
exec ffmpeg -i rtmp://localhost:1935/stream/$name
|
||||||
-c:a copy -c:v copy -f flv rtmp://localhost/hls/$name_hi;
|
-c:a copy -c:v copy -f flv rtmp://localhost/hls/$name_hi;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user